CVS: rdesktop ewmhints.c,1.10.2.7,1.10.2.8 xwin.c,1.205.2.24,1.205.2.25
Pierre Ossman <[email protected]> Fri, 17 Mar 2006 07:16:55 -0800
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16947
Modified Files:
Tag: seamlessrdp-branch
ewmhints.c xwin.c
Log Message:
Set _NET_WM_STATE property manually for withdrawn windows.
Index: ewmhints.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/ewmhints.c,v
retrieving revision 1.10.2.7
retrieving revision 1.10.2.8
diff -C2 -d -r1.10.2.7 -r1.10.2.8
*** ewmhints.c 16 Mar 2006 13:27:13 -0000 1.10.2.7
--- ewmhints.c 17 Mar 2006 15:16:52 -0000 1.10.2.8
***************
*** 24,27 ****
--- 24,28 ----
#include <X11/Xlib.h>
#include <X11/Xatom.h>
+ #include <X11/Xutil.h>
#include "rdesktop.h"
***************
*** 44,48 ****
static int
get_property_value(Window wnd, char *propname, long max_length,
! unsigned long *nitems_return, unsigned char **prop_return)
{
int result;
--- 45,49 ----
static int
get_property_value(Window wnd, char *propname, long max_length,
! unsigned long *nitems_return, unsigned char **prop_return, int nowarn)
{
int result;
***************
*** 75,79 ****
if (actual_type_return == None || actual_format_return == 0)
{
! fprintf(stderr, "Window is missing property %s\n", propname);
return (-1);
}
--- 76,81 ----
if (actual_type_return == None || actual_format_return == 0)
{
! if (!nowarn)
! fprintf(stderr, "Window is missing property %s\n", propname);
return (-1);
}
***************
*** 107,111 ****
if (get_property_value
(DefaultRootWindow(g_display), "_NET_CURRENT_DESKTOP", 1, &nitems_return,
! &prop_return) < 0)
return (-1);
--- 109,113 ----
if (get_property_value
(DefaultRootWindow(g_display), "_NET_CURRENT_DESKTOP", 1, &nitems_return,
! &prop_return, 0) < 0)
return (-1);
***************
*** 141,145 ****
if (get_property_value
(DefaultRootWindow(g_display), "_NET_WORKAREA", max_prop_length, &nitems_return,
! &prop_return) < 0)
return (-1);
--- 143,147 ----
if (get_property_value
(DefaultRootWindow(g_display), "_NET_WORKAREA", max_prop_length, &nitems_return,
! &prop_return, 0) < 0)
return (-1);
***************
*** 204,208 ****
maximized_vert = maximized_horz = hidden = False;
! if (get_property_value(w, "_NET_WM_STATE", 64, &nitems_return, &prop_return) < 0)
return SEAMLESSRDP_NORMAL;
--- 206,210 ----
maximized_vert = maximized_horz = hidden = False;
! if (get_property_value(w, "_NET_WM_STATE", 64, &nitems_return, &prop_return, 0) < 0)
return SEAMLESSRDP_NORMAL;
***************
*** 235,238 ****
--- 237,295 ----
XEvent xevent;
+ unsigned long nitems;
+ unsigned char *props;
+ uint32 *state;
+
+ /* The spec states that the window manager must respect any
+ _NET_WM_STATE attributes on a withdrawn window. In order words, we
+ modify the attributes directly for withdrawn windows and ask the WM
+ to do it for active windows. */
+ if ((get_property_value(wnd, "WM_STATE", 64, &nitems, &props, 1) < 0)
+ || ((state = (uint32 *) props)[0] == WithdrawnState))
+ {
+ if (add)
+ {
+ Atom atoms[2];
+
+ atoms[0] = atom1;
+ nitems = 1;
+ if (atom2)
+ {
+ atoms[1] = atom2;
+ nitems = 2;
+ }
+
+ XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
+ 32, PropModeAppend, (unsigned char *) atoms, nitems);
+ }
+ else
+ {
+ Atom *atoms;
+ int i;
+
+ if (get_property_value(wnd, "_NET_WM_STATE", 64, &nitems, &props, 1) < 0)
+ return 0;
+
+ atoms = (Atom *) props;
+
+ for (i = 0; i < nitems; i++)
+ {
+ if ((atoms[i] == atom1) || (atom2 && (atoms[i] == atom2)))
+ {
+ if (i != (nitems - 1))
+ memmove(&atoms[i], &atoms[i + 1],
+ sizeof(Atom) * (nitems - i - 1));
+ nitems--;
+ i--;
+ }
+ }
+
+ XChangeProperty(g_display, wnd, g_net_wm_state_atom, XA_ATOM,
+ 32, PropModeReplace, (unsigned char *) atoms, nitems);
+ }
+
+ return 0;
+ }
+
xevent.type = ClientMessage;
xevent.xclient.window = wnd;
***************
*** 291,295 ****
int desktop;
! if (get_property_value(wnd, "_NET_WM_DESKTOP", 1, &nitems_return, &prop_return) < 0)
return (-1);
--- 348,352 ----
int desktop;
! if (get_property_value(wnd, "_NET_WM_DESKTOP", 1, &nitems_return, &prop_return, 0) < 0)
return (-1);
Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.24
retrieving revision 1.205.2.25
diff -C2 -d -r1.205.2.24 -r1.205.2.25
*** xwin.c 17 Mar 2006 12:39:09 -0000 1.205.2.24
--- xwin.c 17 Mar 2006 15:16:52 -0000 1.205.2.25
***************
*** 55,59 ****
Window wnd;
unsigned long id;
- unsigned long parent;
unsigned long behind;
int xoffset, yoffset;
--- 55,58 ----
***************
*** 3257,3262 ****
}
/* Set WM_TRANSIENT_FOR, if necessary */
! if ((parent != 0x00000000) && (parent != 0xFFFFFFFF))
{
sw_parent = seamless_get_window_by_id(parent);
--- 3256,3264 ----
}
+ /* Handle popups without parents through some ewm hints */
+ if (parent == 0xFFFFFFFF)
+ ewmh_set_window_popup(wnd);
/* Set WM_TRANSIENT_FOR, if necessary */
! else if (parent != 0x00000000)
{
sw_parent = seamless_get_window_by_id(parent);
***************
*** 3283,3287 ****
sw->wnd = wnd;
sw->id = id;
- sw->parent = parent;
sw->behind = 0;
sw->xoffset = 0;
--- 3285,3288 ----
***************
*** 3463,3470 ****
}
- /* Handle popups without parents through some ewm hints */
- if ((sw->state == SEAMLESSRDP_NOTYETMAPPED) && (sw->parent == 0xFFFFFFFF))
- ewmh_set_window_popup(sw->wnd);
-
sw->state = state;
}
--- 3464,3467 ----
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642