2 * Various MWM related functions.
4 * This is ALL the code involving anything MWM related. for both WM and
8 #include "ecore_xcb_private.h"
9 #include "Ecore_X_Atoms.h"
13 * @defgroup Ecore_X_MWM_Group MWM related functions.
15 * Functions related to MWM.
18 #define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
19 #define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
20 #define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
21 #define ECORE_X_MWM_HINTS_STATUS (1 << 3)
23 typedef struct _mwmhints
35 * Sends the GetProperty request.
36 * @param window Window whose MWM hints are requested.
37 * @ingroup Ecore_X_MWM_Group
40 ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window)
42 xcb_get_property_cookie_t cookie;
44 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
45 window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
46 ECORE_X_ATOM_MOTIF_WM_HINTS,
47 ECORE_X_ATOM_MOTIF_WM_HINTS,
49 _ecore_xcb_cookie_cache(cookie.sequence);
54 * Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
55 * @ingroup Ecore_X_MWM_Group
58 ecore_x_mwm_hints_get_fetch(void)
60 xcb_get_property_cookie_t cookie;
61 xcb_get_property_reply_t *reply;
63 cookie.sequence = _ecore_xcb_cookie_get();
64 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
65 _ecore_xcb_reply_cache(reply);
70 * @param window Unused.
71 * @param fhint To document.
72 * @param dhint To document.
73 * @param ihint To document.
74 * @return 1 on success, 0 otherwise.
76 * To use this function, you must call before, and in order,
77 * ecore_x_mwm_hints_get_prefetch(), which sends the GetProperty request,
78 * then ecore_x_mwm_hints_get_fetch(), which gets the reply.
79 * @ingroup Ecore_X_MWM_Group
82 ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
83 Ecore_X_MWM_Hint_Func *fhint,
84 Ecore_X_MWM_Hint_Decor *dhint,
85 Ecore_X_MWM_Hint_Input *ihint)
87 MWMHints *mwmhints = NULL;
89 xcb_get_property_reply_t *reply;
91 reply = _ecore_xcb_reply_get();
95 if ((reply->format != 32) ||
96 (reply->value_len == 0))
99 mwmhints = xcb_get_property_value(reply);
100 if (reply->value_len >= 4)
104 if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
105 *dhint = mwmhints->decorations;
107 *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
111 if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
112 *fhint = mwmhints->functions;
114 *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
118 if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
119 *ihint = mwmhints->inputmode;
121 *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
130 * Sets the borderless flag of a window using MWM.
131 * @param window The window.
132 * @param borderless The borderless flag.
133 * @ingroup Ecore_X_MWM_Group
136 ecore_x_mwm_borderless_set(Ecore_X_Window window,
139 uint32_t data[5] = {0, 0, 0, 0, 0};
141 data[0] = 2; /* just set the decorations hint! */
142 data[2] = !borderless;
144 if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
145 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
146 ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,