4 Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
20 #ifndef __SAMSUNG_LINUX_UTIL_X11_H__
21 #define __SAMSUNG_LINUX_UTIL_X11_H__
24 #define DEPRECATED __attribute__((deprecated))
30 * @defgroup utilX X11 utilities
32 * @brief Samsung Linux platform X11 utilties
34 * Common X11 utilities
35 * You can use this API with #include <utilX.h>
43 #include <sys/types.h>
52 #define KEY_VOLUMEUP "XF86AudioRaiseVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */
53 #define KEY_VOLUMEDOWN "XF86AudioLowerVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */
55 #define KEY_CAMERA "XF86WebCam" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */
56 #define KEY_CONFIG "XF86Pictures" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */
58 #define KEY_POWER "XF86PowerOff" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */
59 #define KEY_PAUSE "XF86Standby" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */
60 #define KEY_CANCEL "Cancel" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */
62 // Earjack/BT Headset/Multimedia keys
63 #define KEY_PLAYCD "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */
64 #define KEY_STOPCD "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */
65 #define KEY_PAUSECD "XF86AudioPause" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */
66 #define KEY_NEXTSONG "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */
67 #define KEY_PREVIOUSSONG "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */
68 #define KEY_REWIND "XF86AudioRewind" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */
69 #define KEY_FASTFORWARD "XF86AudioForward" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */
70 #define KEY_MEDIA "XF86AudioMedia" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */
71 #define KEY_PLAYPAUSE "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'PlayPause' key */
72 #define KEY_MUTE "XF86AudioMute" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mute' key */
75 #define KEY_SEND "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
76 #define KEY_SELECT "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
77 #define KEY_END "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
79 // Renamed 3-Touch key
80 #define KEY_MENU "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
81 #define KEY_HOME "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
82 #define KEY_BACK "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
84 //Other functions keys
85 #define KEY_HOMEPAGE "XF86HomePage" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'HomePage' key */
86 #define KEY_WEBPAGE "XF86WWW" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'WWW' key */
87 #define KEY_MAIL "XF86Mail" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mail' key */
88 #define KEY_SCREENSAVER "XF86ScreenSaver" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'ScreenSaver' key */
89 #define KEY_BRIGHTNESSUP "XF86MonBrightnessUp" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessUp' key */
90 #define KEY_BRIGHTNESSDOWN "XF86MonBrightnessDown" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessDown' key */
91 #define KEY_SOFTKBD "XF86MenuKB" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Soft keyboard(toggle)' key */
92 #define KEY_QUICKPANEL "XF86Tools" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Quick panel(toggle)' key */
93 #define KEY_TASKSWITCH "XF86TaskPane" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Task switcher(toggle)' key */
94 #define KEY_APPS "XF86Launch0" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Apptray(toggle)' key */
95 #define KEY_SEARCH "XF86Search" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Search(toggle)' key */
96 #define KEY_VOICE "XF86Launch2" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Voice(toggle)' key */
97 #define KEY_LANGUAGE "Hangul" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Language(toggle)' key */
99 #define LEN_KEY_VOLUMEUP 20 /**< this macro is the length of string corresponds to 'Volume Up' key */
100 #define LEN_KEY_VOLUMEDOWN 20 /**< this macro is the length of string corresponds to 'Volume Down' key */
102 #define LEN_KEY_CAMERA 10 /**< this macro is the length of string corresponds to 'Half-Press of Camera' key */
103 #define LEN_KEY_CONFIG 12 /**< this macro is the length of string corresponds to 'Full-Press of Camera' key */
105 #define LEN_KEY_POWER 12 /**< this macro is the length of string corresponds to 'Power' key */
106 #define LEN_KEY_PAUSE 11 /**< this macro is the length of string corresponds to 'Pause' key */
108 // Earjack/BT Headset/Multimedia keys
109 #define LEN_KEY_PLAYCD 13/**< this macro is the length of string corresponds to 'Play Audio' key */
110 #define LEN_KEY_STOPCD 13/**< this macro is the length of string corresponds to 'Stop Audio' key */
111 #define LEN_KEY_PAUSECD 14/**< this macro is the length of string corresponds to 'Pause Audio' key */
112 #define LEN_KEY_NEXTSONG 13/**< this macro is the length of string corresponds to 'Next Song' key */
113 #define LEN_KEY_PREVIOUSSONG 13/**< this macro is the length of string corresponds to 'Previous Song' key */
114 #define LEN_KEY_REWIND 15/**< this macro is the length of string corresponds to 'Rewind Song' key */
115 #define LEN_KEY_FASTFORWARD 16/**< this macro is the length of string corresponds to 'Forwand Song' key */
116 #define LEN_KEY_MEDIA 14/**< this macro is the length of string corresponds to 'Media' key */
117 #define LEN_KEY_PLAYPAUSE 13 /**< this macro is the length of string corresponds to 'PlayPause' key */
118 #define LEN_KEY_MUTE 13 /**< this macro is the length of string corresponds to 'Mute' key */
121 #define LEN_KEY_SEND 8 /**< this macro is the length of string corresponds to 'Send' key */
122 #define LEN_KEY_SELECT 9 /**< this macro is the length of string corresponds to 'Home' key */
123 #define LEN_KEY_END 8 /**< this macro is the length of string corresponds to 'End' key */
125 // Renamed 3-Touch key
126 #define LEN_KEY_MENU 8 /**< this macro is the length of string corresponds to 'Send' key */
127 #define LEN_KEY_HOME 9 /**< this macro is the length of string corresponds to 'Home' key */
128 #define LEN_KEY_BACK 8 /**< this macro is the length of string corresponds to 'End' key */
130 //Other functions keys
131 #define LEN_KEY_HOMEPAGE 12 /**< this macro is the length of string corresponds to 'HomePage' key */
132 #define LEN_KEY_WEBPAGE 7 /**< this macro is the length of string corresponds to 'WWW' key */
133 #define LEN_KEY_MAIL 8 /**< this macro is the length of string corresponds to 'Mail' key */
134 #define LEN_KEY_SCREENSAVER 15 /**< this macro is the length of string corresponds to 'ScreenSaver' key */
135 #define LEN_KEY_BRIGHTNESSUP 19 /**< this macro is the length of string corresponds to 'BrightnessUp' key */
136 #define LEN_KEY_BRIGHTNESSDOWN 21 /**< this macro is the length of string corresponds to 'BrightnessDown' key */
138 #define LEN_KEY_SOFTKBD 10 /**< this macro is the length of string corresponds to 'Soft keyboard(toggle)' key */
139 #define LEN_KEY_QUICKPANEL 9 /**< this macro is the length of string corresponds to 'Quick panel(toggle)' key */
140 #define LEN_KEY_TASKSWITCH 12 /**< this macro is the length of string corresponds to 'Task switcher(toggle)' key */
141 #define LEN_KEY_APPS 11 /**< this macro is the length of string corresponds to 'Apptray(toggle)' key */
142 #define LEN_KEY_SEARCH 10 /**< this macro is the length of string corresponds to 'Search(toggle)' key */
143 #define LEN_KEY_VOICE 11 /**< this macro is the length of string corresponds to 'Voice(toggle)' key */
144 #define LEN_KEY_LANGUAGE 6 /**< this macro is the length of string corresponds to 'Language(toggle)' key */
146 #define OR_EXCLUSIVE_GRAB 0xf00000 /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack but the grab is overridable by the other client window */
147 #define EXCLUSIVE_GRAB 0x0f0000 /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack */
148 #define TOP_POSITION_GRAB 0x00f000 /**< this means that the client window will get the grabbed-key only when on the top of the grabbing-window stack */
149 #define SHARED_GRAB 0x000f00 /**< this means that the client window will get the grabbed-key together with the other client window(s) */
150 #define GRAB_MODE_MASK 0xffff00 /**< this mask will be used for getting the key-grab mode of a client window */
152 #define EXCLUSIVE_GRABBED_ALREADY 1 /**< this means that the client window is grabbing the key already in EXCLUSIVE mode */
154 #define STR_ATOM_GRAB_KEY "_GRAB_KEY" /**< this is an XATOM for getting/setting the property for grabbing a key for a window */
155 #define STR_ATOM_GRAB_EXCL_WIN "_GRAB_EXCL_WIN_KEYCODE" /**< this means that the key was grabbed by a client window in EXCLUSIVE mod */
156 #define STR_ATOM_GRAB_OR_EXCL_WIN "_GRAB_OR_EXCL_WIN_KEYCODE" /**< this means that the key was grabbed by a client window in OR_EXCLUSIVE mod */
158 #define STR_ATOM_SCRNCONF_STATUS "_SCRNCONF_STATUS" /**< this is an XATOM for getting the status of the screen configuration through the client message */
161 * @brief Enumeration of screen configuration status
163 typedef enum _Utilx_Scrnconf_Status
165 UTILX_SCRNCONF_STATUS_NULL, /**< screen configuration status is null */
166 UTILX_SCRNCONF_STATUS_CONNECT, /**< screen configuration status is connect */
167 UTILX_SCRNCONF_STATUS_ACTIVE /**< screen configuration status is active */
168 } Utilx_Scrnconf_Status;
171 * @brief Enumeration of screen configuration display mode
173 typedef enum _Utilx_Scrnconf_Dispmode
175 UTILX_SCRNCONF_DISPMODE_NULL, /**< display mode of screen configuration is null */
176 UTILX_SCRNCONF_DISPMODE_CLONE, /**< display mode of screen configuration is clone */
177 UTILX_SCRNCONF_DISPMODE_EXTENDED /**< display mode of screen configuration is extended */
178 } Utilx_Scrnconf_Dispmode;
182 * @brief Enumeration of key status
184 typedef enum _Utilx_Key_Status
186 UTILX_KEY_STATUS_PRESSED, /**< key status is pressed */
187 UTILX_KEY_STATUS_RELEASED, /**< key status is released */
188 UTILX_KEY_STATUS_UNKNOWN /** < key status is unknown or error happened */
192 * @brief Enumeration of notification window's priority level
194 typedef enum _Utilx_Notification_Level
196 UTILX_NOTIFICATION_LEVEL_LOW, /**< low level notification */
197 UTILX_NOTIFICATION_LEVEL_NORMAL, /**< normal level notification*/
198 UTILX_NOTIFICATION_LEVEL_HIGH /**< high level notification */
199 } Utilx_Notification_Level;
202 * @brief Enumeration of Compositing Window Manager's Effect Type
204 typedef enum _Utilx_Effect_Type
206 UTILX_EFFECT_TYPE_MAP, /**< Effect for Window's Map Notify Event */
207 UTILX_EFFECT_TYPE_UNMAP, /**< Effect for Window's UnMap Notify Event */
208 UTILX_EFFECT_TYPE_RAISEABOVE, /**< Effect for Window's Configure Notify ( RaiseAbove case ) Event */
209 UTILX_EFFECT_TYPE_ROTATION, /**< Effect for Window's Rotation Property Change Notify Event ( X Property: ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE ) */
210 UTILX_EFFECT_TYPE_FOCUSIN, /**< Effect for Window's FocusIn Event ( E17's Event: E_EVENT_BORDER_FOCUS_IN ) */
211 UTILX_EFFECT_TYPE_FOCUSOUT /**< Effect for Window's FocusOut Event ( E17's Event : E_EVENT_BORDER_FOCUS_OUT ) */
215 * @brief Enumeration of Compositing Window Manager's Effect Style
217 typedef enum _Utilx_Effect_Style
219 UTILX_EFFECT_STYLE_DEFAULT, /**< Default Effect Style for Effect Type */
220 UTILX_EFFECT_STYLE_NONE, /**< None of Effect Style for Effect Type */
221 UTILX_EFFECT_STYLE_CUSTOM0, /**< Custom0 Effect Style for Effect Type */
222 UTILX_EFFECT_STYLE_CUSTOM1, /**< Custom1 Effect Style for Effect Type */
223 UTILX_EFFECT_STYLE_CUSTOM2, /**< Custom2 Effect Style for Effect Type */
224 UTILX_EFFECT_STYLE_CUSTOM3, /**< Custom3 Effect Style for Effect Type */
225 UTILX_EFFECT_STYLE_CUSTOM4, /**< Custom4 Effect Style for Effect Type */
226 UTILX_EFFECT_STYLE_CUSTOM5, /**< Custom5 Effect Style for Effect Type */
227 UTILX_EFFECT_STYLE_CUSTOM6, /**< Custom6 Effect Style for Effect Type */
228 UTILX_EFFECT_STYLE_CUSTOM7, /**< Custom7 Effect Style for Effect Type */
229 UTILX_EFFECT_STYLE_CUSTOM8, /**< Custom8 Effect Style for Effect Type */
230 UTILX_EFFECT_STYLE_CUSTOM9 /**< Custom9 Effect Style for Effect Type */
231 } Utilx_Effect_Style;
234 * @brief Enumeration of opaque state
236 typedef enum _Utilx_Opaque_State
238 UTILX_OPAQUE_STATE_OFF = 0, /**< Transparent state */
239 UTILX_OPAQUE_STATE_ON = 1, /**< Opaque state */
240 } Utilx_Opaque_State;
243 * @brief Enumeration of Fb's type
245 typedef enum _Utilx_Fb_Type
247 UTILX_FB_TYPE_NONE = 0, /**< None type */
248 UTILX_FB_TYPE_UI = 1, /**< Framebuffer type is 'UI' */
249 UTILX_FB_TYPE_OVERLAY = 2, /**< Framebuffer type is 'Overlay' */
253 * @brief Structure of screen configuration information
255 typedef struct _UtilxScrnConf
257 char *str_output; /**< string value for the connector type */
258 Utilx_Scrnconf_Status status; /**< status of screen configurtaion */
259 char *str_resolution; /**< string value for the resolution to be active status */
260 Utilx_Scrnconf_Dispmode dispmode; /**< display mode of screen configuration to be active status */
264 * @fn ScrnConf *utilx_scrnconf_allocate(void)
265 * @brief allocate the UtilxScrnConf structure
267 * This function allocate the UtilxScrnConf structure.\n
269 * @remark This is used only application which want to know the screen configuration info.
270 * @pre This api does not require any pre-condition.
271 * @post This api does not change any condition.
272 * @see utilx_scrnconf_allocate
278 UtilxScrnConf *scrnconf = NULL;
280 // Allocate the UtilxScrnConf structure
281 scrnconf = utilx_scrnconf_allocate();
285 UtilxScrnConf *utilx_scrnconf_allocate (void);
288 * @fn void utilx_scrnconf_free (UtilxScrnConf *scrnconf)
289 * @brief free the UtilxScrnConf structure
291 * This function free the UtilxScrnConf structure.\n
293 * @param[in] scrnconf Specifies the UtilxScrnConf structure
294 * @return instance of the UtilxScrnConf structure
295 * @remark This is used only application which want to know the screen configuration info.
296 * @pre This api does not require any pre-condition.
297 * @post This api does not change any condition.
298 * @see utilx_scrnconf_free
304 UtilxScrnConf *scrnconf = NULL;
306 // Allocate the UtilxScrnConf structure
307 scrnconf = utilx_scrnconf_allocate();
310 // Free the UtilxScrnConf structure
311 utilx_scrnconf_free(scrnconf);
315 void utilx_scrnconf_free (UtilxScrnConf *scrnconf);
318 * @fn void utilx_scrnconf_get_info (Display *dpy, UtilxScrnConf *scrnconf)
319 * @brief get the information of the screen configuration
321 * This function get the information of the screen configuration.\n
323 * This function is a asynchronous call.
325 * @param[in] dpy Specifies the connection to the X server
326 * @param[in] scrnconf Specifies the information structure of the screen configuration
327 * @remark This is used only application which want to know the screen configuration info.
328 * @pre This api does not require any pre-condition.
329 * @post This api does not change any condition.
330 * @see utilx_scrnconf_get_info
333 #include <X11/Xlib.h>
338 UtilxScrnConf *scrnconf = NULL;
341 dpy = XOpenDisplay (NULL);
343 // Allocate the UtilxScrnConf structure
344 scrnconf = utilx_scrnconf_allocate();
347 // Set the display mode for the screen configuration
348 ret = utilx_scrnconf_get_info (dpy, scrnconf);
351 // Free the UtilxScrnConf structure
352 utilx_scrnconf_free(scrnconf);
357 int utilx_scrnconf_get_info (Display *dpy, UtilxScrnConf *scrnconf);
361 * @fn void utilx_scrnconf_set_dispmode (Display *dpy, Utilx_Scrnconf_Dispmode dispmode)
362 * @brief set the display mode for the screen configuration
364 * This function set the display mode for the screen configuration.\n
366 * This function is a asynchronous call.
368 * @param[in] dpy Specifies the connection to the X server
369 * @param[in] dipmode Specifies the display mode of the screen configuration
370 * @return 1 if setting the dispmode is succeeded, 0 if setting the dispmode is failed.
371 * @remark This is used only application which want to set the display mode of the screen configuration.
372 * @pre This api does not require any pre-condition.
373 * @post This api does not change any condition.
374 * @see utilx_scrnconf_set_dispmode
377 #include <X11/Xlib.h>
383 dpy = XOpenDisplay (NULL);
385 // Set the display mode for the screen configuration
386 utilx_scrnconf_set_dispmode (dpy, UTILX_SCRNCONF_DISPMODE_CLONE);
390 int utilx_scrnconf_set_dispmode (Display *dpy, Utilx_Scrnconf_Dispmode dispmode);
394 * @fn void utilx_set_system_notification_level (Display* dpy, Window win, Utilx_Notification_Level level)
395 * @brief Sets the priority level for the specified notification window
397 * This function sets the priority level of the notification windows.\n
398 * Every notification window has a base priority level by the notification window's priority value. (Default priority is UTILX_NOTIFICATION_LEVEL_LOW)
400 * The priority is used for ordering of notification windows.\n
401 * The notification window which is set UTILX_NOTIFICATION_LEVEL_HIGH priority will be placed to the top of notification windows.\n
402 * If there are notification windows that have same priorities, the latest created notification window is placed on the other window.
404 * This function is a asynchronous call.
406 * @param[in] dpy Specifies the connection to the X server
407 * @param[in] win Specifies the window to be set
408 * @param[in] level Specifies the level (UTILX_NOTIFICATION_LEVEL_LOW, UTILX_NOTIFICATION_LEVEL_NORMAL, UTILX_NOTIFICATION_LEVEL_HIGH)
409 * @remark This is used only notification window.
410 * @pre The win should be notification type window
412 * @see utilx_get_system_notification_level
423 xwin = elm_win_xwindow_get(win);
425 // Set Notification type
426 ecore_x_netwm_window_type_set (xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
428 // Set Notification's priority
429 utilx_set_system_notification_level (ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_HIGH);
434 void utilx_set_system_notification_level (Display* dpy, Window win, Utilx_Notification_Level level);
437 * @fn Utilx_Notification_Level utilx_get_system_notification_level (Display* dpy, Window win)
438 * @brief Gets the priority level for the specified notification window
440 * This function returns the priority level of the notification windows.\n
441 * If a user didn't set the notification's priority level, this function returns default value (UTILX_NOTIFICATION_LEVEL_LOW).
443 * This function is a synchronous call.
445 * @param[in] dpy Specifies the connection to the X server
446 * @param[in] win Specifies the window to be get
447 * @return current notication level (UTILX_NOTIFICATION_LEVEL_LOW, UTILX_NOTIFICATION_LEVEL_NORMAL, UTILX_NOTIFICATION_LEVEL_HIGH)
448 * @remark This is used only notification window.
449 * @pre The win should be notification type window
451 * @see utilx_set_system_notification_level
460 Utilx_Notification_Level level;
462 win = elm_win_add (NULL, "test", ELM_WIN_NOTIFICATION);
463 xwin = elm_win_xwindow_get(win);
465 level = utilx_get_system_notification_level (ecore_x_display_get(), xwin);
470 Utilx_Notification_Level utilx_get_system_notification_level (Display* dpy, Window win);
473 * @fn void utilx_enable_indicator (Display* dpy, Window win, int enable)
474 * @brief Sets the window to show/hide the indicator
476 * This function enables or disables the indicator.
478 * If an application wants to show the window with the indicator, the application must call this function with 1 as the enable parameter.\n
479 * Otherwise, the application must call this function with 0 as the enable parameter.
481 * This function is a asynchronous call.
483 * @param[in] dpy Specifies the connection to the X server
484 * @param[in] win Specifies the window to use indicator
485 * @param[in] enable Specifies whether the window use indicator or not
488 * @post If the enable is 1, then the indicator window should be shown on the screen. Otherwise, the indicator window should be hidden from the screen.
489 * @see elm_win_indicator_state_set, utilx_get_indicator_state
492 #include <X11/Xlib.h>
500 dpy = XOpenDisplay (NULL);
501 root = XDefaultRootWindow (dpy);
503 win = XCreateSimpleWindow (dpy, root, 0, 0, 480, 800, 2, BlackPixel (dpy,0), WhitePixel(dpy,0));
504 XMapWindow (dpy, win);
506 // If the win want to show indicator, enables indicator.
507 utilx_enable_indicator (dpy, win, 1);
510 // If the win want to hide indicator, disables indicator.
511 utilx_enable_indicator (dpy, win, 0);
517 void utilx_enable_indicator (Display* dpy, Window win, int enable);
520 * @fn int utilx_get_indicator_state (Display* dpy, Window win)
521 * @brief Gets the indicator's state of the specified window
523 * This function gets the indicator's state of the specified window.
525 * An application can set the indicator's state using utilx_enable_indicator or elm_win_indicator_state_set.
526 * If an application sets enables the indicator, this returns 1.\n
527 * If an application disables the indicator, this returns 0.\n
528 * If an application doesn't set the indicator's state, in other words,
529 * an application doesn't call utilx_enable_indicator or elm_win_indicator_state_set,
532 * This function is a asynchronous call.
534 * @param[in] dpy Specifies the connection to the X server
535 * @param[in] win Specifies the window to get the indicator's state
536 * @return 1 if the indicator is enabled, 0 if the indicator is disabled, otherwise -1
540 * @see elm_win_indicator_state_set, utilx_enable_indicator
543 #include <X11/Xlib.h>
552 dpy = XOpenDisplay (NULL);
553 root = XDefaultRootWindow (dpy);
555 win = XCreateSimpleWindow (dpy, root, 0, 0, 480, 800, 2, BlackPixel (dpy,0), WhitePixel(dpy,0));
556 XMapWindow (dpy, win);
558 state = utilx_get_indicator_state (dpy, win)
559 // state is -1 (unknown)
561 // If the win want to show indicator, enables indicator.
562 utilx_enable_indicator (dpy, win, 1);
565 state = utilx_get_indicator_state (dpy, win)
566 // state is 1 (enabled)
568 // If the win want to hide indicator, disables indicator.
569 utilx_enable_indicator (dpy, win, 0);
572 state = utilx_get_indicator_state (dpy, win)
573 // state is 0 (disabled)
578 int utilx_get_indicator_state (Display* dpy, Window win);
582 * @fn int utilx_grab_key (Display* dpy, Window win, const char* key_name, int grab_mode)
583 * @brief Grabs a key specfied by key_name for win in grab_mode
585 * This function establishs a grab of the specified key for the specified window.\n
586 * Once a key was grabbed, all events originated from the key will only be reported to the specfied window.\n
587 * The grab of the key will be released by calling utilx_ungrab_key.
589 * This function is synchronous.
591 * @param[in] dpy Specifies the connection to the X server
592 * @param[in] win Specifies the window to grab a key
593 * @param[in] key_name Name of a key in string (ex> KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_SEND and so on)
594 * @param[in] grab_mode Grab mode (such as EXCLUSIVE_GRAB, TOP_POSITION_GRAB and SHARED_GRAB)
595 * @return 0 on Success, otherwise Fail
596 * @remark If utilx_grab_key() returns 0, the specified window will get the events of the specified key.\n
597 However, delivery of a key can always be changed by other applications grabbing the key with higher priority.\n
598 It can also be changed by the changes of window stacks.\n
599 Trial for choosing a proper grab mode will be needed.
600 * @pre This API must be called after the window 'win' has been mapped
601 * @post This API adds/changes the window property related to grabbed key
602 * @see utilx_ungrab_key
603 * @par Example (using X11 APIs)
608 #include <X11/Xlib.h>
613 Display *disp = XOpenDisplay(NULL);
616 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
617 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
622 XNextEvent(disp, &e);
626 grab_result = utilx_grab_key(disp, w, KEY_POWER, EXCLUSIVE_GRAB);
627 if( EXCLUSIVE_GRABBED_ALREADY == grab_result )
635 utilx_ungrab_key(disp, win, KEY_POWER);
639 // TOP_POSITION_GRAB //
641 #include <X11/Xlib.h>
646 Display *disp = XOpenDisplay(NULL);
648 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
649 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
654 XNextEvent(disp, &e);
658 utilx_grab_key(disp, w, KEY_POWER, TOP_POSITION_GRAB);
665 utilx_ungrab_key(disp, win, KEY_POWER);
671 #include <X11/Xlib.h>
676 Display *disp = XOpenDisplay(NULL);
678 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
679 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
684 XNextEvent(disp, &e);
688 utilx_grab_key(disp, w, KEY_POWER, SHARED_GRAB);
695 utilx_ungrab_key(disp, win, KEY_POWER);
700 * @par Example (using EFL APIs)
706 #include <Ecore_Evas.h>
713 Ecore_X_Display* disp = ecore_x_display_get();
714 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
716 int grab_result = utilx_grab_key(disp, win, KEY_POWER, EXCLUSIVE_GRAB);
717 if( EXCLUSIVE_GRABBED_ALREADY == grab_result )
722 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
726 // TOP_POSITION_GRAB //
729 #include <Ecore_Evas.h>
736 Ecore_X_Display* disp = ecore_x_display_get();
737 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
739 utilx_grab_key(disp, win, KEY_POWER, TOP_POSITION_GRAB);
743 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
750 #include <Ecore_Evas.h>
757 Ecore_X_Display* disp = ecore_x_display_get();
758 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
760 utilx_grab_key(disp, win, KEY_POWER, SHARED_GRAB);
764 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
769 int utilx_grab_key (Display* dpy, Window win, const char* key_name, int grab_mode);
772 * @fn int utilx_ungrab_key (Display* dpy, Window win, const char* key_name)
773 * @brief Ungrabs a key specfied by key_name for win
775 * This function releases the already established grab of the specfied key for the specified window.\n
776 * Once the grab of the key was released, delivery of the key events for the specfied window is going to be stopped.
778 * This function is synchronous.
780 * @param[in] dpy Specifies the connection to the X server
781 * @param[in] win Specifies the window to grab a key
782 * @param[in] key_name Name of a key in string (ex> KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_SEND and so on)
783 * @return 0 on Success, otherwise Fail
784 * @remark No additional information
785 * @pre This API must be called after the window 'win' has been mapped
786 * @post This API changes/removes the window property related to grabbed key
787 * @see utilx_grab_key
788 * @par Example (using X11 APIs)
793 #include <X11/Xlib.h>
798 Display *disp = XOpenDisplay(NULL);
801 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
802 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
807 XNextEvent(disp, &e);
811 grab_result = utilx_grab_key(disp, w, KEY_POWER, EXCLUSIVE_GRAB);
812 if( EXCLUSIVE_GRABBED_ALREADY == grab_result )
820 utilx_ungrab_key(disp, win, KEY_POWER);
824 // TOP_POSITION_GRAB //
826 #include <X11/Xlib.h>
831 Display *disp = XOpenDisplay(NULL);
833 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
834 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
839 XNextEvent(disp, &e);
843 utilx_grab_key(disp, w, KEY_POWER, TOP_POSITION_GRAB);
850 utilx_ungrab_key(disp, win, KEY_POWER);
856 #include <X11/Xlib.h>
861 Display *disp = XOpenDisplay(NULL);
863 Window w = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 5,5, 470, 780, 2, BlackPixel(d,0), WhitePixel(d,0));
864 XSelectInput(disp, w, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
869 XNextEvent(disp, &e);
873 utilx_grab_key(disp, w, KEY_POWER, SHARED_GRAB);
880 utilx_ungrab_key(disp, win, KEY_POWER);
885 * @par Example (using EFL APIs)
891 #include <Ecore_Evas.h>
898 Ecore_X_Display* disp = ecore_x_display_get();
899 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
901 int grab_result = utilx_grab_key(disp, win, KEY_POWER, EXCLUSIVE_GRAB);
902 if( EXCLUSIVE_GRABBED_ALREADY == grab_result )
906 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
910 // TOP_POSITION_GRAB //
913 #include <Ecore_Evas.h>
920 Ecore_X_Display* disp = ecore_x_display_get();
921 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
923 utilx_grab_key(disp, win, KEY_POWER, TOP_POSITION_GRAB);
927 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
935 #include <Ecore_Evas.h>
942 Ecore_X_Display* disp = ecore_x_display_get();
943 Ecore_X_Window win = ecore_evas_software_x11_window_get(ee);
945 utilx_grab_key(disp, win, KEY_POWER, SHARED_GRAB);
949 utilx_ungrab_key(disp, win, KEY_POWER);//Ungrab whenever you want to ¡¦
954 int utilx_ungrab_key (Display* dpy, Window win, const char* key_name);
957 * @fn int utilx_get_key_status(Display* dpy, char *key_name)
958 * @brief Gets a status of a key specified by key_name
960 * This function gets a status of a key.\n
961 * ex>UTILX_KEY_STATUS_PRESSED, UTILX_KEY_STATUS_RELEASED and UTILX_KEY_STATUS_UNKNOWN
963 * This function is synchronous.
965 * @param[in] dpy Specifies the connection to the X server
966 * @param[in] key_name Name of a key in string (ex> KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_SEND and so on)
967 * @return 0 on Success, otherwise Fail
968 * @remark No additional information
969 * @pre This API must be called for H/W keys specified in this header file(utilX.h).
970 * @par Example (using X11 APIs)
973 #include <X11/Xlib.h>
978 Display *disp = XOpenDisplay(NULL);
979 Utilx_Key_Status status;
981 status = utilx_get_key_status(disp, KEY_PLAYCD);
985 case UTILX_KEY_STATUS_PRESSED:
986 //The key is pressed.
989 case UTILX_KEY_STATUS_RELEASED:
990 //The key is released.
993 case UTILX_KEY_STATUS_UNKNOWN:
995 //The key status is unknown;
1003 * @par Example (using EFL APIs)
1007 #include <Ecore_Evas.h>
1008 #include <Ecore_X.h>
1014 Ecore_X_Display* disp = ecore_x_display_get();
1015 Utilx_Key_Status status;
1017 status = utilx_get_key_status(disp, KEY_PLAYCD);
1021 case UTILX_KEY_STATUS_PRESSED:
1022 //The key is pressed.
1025 case UTILX_KEY_STATUS_RELEASED:
1026 //The key is released.
1029 case UTILX_KEY_STATUS_UNKNOWN:
1031 //The key status is unknown;
1038 Utilx_Key_Status utilx_get_key_status(Display* dpy, char *key_name);
1040 /* Window Effect APIs */
1042 * @fn void utilx_set_window_effect_state(Display* dpy, Window win, int state)
1043 * @brief Sets a window's effect state ( enable or disable )
1045 * This function sets window's effect state. if effect is not enabled by composite manager, \n
1046 * window's effect could not be enabled.
1048 * This function is a asynchronous call.
1050 * @param[in] dpy Specifies the connection to the X server
1051 * @param[in] win Specifies the window handle
1052 * @param[in] state Enables/disables the window effect
1053 * @remark This is used only client window. ( not root window )
1054 * @pre This api must be called before fist show ( XMapWindow Event ).
1055 * @post This changes Client Window's Effect related property.
1056 * @see utilx_get_window_effect_state
1059 #include <X11/Xlib.h>
1066 dpy = XOpenDisplay (NULL);
1067 root = XDefaultRootWindow (dpy);
1069 win = XCreateSimpleWindow (dpy, root, 0, 0, 480, 800, 2, BlackPixel (dpy,0), WhitePixel(dpy,0));
1071 // Sets a window's effect state to enable ( enable : 1, disable 0 )
1072 utilx_set_window_effect_state(dpy, win, 1);
1074 XMapWindow (dpy, win);
1078 void utilx_set_window_effect_state(Display* dpy, Window win, int state);
1081 * @fn int utilx_get_window_effect_state(Display* dpy, Window win)
1082 * @brief Gets a window's effect state ( enable or disable )
1084 * This function returns windows's effect state.\n
1085 * If effect is not enabled by composite manager, then this return value is unusable or meanless.
1087 * This function is a asynchronous call.
1089 * @param[in] dpy Specifies the connection to the X server
1090 * @param[in] win Specifies the window handle
1091 * @return Current window effect state
1092 * @remark This is used only client window. ( not root window )
1093 * @pre This api does not require any pre-condition.
1094 * @post This api does not change any condition.
1095 * @see utilx_set_window_effect_state
1098 #include <X11/Xlib.h>
1105 dpy = XOpenDisplay (NULL);
1106 root = XDefaultRootWindow (dpy);
1108 win = XCreateSimpleWindow (dpy, root, 0, 0, 480, 800, 2, BlackPixel (dpy,0), WhitePixel(dpy,0));
1110 XMapWindow (dpy, win);
1112 // Gets a window's effect state ( enable : 1, disable 0 )
1113 printf( "current window's effect state = %d\n", utilx_get_window_effect_state(dpy, win) ) ;
1117 int utilx_get_window_effect_state(Display* dpy, Window win);
1120 * @fn void utilx_show_fake_effect(Display* dpy, Window win, char *fake_image_file)
1121 * @brief Shows a window's "fake show effect" animation
1123 * This function show's application fake show image.\n
1124 * This function is only used by application launching program.
1126 * This function is a asynchronous call.
1128 * @param[in] dpy Specifies the connection to the X server
1129 * @param[in] win Specifies the root window handle
1130 * @param[in] fake_image_file Specifies the fake window image and file format is png type.
1131 * @remark This is used only menu-screen window.
1132 * @pre This api must be called before client's fist show ( XMapWindow Event ). you must call this api then run application.
1133 * @post This changes root window's fake effect related property.
1134 * @see utilx_hide_fake_effect
1137 #include <X11/Xlib.h>
1144 dpy = XOpenDisplay (NULL);
1145 root = XDefaultRootWindow (dpy);
1147 // Shows a window's "fake show effect" animation, and if you want to see animation, /root/fake_window_image.png file must be exited.
1148 utilx_show_fake_effect( dpy, root, "/root/fake_window_image.png");
1152 void utilx_show_fake_effect(Display *dpy, Window win, char *fake_image_file);
1155 * @fn void utilx_hide_fake_effect(Display* dpy, Window win)
1156 * @brief Shows a window's "fake hide effect" animation, and this animation uses "fake show effect" 's window image.
1158 * This function shoes a window's fake hide effect.\n
1159 * This function is only used by application launching program.\n
1160 * When application was not executed by any error.
1162 * This function is a asynchronous call.
1164 * @param[in] dpy Specifies the connection to the X server
1165 * @param[in] win Specifies the root window handle
1166 * @remark This is used only menu-screen window.
1167 * @pre This api must be called after "utilx_show_fake_effect()".
1168 * @post This changes root window's fake effect related property.
1169 * @see utilx_show_fake_effect
1172 #include <X11/Xlib.h>
1179 dpy = XOpenDisplay (NULL);
1180 root = XDefaultRootWindow (dpy);
1182 // Shows a window's "fake hide effect" animation. and if you wnat to see animation, utilx_show_fake_effect() function must be excuted before utilx_show_fake_effect()
1183 // and if real window is showed , then fake hide effect could not be showed.
1184 utilx_hide_fake_effect( dpy, root );
1188 void utilx_hide_fake_effect(Display *dpy, Window win);
1191 * @fn void utilx_set_window_effect_style(Display* dpy, Window win, Utilx_Effect_Type type, Utilx_Effect_Style style)
1192 * @brief Sets a window's effect style with effect type.
1194 * This function sets a window's effect style with effect type.\n
1195 * Default Window Effect is setted by Window Type and Window Class.\n
1196 * And then, you could change custom effecct.\n
1197 * Custom Effect is available max 10. ( CUSTOM0 ~ CUSTOM9 )\n
1198 * If you didn't set custom effect, then compositing window manger provides Default Window Effect.\n
1200 * This function is a asynchronous call.
1202 * @param[in] dpy Specifies the connection to the X server
1203 * @param[in] win Specifies the window handle
1204 * @param[in] type Specifies the window's effect type ( ex. UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_TYPE_UNMAP, etc )
1205 * @param[in] style Specifies the window's effect style ( ex. UTILX_EFFECT_STYLE_DEFAULT, UTILX_EFFECT_STYLE_NONE, UTILX_EFFECT_STYLE_CUSTOM0, etc )
1206 * @remark This is used only client window. ( not root window )
1207 * @pre This api does not require any pre-condition.
1208 * @post This changes window's effect type related property ( _NET_CM_WINDOW_EFFECT_TYPE ).
1209 * @see utilx_get_window_effect_style
1212 #include <X11/Xlib.h>
1213 #include <X11/Xutil.h>
1219 unsigned long black, white;
1221 dpy = XOpenDisplay(NULL) ;
1223 black = BlackPixel(dpy, 0);
1224 white = WhitePixel(dpy, 0);
1226 root = XDefaultRootWindow (dpy);
1227 win = XCreateSimpleWindow ( dpy, root, 0, 0, 100, 100, 2, BlackPixel (d,0), WhitePixel(d,0) );
1229 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_STYLE_CUSTOM0); // window's show effet type change to UTILX_EFFECT_STYLE_CUSTOM0
1231 XMapWindow(dpy, win);
1235 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_UNMAP, UTILX_EFFECT_STYLE_CUSTOM0); // window's hide effet type change to UTILX_EFFECT_STYLE_CUSTOM0
1237 XUnmapWindow (dpy, win);
1239 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_STYLE_DEFAULT); // window's show effet type change to UTILX_EFFECT_STYLE_DEFAULT
1240 XMapWindow (dpy, win);
1244 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_UNMAP, UTILX_EFFECT_STYLE_DEFAULT); // window's hide effet type change to UTILX_EFFECT_STYLE_DEFAULT
1245 XUnmapWindow (dpy, win);
1249 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_STYLE_NONE); // window's show effet type change to UTILX_EFFECT_STYLE_NONE
1250 XMapWindow (dpy, win);
1254 utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_UNMAP, UTILX_EFFECT_STYLE_NONE); // window's hide effet type change to UTILX_EFFECT_STYLE_NONE
1255 XUnmapWindow (dpy, win);
1260 void utilx_set_window_effect_style(Display* dpy, Window win, Utilx_Effect_Type type, Utilx_Effect_Style style);
1263 * @fn Utilx_Effect_Style utilx_get_window_effect_style(Display* dpy, Window win, Utilx_Effect_Type type)
1264 * @brief Gets a window's effect style with effect type.
1266 * This function gets a window's effect style with effect type.\n
1268 * This function is a asynchronous call.
1270 * @param[in] dpy Specifies the connection to the X server
1271 * @param[in] win Specifies the window handle
1272 * @param[in] type Specifies the window's effect type ( ex. UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_TYPE_UNMAP, etc )
1273 * @return Current window's effect style ( ex. UTILX_EFFECT_STYLE_DEFAULT, UTILX_EFFECT_STYLE_NONE, UTILX_EFFECT_STYLE_CUSTOM0, etc )
1274 * @remark This is used only client window. ( not root window )
1275 * @pre This api does not require any pre-condition.
1276 * @post This api does not change any condition.
1277 * @see utilx_set_window_effect_style
1280 #include <X11/Xlib.h>
1281 #include <X11/Xutil.h>
1287 unsigned long black, white;
1288 Utilx_Effect_Style style;
1290 dpy = XOpenDisplay(NULL) ;
1292 black = BlackPixel(dpy, 0);
1293 white = WhitePixel(dpy, 0);
1295 root = XDefaultRootWindow (dpy);
1296 win = XCreateSimpleWindow ( dpy, root, 0, 0, 100, 100, 2, BlackPixel (d,0), WhitePixel(d,0) );
1298 style = utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_MAP); // get effect style with window's show effet type
1302 style = utilx_set_window_effect_style(dpy, win, UTILX_EFFECT_TYPE_UNMAP); // get effect style with window's show effet type
1307 Utilx_Effect_Style utilx_get_window_effect_style(Display* dpy, Window win, Utilx_Effect_Type type);
1310 * @fn void utilx_set_window_opaque_state (Display* dpy, Window win, int opaque)
1311 * @brief Sets the window's opaque state
1313 * This function sets window's visibility to opaque even if the window is an alpha window.
1314 * This function is available only alpha window.
1315 * An alpha window's default opaque state is UTILX_OPAQUE_STATE_OFF.
1317 * This function is a asynchronous call.
1319 * @param[in] dpy Specifies the connection to the X server
1320 * @param[in] win Specifies the window handle
1321 * @param[in] state Specifies whether the window set a visible state to opaque(UTILX_OPAQUE_STATE_ON) or not(UTILX_OPAQUE_STATE_OFF)
1322 * @return 1 on Success, otherwise Fail
1323 * @remark This is used only alpha window.
1329 #include <X11/Xlib.h>
1338 dpy = XOpenDisplay (NULL);
1339 root = XDefaultRootWindow (dpy);
1341 win = XCreateSimpleWindow (dpy, root, 0, 0, 480, 800, 2, BlackPixel (dpy,0), WhitePixel(dpy,0));
1342 XMapWindow (dpy, win);
1344 ret = utilx_set_window_opaque_state (dpy, win, UTILX_OPAQUE_STATE_ON);
1347 printf ("Error! Failed to set opaque state.\n");
1355 int utilx_set_window_opaque_state (Display* dpy, Window win, Utilx_Opaque_State state);
1358 * @fn int utilx_set_screen_capture(Display* dpy, int enable)
1359 * @brief Specifies whether the screen capture functionality is enable or not.
1361 * This function makes the screen capture functionality of CBHM enable or disable.
1362 * CBHM = Clipboard History Manager.
1364 * This function is synchronous.
1366 * @param[in] dpy Specifies the connection to the X server
1367 * @param[in] enable Specifies the window handle. (1:Enable, 0:Disable)
1368 * @pre This api does not require any pre-condition.
1369 * @post This api does not change any condition.
1370 * @see utilx_get_screen_capture
1373 #include <X11/Xlib.h>
1374 #include <X11/Xutil.h>
1380 dpy = XOpenDisplay(NULL) ;
1382 utilx_set_screen_capture (dpy, 1);
1387 int utilx_set_screen_capture(Display* dpy, int enable);
1390 * @fn int utilx_get_screen_capture(Display* dpy, int enable)
1391 * @brief Gets whether the screen capture functionality is enable or not.
1393 * This function gets whether the screen capture functionality of CBHM is enable or not.
1394 * CBHM = Clipboard History Manager.
1396 * This function is synchronous.
1398 * @param[in] dpy Specifies the connection to the X server
1399 * @pre This api does not require any pre-condition.
1400 * @post This api does not change any condition.
1401 * @see utilx_set_screen_capture
1404 #include <X11/Xlib.h>
1405 #include <X11/Xutil.h>
1412 dpy = XOpenDisplay(NULL) ;
1414 enable = utilx_set_screen_capture (dpy);
1419 int utilx_get_screen_capture(Display* dpy);
1422 * @fn void utilx_set_window_cardinal_property(Display* dpy, Window win, Atom atom, unsigned int *value)
1423 * @brief Sets the cardinal property to Window
1425 * This function Sets the cardinal property to Window.
1427 * This function is synchronous.
1429 * @param[in] dpy Specifies the connection to the X server
1430 * @param[in] win Specifies the window handle
1431 * @param[in] atom Specifies the atom of cardinal property
1432 * @param[in] value the value of cardinal property to set.
1433 * @pre This api does not require any pre-condition.
1434 * @post This api does not change any condition.
1435 * @see utilx_get_window_cardinal_property
1438 #include <X11/Xlib.h>
1439 #include <X11/Xutil.h>
1448 dpy = XOpenDisplay (NULL);
1449 root = XDefaultRootWindow (dpy);
1451 atom = XInternAtom(dpy, "TEST_ATOM", False);
1453 utilx_set_window_cardinal_property (dpy, root, atom, (unsigned int*)&value);
1458 void utilx_set_window_cardinal_property(Display* dpy, Window win, Atom atom, unsigned int *value);
1461 * @fn int utilx_get_window_cardinal_property(Display* dpy, Window win, Atom atom, unsigned int *value)
1462 * @brief Gets the value of cardinal property.
1464 * This function gets the value of cardinal property.
1466 * This function is synchronous.
1468 * @param[in] dpy Specifies the connection to the X server
1469 * @param[in] win Specifies the window handle
1470 * @param[in] atom Specifies the atom of cardinal property
1471 * @param[out] value the value of cardinal property to get.
1472 * @pre This api does not require any pre-condition.
1473 * @post This api does not change any condition.
1474 * @see utilx_set_window_cardinal_property
1477 #include <X11/Xlib.h>
1478 #include <X11/Xutil.h>
1487 dpy = XOpenDisplay (NULL);
1488 root = XDefaultRootWindow (dpy);
1490 atom = XInternAtom(dpy, "TEST_ATOM", False);
1492 if (utilx_set_window_cardinal_property (dpy, root, atom, (unsigned int*)&value) > 0)
1500 int utilx_get_window_cardinal_property(Display* dpy, Window win, Atom atom, unsigned int *value);
1503 * @fn void utilx_show_capture_effect(Display *dpy, Window win )
1504 * @brief Shows a capture effect animation
1506 * This function show capture effect animation.\n
1507 * This function is only used by Screen Capture Application.
1509 * This function is a asynchronous call.
1511 * @param[in] dpy Specifies the connection to the X server
1512 * @param[in] win Specifies the root window handle
1513 * @remark This is used only screen capture application.
1514 * @pre This api does not require any pre-condition.
1515 * @post This api does not change any condition.
1516 * @see utilx_set_screen_capture
1519 #include <X11/Xlib.h>
1526 dpy = XOpenDisplay (NULL);
1527 root = XDefaultRootWindow (dpy);
1529 // Shows a Shows a capture effect animation
1530 utilx_show_capture_effect( dpy, root);
1534 void utilx_show_capture_effect(Display *dpy, Window win );
1537 * @fn void* utilx_create_screen_shot (Display* dpy, int width, int height)
1538 * @brief Create a screenshot image.
1540 * This function create a screenshot image.\n
1541 * To use this function, you should get the permission first. Once this functions
1542 * is called, utilx_release_screen_shot should be called after it.
1544 * @param[in] dpy Specifies the connection to the X server
1545 * @param[in] width Specifies the root window handle
1546 * @param[in] height Specifies the root window handle
1547 * @remark You should get the permission to use.
1548 * @post This api does not change any condition.
1549 * @see utilx_release_screen_shot
1556 dpy = XOpenDisplay (NULL);
1557 width = DisplayWidth (dpy, DefaultScreen (dpy));
1558 height = DisplayHeight (dpy, DefaultScreen (dpy));
1560 dump = utilx_create_screen_shot (dpy, width, height);
1563 // do_something (dump);
1567 // utilx_create_screen_shot can return NULL in some cases.
1568 // Even if it returns NULL, utilx_release_screen_shot should be called.
1571 utilx_release_screen_shot ();
1574 void* utilx_create_screen_shot (Display* dpy, int width, int height);
1577 * @fn void utilx_release_screen_shot (void)
1578 * @brief Release screenshot resources.
1580 * This function release screenshot resources.\n
1581 * utilx_release_screen_shot should be called once utilx_create_screen_shot is
1584 * @see utilx_create_screen_shot
1591 dpy = XOpenDisplay (NULL);
1592 width = DisplayWidth (dpy, DefaultScreen (dpy));
1593 height = DisplayHeight (dpy, DefaultScreen (dpy));
1595 dump = utilx_create_screen_shot (dpy, width, height);
1598 // do_something (dump);
1602 // utilx_create_screen_shot can return NULL in some cases.
1603 // Even if it returns NULL, utilx_release_screen_shot should be called.
1606 utilx_release_screen_shot ();
1609 void utilx_release_screen_shot (void);
1612 * @fn void utilx_set_fb_visible (Display* dpy, Utilx_Fb_Type fb_type, Bool visible)
1613 * @brief Set fb's visibility.
1615 * This function can make a framebuffer visible or non-visible. \n
1616 * By the way, in case of UTILX_FB_TYPE_UI, if there is the request for UI update,
1617 * the visibility of UI framebuffer will be changed from False to True automatically.
1620 * @param[in] dpy Specifies the connection to the X server
1621 * @param[in] fb_type Specifies the fb type to set visibility of a framebuffer
1622 * @param[in] visible Visible/Non-Visible
1623 * @see utilx_get_fb_visible
1628 Display* dpy = XOpenDisplay (NULL);
1630 // Hide the UI framebuffer of main lcd.
1631 utilx_set_fb_visible (dpy, UTILX_FB_TYPE_UI, False);
1635 void utilx_set_fb_visible (Display* dpy, Utilx_Fb_Type fb_type, Bool visible);
1638 * @fn Bool utilx_get_fb_visible (Display* dpy, Utilx_Fb_Type fb_type)
1639 * @brief Get framebuffer's visibility.
1641 * This function get the visibility of a framebuffer. \n
1643 * @param[in] dpy Specifies the connection to the X server
1644 * @param[in] fb_type Specifies the fb type to get visibility of a framebuffer
1645 * @return Current visibility of a framebuffer
1646 * @see utilx_set_fb_visible
1651 Display* dpy = XOpenDisplay (NULL);
1654 visible = utilx_get_fb_visible (dpy, UTILX_FB_TYPE_UI);
1658 Bool utilx_get_fb_visible (Display* dpy, Utilx_Fb_Type fb_type);
1661 * @fn void utilx_set_video_offset (Display* dpy, int x, int y)
1662 * @brief Set the offset of video.
1664 * This function sets the offset of video layer. \n
1666 * @param[in] dpy Specifies the connection to the X server
1667 * @param[in] x x offset
1668 * @param[in] y y offset
1673 Display* dpy = XOpenDisplay (NULL);
1675 utilx_set_video_offset (dpy, 0, 100);
1679 void utilx_set_video_offset (Display* dpy, int x, int y);
1690 #endif /* __SAMSUNG_LINUX_UTIL_X11_H__ */