1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = gdk3-X-Window-System-Interaction.html 27 * outPack = gdk 28 * outFile = X11 29 * strct = 30 * realStrct= 31 * ctorStrct= 32 * clss = X11 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gdk_x11_ 41 * omit structs: 42 * omit prefixes: 43 * - gdkx_visual_get 44 * - gdkx_colormap_get 45 * - gdk_pixmap_foreign_new 46 * - gdk_pixmap_foreign_new_for_display 47 * - gdk_pixmap_foreign_new_for_screen 48 * - gdk_window_foreign_new_for_display 49 * - gdk_xid_table_lookup_for_display 50 * - gdk_window_lookup_for_display 51 * - gdk_x11_lookup_xdisplay 52 * - gdk_net_wm_supports 53 * - gdk_x11_screen_supports_net_wm_hint 54 * - gdk_x11_screen_get_window_manager_name 55 * - gdk_x11_screen_lookup_visual 56 * - gdk_x11_display_get_user_time 57 * - gdk_x11_colormap_foreign_new 58 * - gdk_x11_colormap_get_xcolormap 59 * - gdk_x11_colormap_get_xdisplay 60 * - gdk_x11_cursor_get_xcursor 61 * - gdk_x11_cursor_get_xdisplay 62 * - gdk_x11_display_get_xdisplay 63 * - gdk_x11_display_grab 64 * - gdk_x11_display_ungrab 65 * - gdk_x11_display_set_cursor_theme 66 * - gdk_x11_register_standard_event_type 67 * - gdk_x11_drawable_get_xdisplay 68 * - gdk_x11_font_get_xdisplay 69 * - gdk_x11_gc_get_xdisplay 70 * - gdk_x11_gc_get_xgc 71 * - gdk_x11_get_default_root_xwindow 72 * - gdk_x11_get_default_xdisplay 73 * - gdk_x11_image_get_xdisplay 74 * - gdk_x11_image_get_ximage 75 * - gdk_x11_screen_get_screen_number 76 * - gdk_x11_screen_get_xscreen 77 * - gdk_x11_visual_get_xvisual 78 * - gdk_x11_atom_to_xatom 79 * - gdk_x11_atom_to_xatom_for_display 80 * - gdk_x11_xatom_to_atom 81 * - gdk_x11_xatom_to_atom_for_display 82 * - gdk_x11_get_xatom_by_name 83 * - gdk_x11_get_xatom_by_name_for_display 84 * - gdk_x11_get_xatom_name 85 * - gdk_x11_get_xatom_name_for_display 86 * - gdk_x11_window_foreign_new_for_display 87 * - gdk_x11_window_lookup_for_display 88 * omit code: 89 * - gdk_x11_window_get_xid 90 * omit signals: 91 * imports: 92 * - glib.Str 93 * - gdk.Device 94 * - gdk.DeviceManager 95 * - gdk.Display 96 * - gdk.Keymap 97 * - gdk.Screen 98 * - gdk.Window 99 * structWrap: 100 * - GdkDevice* -> Device 101 * - GdkDeviceManager* -> DeviceManager 102 * - GdkDisplay* -> Display 103 * - GdkKeymap* -> Keymap 104 * - GdkScreen* -> Screen 105 * - GdkWindow* -> Window 106 * module aliases: 107 * local aliases: 108 * overrides: 109 */ 110 111 module gdk.X11; 112 113 public import gtkc.gdktypes; 114 115 private import gtkc.gdk; 116 private import glib.ConstructionException; 117 private import gobject.ObjectG; 118 119 private import glib.Str; 120 private import gdk.Device; 121 private import gdk.DeviceManager; 122 private import gdk.Display; 123 private import gdk.Keymap; 124 private import gdk.Screen; 125 private import gdk.Window; 126 127 128 129 /** 130 * The functions in this section are specific to the GDK X11 backend. 131 * To use them, you need to include the <gdk/gdkx.h> 132 * header and use the X11-specific pkg-config files to build your 133 * application (either gdk-x11-3.0 or 134 * gtk+-x11-3.0). 135 * 136 * To make your code compile with other GDK backends, guard backend-specific 137 * calls by an ifdef as follows. Since GDK may be built with multiple 138 * backends, you should also check for the backend that is in use (e.g. by 139 * using the GDK_IS_X11_DISPLAY() macro). 140 * 141 * $(DDOC_COMMENT example) 142 */ 143 public class X11 144 { 145 146 /** 147 * Returns the X resource (window) belonging to a GdkWindow. 148 * Params: 149 * window = a native GdkWindow. 150 * Returns: the ID of drawable's X resource. 151 */ 152 public static gulong windowGetXid(Window window) 153 { 154 // Window gdk_x11_window_get_xid (GdkWindow *window); 155 return gdk_x11_window_get_xid((window is null) ? null : window.getWindowStruct()); 156 } 157 158 /** 159 */ 160 161 /** 162 * Routine to get the current X server time stamp. 163 * Params: 164 * window = a GdkWindow, used for communication 165 * with the server. The window must have 166 * GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will 167 * result. [type GdkX11Window] 168 * Returns: the time stamp. 169 */ 170 public static uint getServerTime(Window window) 171 { 172 // guint32 gdk_x11_get_server_time (GdkWindow *window); 173 return gdk_x11_get_server_time((window is null) ? null : window.getWindowStruct()); 174 } 175 176 /** 177 * Returns the device ID as seen by XInput2. 178 * Note 179 * If gdk_disable_multidevice() has been called, this function 180 * will respectively return 2/3 for the core pointer and keyboard, 181 * (matching the IDs for the Virtual Core Pointer and Keyboard in 182 * XInput 2), but calling this function on any slave devices (i.e. 183 * those managed via XInput 1.x), will return 0. 184 * Params: 185 * device = a GdkDevice 186 * Returns: the XInput2 device ID. Since 3.2 187 */ 188 public static int deviceGetId(Device device) 189 { 190 // gint gdk_x11_device_get_id (GdkDevice *device); 191 return gdk_x11_device_get_id((device is null) ? null : device.getDeviceStruct()); 192 } 193 194 /** 195 * Returns the GdkDevice that wraps the given device ID. 196 * Params: 197 * deviceManager = a GdkDeviceManager 198 * deviceId = a device ID, as understood by the XInput2 protocol 199 * Returns: (allow-none): The GdkDevice wrapping the device ID, or NULL if the given ID doesn't currently represent a device. [transfer none] Since 3.2 200 */ 201 public static Device deviceManagerLookup(DeviceManager deviceManager, int deviceId) 202 { 203 // GdkDevice * gdk_x11_device_manager_lookup (GdkDeviceManager *device_manager, gint device_id); 204 auto p = gdk_x11_device_manager_lookup((deviceManager is null) ? null : deviceManager.getDeviceManagerStruct(), deviceId); 205 206 if(p is null) 207 { 208 return null; 209 } 210 211 return ObjectG.getDObject!(Device)(cast(GdkDevice*) p); 212 } 213 214 /** 215 * Gets the startup notification ID for a display. 216 * Since 2.12 217 * Params: 218 * display = a GdkDisplay. [type GdkX11Display] 219 * Returns: the startup notification ID for display 220 */ 221 public static string displayGetStartupNotificationId(Display display) 222 { 223 // const gchar * gdk_x11_display_get_startup_notification_id (GdkDisplay *display); 224 return Str.toString(gdk_x11_display_get_startup_notification_id((display is null) ? null : display.getDisplayStruct())); 225 } 226 227 /** 228 * Sets the startup notification ID for a display. 229 * This is usually taken from the value of the DESKTOP_STARTUP_ID 230 * environment variable, but in some cases (such as the application not 231 * being launched using exec()) it can come from other sources. 232 * If the ID contains the string "_TIME" then the portion following that 233 * string is taken to be the X11 timestamp of the event that triggered 234 * the application to be launched and the GDK current event time is set 235 * accordingly. 236 * The startup ID is also what is used to signal that the startup is 237 * complete (for example, when opening a window or when calling 238 * gdk_notify_startup_complete()). 239 * Params: 240 * display = a GdkDisplay. [type GdkX11Display] 241 * startupId = the startup notification ID (must be valid utf8) 242 * Since 3.0 243 */ 244 public static void displaySetStartupNotificationId(Display display, string startupId) 245 { 246 // void gdk_x11_display_set_startup_notification_id (GdkDisplay *display, const gchar *startup_id); 247 gdk_x11_display_set_startup_notification_id((display is null) ? null : display.getDisplayStruct(), Str.toStringz(startupId)); 248 } 249 250 /** 251 * Begins a range of X requests on display for which X error events 252 * will be ignored. Unignored errors (when no trap is pushed) will abort 253 * the application. Use gdk_x11_display_error_trap_pop() or 254 * gdk_x11_display_error_trap_pop_ignored()to lift a trap pushed 255 * with this function. 256 * See also gdk_error_trap_push() to push a trap on all displays. 257 * Params: 258 * display = a GdkDisplay. [type GdkX11Display] 259 * Since 3.0 260 */ 261 public static void displayErrorTrapPush(Display display) 262 { 263 // void gdk_x11_display_error_trap_push (GdkDisplay *display); 264 gdk_x11_display_error_trap_push((display is null) ? null : display.getDisplayStruct()); 265 } 266 267 /** 268 * Pops the error trap pushed by gdk_x11_display_error_trap_push(). 269 * Will XSync() if necessary and will always block until 270 * the error is known to have occurred or not occurred, 271 * so the error code can be returned. 272 * If you don't need to use the return value, 273 * gdk_x11_display_error_trap_pop_ignored() would be more efficient. 274 * See gdk_error_trap_pop() for the all-displays-at-once 275 * equivalent. 276 * Params: 277 * display = the display. [type GdkX11Display] 278 * Returns: X error code or 0 on success Since 3.0 279 */ 280 public static int displayErrorTrapPop(Display display) 281 { 282 // gint gdk_x11_display_error_trap_pop (GdkDisplay *display); 283 return gdk_x11_display_error_trap_pop((display is null) ? null : display.getDisplayStruct()); 284 } 285 286 /** 287 * Pops the error trap pushed by gdk_x11_display_error_trap_push(). 288 * Does not block to see if an error occurred; merely records the 289 * range of requests to ignore errors for, and ignores those errors 290 * if they arrive asynchronously. 291 * See gdk_error_trap_pop_ignored() for the all-displays-at-once 292 * equivalent. 293 * Params: 294 * display = the display. [type GdkX11Display] 295 * Since 3.0 296 */ 297 public static void displayErrorTrapPopIgnored(Display display) 298 { 299 // void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display); 300 gdk_x11_display_error_trap_pop_ignored((display is null) ? null : display.getDisplayStruct()); 301 } 302 303 /** 304 * Forces a specific window scale for all windows on this display, 305 * instead of using the default or user configured scale. This 306 * is can be used to disable scaling support by setting scale to 307 * 1, or to programmatically set the window scale. 308 * Once the scale is set by this call it will not change in response 309 * to later user configuration changes. 310 * Params: 311 * display = the display. [type GdkX11Display] 312 * scale = The new scale value 313 * Since 3.10 314 */ 315 public static void displaySetWindowScale(Display display, int scale) 316 { 317 // void gdk_x11_display_set_window_scale (GdkDisplay *display, gint scale); 318 gdk_x11_display_set_window_scale((display is null) ? null : display.getDisplayStruct(), scale); 319 } 320 321 /** 322 * Gets the XID of the specified output/monitor. 323 * If the X server does not support version 1.2 of the RANDR 324 * extension, 0 is returned. 325 * Since 2.14 326 * Params: 327 * screen = a GdkScreen. [type GdkX11Screen] 328 * monitorNum = number of the monitor, between 0 and gdk_screen_get_n_monitors (screen) 329 * Returns: the XID of the monitor 330 */ 331 public static uint screenGetMonitorOutput(Screen screen, int monitorNum) 332 { 333 // XID gdk_x11_screen_get_monitor_output (GdkScreen *screen, gint monitor_num); 334 return gdk_x11_screen_get_monitor_output((screen is null) ? null : screen.getScreenStruct(), monitorNum); 335 } 336 337 /** 338 * Returns the number of workspaces for screen when running under a 339 * window manager that supports multiple workspaces, as described 340 * in the Extended 341 * Window Manager Hints. 342 * Params: 343 * screen = a GdkScreen 344 * Returns: the number of workspaces, or 0 if workspaces are not supported Since 3.10 345 */ 346 public static uint screenGetNumberOfDesktops(Screen screen) 347 { 348 // guint32 gdk_x11_screen_get_number_of_desktops (GdkScreen *screen); 349 return gdk_x11_screen_get_number_of_desktops((screen is null) ? null : screen.getScreenStruct()); 350 } 351 352 /** 353 * Returns the current workspace for screen when running under a 354 * window manager that supports multiple workspaces, as described 355 * in the Extended 356 * Window Manager Hints. 357 * Params: 358 * screen = a GdkScreen 359 * Returns: the current workspace, or 0 if workspaces are not supported Since 3.10 360 */ 361 public static uint screenGetCurrentDesktop(Screen screen) 362 { 363 // guint32 gdk_x11_screen_get_current_desktop (GdkScreen *screen); 364 return gdk_x11_screen_get_current_desktop((screen is null) ? null : screen.getScreenStruct()); 365 } 366 367 /** 368 * Set a hint for the window manager, requesting that the titlebar 369 * should be hidden when the window is maximized. 370 * Note that this property is automatically updated by GTK+, so this 371 * function should only be used by applications which do not use GTK+ 372 * to create toplevel windows. 373 * Params: 374 * window = a GdkWindow. [type GdkX11Window] 375 * hideTitlebarWhenMaximized = whether to hide the titlebar when 376 * maximized 377 * Since 3.4 378 */ 379 public static void windowSetHideTitlebarWhenMaximized(Window window, int hideTitlebarWhenMaximized) 380 { 381 // void gdk_x11_window_set_hide_titlebar_when_maximized (GdkWindow *window, gboolean hide_titlebar_when_maximized); 382 gdk_x11_window_set_hide_titlebar_when_maximized((window is null) ? null : window.getWindowStruct(), hideTitlebarWhenMaximized); 383 } 384 385 /** 386 * GTK+ applications can request a dark theme variant. In order to 387 * make other applications - namely window managers using GTK+ for 388 * themeing - aware of this choice, GTK+ uses this function to 389 * export the requested theme variant as _GTK_THEME_VARIANT property 390 * on toplevel windows. 391 * Note that this property is automatically updated by GTK+, so this 392 * function should only be used by applications which do not use GTK+ 393 * to create toplevel windows. 394 * Params: 395 * window = a GdkWindow. [type GdkX11Window] 396 * variant = the theme variant to export 397 * Since 3.2 398 */ 399 public static void windowSetThemeVariant(Window window, string variant) 400 { 401 // void gdk_x11_window_set_theme_variant (GdkWindow *window, char *variant); 402 gdk_x11_window_set_theme_variant((window is null) ? null : window.getWindowStruct(), Str.toStringz(variant)); 403 } 404 405 /** 406 * The application can use this call to update the _NET_WM_USER_TIME 407 * property on a toplevel window. This property stores an Xserver 408 * time which represents the time of the last user input event 409 * received for this window. This property may be used by the window 410 * manager to alter the focus, stacking, and/or placement behavior of 411 * windows when they are mapped depending on whether the new window 412 * was created by a user action or is a "pop-up" window activated by a 413 * timer or some other event. 414 * Note that this property is automatically updated by GDK, so this 415 * function should only be used by applications which handle input 416 * events bypassing GDK. 417 * Since 2.6 418 * Params: 419 * window = A toplevel GdkWindow. [type GdkX11Window] 420 * timestamp = An XServer timestamp to which the property should be set 421 */ 422 public static void windowSetUserTime(Window window, uint timestamp) 423 { 424 // void gdk_x11_window_set_user_time (GdkWindow *window, guint32 timestamp); 425 gdk_x11_window_set_user_time((window is null) ? null : window.getWindowStruct(), timestamp); 426 } 427 428 /** 429 * Moves the window to the correct workspace when running under a 430 * window manager that supports multiple workspaces, as described 431 * in the Extended 432 * Window Manager Hints. Will not do anything if the 433 * window is already on all workspaces. 434 * Since 2.8 435 * Params: 436 * window = a GdkWindow. [type GdkX11Window] 437 */ 438 public static void windowMoveToCurrentDesktop(Window window) 439 { 440 // void gdk_x11_window_move_to_current_desktop (GdkWindow *window); 441 gdk_x11_window_move_to_current_desktop((window is null) ? null : window.getWindowStruct()); 442 } 443 444 /** 445 * Moves the window to the given workspace when running unde a 446 * window manager that supports multiple workspaces, as described 447 * in the Extended 448 * Window Manager Hints. 449 * Params: 450 * window = a GdkWindow 451 * desktop = the number of the workspace to move the window to 452 * Since 3.10 453 */ 454 public static void windowMoveToDesktop(Window window, uint desktop) 455 { 456 // void gdk_x11_window_move_to_desktop (GdkWindow *window, guint32 desktop); 457 gdk_x11_window_move_to_desktop((window is null) ? null : window.getWindowStruct(), desktop); 458 } 459 460 /** 461 * Gets the number of the workspace window is on. 462 * Params: 463 * window = a GdkWindow 464 * Returns: the current workspace of window Since 3.10 465 */ 466 public static uint windowGetDesktop(Window window) 467 { 468 // guint32 gdk_x11_window_get_desktop (GdkWindow *window); 469 return gdk_x11_window_get_desktop((window is null) ? null : window.getWindowStruct()); 470 } 471 472 /** 473 * This function modifies or removes an arbitrary X11 window 474 * property of type UTF8_STRING. If the given window is 475 * not a toplevel window, it is ignored. 476 * Params: 477 * window = a GdkWindow. [type GdkX11Window] 478 * name = Property name, will be interned as an X atom 479 * value = Property value, or NULL to delete. [allow-none] 480 * Since 3.4 481 */ 482 public static void windowSetUtf8_Property(Window window, string name, string value) 483 { 484 // void gdk_x11_window_set_utf8_property (GdkWindow *window, const gchar *name, const gchar *value); 485 gdk_x11_window_set_utf8_property((window is null) ? null : window.getWindowStruct(), Str.toStringz(name), Str.toStringz(value)); 486 } 487 488 /** 489 * Newer GTK+ windows using client-side decorations use extra geometry 490 * around their frames for effects like shadows and invisible borders. 491 * Window managers that want to maximize windows or snap to edges need 492 * to know where the extents of the actual frame lie, so that users 493 * don't feel like windows are snapping against random invisible edges. 494 * Note that this property is automatically updated by GTK+, so this 495 * function should only be used by applications which do not use GTK+ 496 * to create toplevel windows. 497 * Params: 498 * window = a GdkWindow. [type GdkX11Window] 499 * left = The left extent 500 * right = The right extent 501 * top = The top extent 502 * bottom = The bottom extent 503 * Since 3.10 504 */ 505 public static void windowSetFrameExtents(Window window, int left, int right, int top, int bottom) 506 { 507 // void gdk_x11_window_set_frame_extents (GdkWindow *window, int left, int right, int top, int bottom); 508 gdk_x11_window_set_frame_extents((window is null) ? null : window.getWindowStruct(), left, right, top, bottom); 509 } 510 511 /** 512 * This function can be used to disable frame synchronization for a window. 513 * Normally frame synchronziation will be enabled or disabled based on whether 514 * the system has a compositor that supports frame synchronization, but if 515 * the window is not directly managed by the window manager, then frame 516 * synchronziation may need to be disabled. This is the case for a window 517 * embedded via the XEMBED protocol. 518 * Params: 519 * window = a native GdkWindow. [type GdkX11Window] 520 * frameSyncEnabled = whether frame-synchronization should be enabled 521 * Since 3.8 522 */ 523 public static void windowSetFrameSyncEnabled(Window window, int frameSyncEnabled) 524 { 525 // void gdk_x11_window_set_frame_sync_enabled (GdkWindow *window, gboolean frame_sync_enabled); 526 gdk_x11_window_set_frame_sync_enabled((window is null) ? null : window.getWindowStruct(), frameSyncEnabled); 527 } 528 529 /** 530 * Gets the default GTK+ screen number. 531 * Returns: returns the screen number specified by the --display command line option or the DISPLAY environment variable when gdk_init() calls XOpenDisplay(). 532 */ 533 public static int getDefaultScreen() 534 { 535 // gint gdk_x11_get_default_screen (void); 536 return gdk_x11_get_default_screen(); 537 } 538 539 /** 540 * Call gdk_x11_display_grab() on the default display. 541 * To ungrab the server again, use gdk_x11_ungrab_server(). 542 * gdk_x11_grab_server()/gdk_x11_ungrab_server() calls can be nested. 543 */ 544 public static void grabServer() 545 { 546 // void gdk_x11_grab_server (void); 547 gdk_x11_grab_server(); 548 } 549 550 /** 551 * Ungrab the default display after it has been grabbed with 552 * gdk_x11_grab_server(). 553 */ 554 public static void ungrabServer() 555 { 556 // void gdk_x11_ungrab_server (void); 557 gdk_x11_ungrab_server(); 558 } 559 560 /** 561 * Extracts the group from the state field sent in an X Key event. 562 * This is only needed for code processing raw X events, since GdkEventKey 563 * directly includes an is_modifier field. 564 * Params: 565 * keymap = a GdkX11Keymap 566 * state = raw state returned from X 567 * Returns: the index of the active keyboard group for the event Since 3.6 568 */ 569 public static int keymapGetGroupForState(Keymap keymap, uint state) 570 { 571 // gint gdk_x11_keymap_get_group_for_state (GdkKeymap *keymap, guint state); 572 return gdk_x11_keymap_get_group_for_state((keymap is null) ? null : keymap.getKeymapStruct(), state); 573 } 574 575 /** 576 * Determines whether a particular key code represents a key that 577 * is a modifier. That is, it's a key that normally just affects 578 * the keyboard state and the behavior of other keys rather than 579 * producing a direct effect itself. This is only needed for code 580 * processing raw X events, since GdkEventKey directly includes 581 * an is_modifier field. 582 * Params: 583 * keymap = a GdkX11Keymap 584 * keycode = the hardware keycode from a key event 585 * Returns: TRUE if the hardware keycode is a modifier key Since 3.6 586 */ 587 public static int keymapKeyIsModifier(Keymap keymap, uint keycode) 588 { 589 // gboolean gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap, guint keycode); 590 return gdk_x11_keymap_key_is_modifier((keymap is null) ? null : keymap.getKeymapStruct(), keycode); 591 } 592 593 /** 594 * Sets the SM_CLIENT_ID property on the application's leader window so that 595 * the window manager can save the application's state using the X11R6 ICCCM 596 * session management protocol. 597 * See the X Session Management Library documentation for more information on 598 * session management and the Inter-Client Communication Conventions Manual 599 * Since 2.24 600 * Params: 601 * smClientId = the client id assigned by the session manager when the 602 * connection was opened, or NULL to remove the property. 603 */ 604 public static void setSmClientId(string smClientId) 605 { 606 // void gdk_x11_set_sm_client_id (const gchar *sm_client_id); 607 gdk_x11_set_sm_client_id(Str.toStringz(smClientId)); 608 } 609 610 /** 611 * Convert a text string from the encoding as it is stored 612 * in a property into an array of strings in the encoding of 613 * the current locale. (The elements of the array represent the 614 * nul-separated elements of the original text string.) 615 * Since 2.24 616 * Params: 617 * display = The GdkDisplay where the encoding is defined. [type GdkX11Display] 618 * encoding = an atom representing the encoding. The most 619 * common values for this are STRING, or COMPOUND_TEXT. 620 * This is value used as the type for the property 621 * format = the format of the property 622 * text = The text data 623 * list = location to store an array of strings in 624 * the encoding of the current locale. This array should be 625 * freed using gdk_free_text_list(). 626 * Returns: the number of strings stored in list, or 0, if the conversion failed 627 */ 628 public static int displayTextPropertyToTextList(Display display, GdkAtom encoding, int format, char[] text, out string[] list) 629 { 630 // gint gdk_x11_display_text_property_to_text_list (GdkDisplay *display, GdkAtom encoding, gint format, const guchar *text, gint length, gchar ***list); 631 char** outlist = null; 632 int length; 633 634 auto p = gdk_x11_display_text_property_to_text_list((display is null) ? null : display.getDisplayStruct(), encoding, format, text.ptr, length, &outlist); 635 636 list = null; 637 foreach ( cstr; outlist[0 .. length] ) 638 { 639 list ~= Str.toString(cstr); 640 } 641 return p; 642 } 643 644 /** 645 * Frees the array of strings created by 646 * gdk_x11_display_text_property_to_text_list(). 647 * Since 2.24 648 * Params: 649 * list = the value stored in the list parameter by 650 * a call to gdk_x11_display_text_property_to_text_list(). 651 */ 652 public static void freeTextList(ref string list) 653 { 654 // void gdk_x11_free_text_list (gchar **list); 655 char* outlist = Str.toStringz(list); 656 657 gdk_x11_free_text_list(&outlist); 658 659 list = Str.toString(outlist); 660 } 661 662 /** 663 * Convert a string from the encoding of the current 664 * locale into a form suitable for storing in a window property. 665 * Since 2.24 666 * Params: 667 * display = the GdkDisplay where the encoding is defined. [type GdkX11Display] 668 * str = a nul-terminated string 669 * encoding = location to store the encoding atom 670 * (to be used as the type for the property). [out][transfer none] 671 * format = location to store the format of the property. [out] 672 * ctext = location to store newly 673 * allocated data for the property. [out][array length=length] 674 * Returns: 0 upon success, non-zero upon failure 675 */ 676 public static int displayStringToCompoundText(Display display, string str, out GdkAtom encoding, out int format, out char[] ctext) 677 { 678 // gint gdk_x11_display_string_to_compound_text (GdkDisplay *display, const gchar *str, GdkAtom *encoding, gint *format, guchar **ctext, gint *length); 679 guchar* outctext = null; 680 int length; 681 682 auto p = gdk_x11_display_string_to_compound_text((display is null) ? null : display.getDisplayStruct(), Str.toStringz(str), &encoding, &format, &outctext, &length); 683 684 ctext = outctext[0 .. length]; 685 return p; 686 } 687 688 /** 689 * Converts from UTF-8 to compound text. 690 * Since 2.24 691 * Params: 692 * display = a GdkDisplay. [type GdkX11Display] 693 * str = a UTF-8 string 694 * encoding = location to store resulting encoding. [out] 695 * format = location to store format of the result. [out] 696 * ctext = location to store the data of the result. [out][array length=length] 697 * Returns: TRUE if the conversion succeeded, otherwise FALSE 698 */ 699 public static int displayUtf8_ToCompoundText(Display display, string str, out GdkAtom encoding, out int format, out char[] ctext) 700 { 701 // gboolean gdk_x11_display_utf8_to_compound_text (GdkDisplay *display, const gchar *str, GdkAtom *encoding, gint *format, guchar **ctext, gint *length); 702 guchar* outctext = null; 703 int length; 704 705 auto p = gdk_x11_display_utf8_to_compound_text((display is null) ? null : display.getDisplayStruct(), Str.toStringz(str), &encoding, &format, &outctext, &length); 706 707 ctext = outctext[0 .. length]; 708 return p; 709 } 710 711 /** 712 * Frees the data returned from gdk_x11_display_string_to_compound_text(). 713 * Since 2.24 714 * Params: 715 * ctext = The pointer stored in ctext from a call to 716 * gdk_x11_display_string_to_compound_text(). 717 */ 718 public static void freeCompoundText(ref char ctext) 719 { 720 // void gdk_x11_free_compound_text (guchar *ctext); 721 gdk_x11_free_compound_text(&ctext); 722 } 723 }