Re: _NET_WM_USER_TIME reconsidered



Thanks Matthias;

For some reason I was under the impression that this gdk function wouldn't do what we wanted, but I hadn't looked at the source code, so I was overlooking it.

As an aside, why isn't there a race in the setproperty/IfEvent code below? (You can answer me offline)

Bill

Matthias Clasen wrote:

On Tue, 2006-09-26 at 17:58 +0200, Lubos Lunak wrote:
Dne úterý 26 září 2006 12:21 Bill Haneman napsal(a):
Matthias/All:

The whole _NET_WM_USER_TIME thing is a continuing problem for
accessibility, as it now stands.  In an assistive technology setting,
there isn't always an X event that corresponds to the "user action"
which results in a new window being posted or focus changing.  Since X
doesn't allow us to get a meaningful answer to "what's the current
timestamp", we have serious problems when trying to interact with
windows via non-X-device-based user requests.

We really need a solution for this!
Copy&paste from KApplication::updateUserTimestamp():

// get current X timestamp
Window w = XCreateSimpleWindow( qt_xdisplay(), qt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 );
XSelectInput( qt_xdisplay(), w, PropertyChangeMask );
unsigned char data[ 1 ];
XChangeProperty( qt_xdisplay(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 );
XEvent ev;
XWindowEvent( qt_xdisplay(), w, PropertyChangeMask, &ev );
time = ev.xproperty.time;
XDestroyWindow( qt_xdisplay(), w );


Here is the gdk equivalent:

guint32
gdk_x11_get_server_time (GdkWindow *window)
{
 Display *xdisplay;
 Window   xwindow;
 guchar c = 'a';
 XEvent xevent;
 Atom timestamp_prop_atom;
 g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
 g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), 0);
 xdisplay = GDK_WINDOW_XDISPLAY (window);
 xwindow = GDK_WINDOW_XWINDOW (window);
 timestamp_prop_atom =
   gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window),
                                          "GDK_TIMESTAMP_PROP");
 XChangeProperty (xdisplay, xwindow, timestamp_prop_atom,
                  timestamp_prop_atom,
                  8, PropModeReplace, &c, 1);
 XIfEvent (xdisplay, &xevent,
           timestamp_predicate, GUINT_TO_POINTER(xwindow));
 return xevent.xproperty.time;
}

it is even exported, so you can just use it.


_______________________________________________
wm-spec-list mailing list
wm-spec-list gnome org
http://mail.gnome.org/mailman/listinfo/wm-spec-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]