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"
12 * @defgroup Ecore_X_MWM_Group MWM related functions.
14 * Functions related to MWM.
17 #define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
18 #define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
19 #define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
20 #define ECORE_X_MWM_HINTS_STATUS (1 << 3)
22 typedef struct _mwmhints
33 * Sends the GetProperty request.
34 * @param window Window whose MWM hints are requested.
35 * @ingroup Ecore_X_MWM_Group
38 ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window)
40 xcb_get_property_cookie_t cookie;
42 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
43 window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
44 ECORE_X_ATOM_MOTIF_WM_HINTS,
45 ECORE_X_ATOM_MOTIF_WM_HINTS,
47 _ecore_xcb_cookie_cache(cookie.sequence);
48 } /* ecore_x_mwm_hints_get_prefetch */
51 * Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
52 * @ingroup Ecore_X_MWM_Group
55 ecore_x_mwm_hints_get_fetch(void)
57 xcb_get_property_cookie_t cookie;
58 xcb_get_property_reply_t *reply;
60 cookie.sequence = _ecore_xcb_cookie_get();
61 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
62 _ecore_xcb_reply_cache(reply);
63 } /* ecore_x_mwm_hints_get_fetch */
67 * @param window Unused.
68 * @param fhint To document.
69 * @param dhint To document.
70 * @param ihint To document.
71 * @return 1 on success, 0 otherwise.
73 * To use this function, you must call before, and in order,
74 * ecore_x_mwm_hints_get_prefetch(), which sends the GetProperty request,
75 * then ecore_x_mwm_hints_get_fetch(), which gets the reply.
76 * @ingroup Ecore_X_MWM_Group
79 ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
80 Ecore_X_MWM_Hint_Func *fhint,
81 Ecore_X_MWM_Hint_Decor *dhint,
82 Ecore_X_MWM_Hint_Input *ihint)
84 MWMHints *mwmhints = NULL;
86 xcb_get_property_reply_t *reply;
88 reply = _ecore_xcb_reply_get();
92 if ((reply->format != 32) ||
93 (reply->value_len == 0))
96 mwmhints = xcb_get_property_value(reply);
97 if (reply->value_len >= 4)
101 if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
102 *dhint = mwmhints->decorations;
104 *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
109 if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
110 *fhint = mwmhints->functions;
112 *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
117 if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
118 *ihint = mwmhints->inputmode;
120 *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
127 } /* ecore_x_mwm_hints_get */
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,
137 Eina_Bool borderless)
139 uint32_t data[5] = {0, 0, 0, 0, 0};
141 data[0] = 2; /* just set the decorations hint! */
142 data[2] = !borderless;
145 window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
147 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
148 ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,
150 } /* ecore_x_mwm_borderless_set */