xutil: use xcb_get_wm_transient_for instead of xutil fct

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-28 17:54:33 +02:00
parent 3c32297e07
commit 2555a72e63
4 changed files with 4 additions and 41 deletions

View File

@ -23,6 +23,7 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_atom.h> #include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h>
#include "client.h" #include "client.h"
#include "tag.h" #include "tag.h"
@ -405,7 +406,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
ewmh_check_client_hints(c); ewmh_check_client_hints(c);
/* check for transient and set tags like its parent */ /* check for transient and set tags like its parent */
if((rettrans = xutil_get_transient_for_hint(globalconf.connection, w, &trans)) if((rettrans = xcb_get_wm_transient_for(globalconf.connection, w, &trans))
&& (t = client_getbywin(trans))) && (t = client_getbywin(trans)))
{ {
tag_array_t *tags = &globalconf.screens[c->screen].tags; tag_array_t *tags = &globalconf.screens[c->screen].tags;

View File

@ -117,42 +117,6 @@ xutil_getlockmask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms,
p_delete(&modmap_r); p_delete(&modmap_r);
} }
/** Equivalent to 'XGetTransientForHint' which is actually a
* 'XGetWindowProperty' which gets the WM_TRANSIENT_FOR property of
* the specified window
* \param c X connection
* \param win get the property from this window
* \param prop_win returns the WM_TRANSIENT_FOR property of win
* \return return true if successfull
*/
bool
xutil_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
xcb_window_t *prop_win)
{
xcb_get_property_reply_t *t_hint_r;
/* Use checked because the error handler should not take care of
* this error as we only return a boolean */
t_hint_r = xcb_get_property_reply(c,
xcb_get_property_unchecked(c, false, win,
WM_TRANSIENT_FOR,
WINDOW, 0, 1),
NULL);
if(!t_hint_r || t_hint_r->type != WINDOW || t_hint_r->format != 32 ||
t_hint_r->length == 0)
{
*prop_win = XCB_NONE;
p_delete(&t_hint_r);
return false;
}
*prop_win = *((xcb_window_t *) xcb_get_property_value(t_hint_r));
p_delete(&t_hint_r);
return true;
}
bool bool
xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win, xutil_class_hint_t *ch) xutil_get_class_hint(xcb_connection_t *conn, xcb_window_t win, xutil_class_hint_t *ch)
{ {

View File

@ -85,9 +85,6 @@
#define LastExtensionError 255 #define LastExtensionError 255
/* End of macros not defined in XCB */ /* End of macros not defined in XCB */
/* Common function defined in Xlib but not in XCB */
bool xutil_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *);
typedef struct typedef struct
{ {
char *res_name; char *res_name;

View File

@ -22,6 +22,7 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/xcb_atom.h> #include <xcb/xcb_atom.h>
#include <xcb/randr.h> #include <xcb/randr.h>
#include <xcb/xcb_icccm.h>
#include "event.h" #include "event.h"
#include "tag.h" #include "tag.h"
@ -521,7 +522,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
{ {
if(ev->atom == WM_TRANSIENT_FOR) if(ev->atom == WM_TRANSIENT_FOR)
{ {
xutil_get_transient_for_hint(connection, c->win, &trans); xcb_get_wm_transient_for(connection, c->win, &trans);
if(!c->isfloating if(!c->isfloating
&& (c->isfloating = (client_getbywin(trans) != NULL))) && (c->isfloating = (client_getbywin(trans) != NULL)))
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;