* Source/x11/XGServerWindow.m:

* Source/x11/XGServer.m:
* Source/x11/XGServerEvent.m:
* Headers/x11/XGGeneric.h:
* Headers/x11/XGServerWindow.h:
* Headers/x11/XGServer.h:
Implement the _NET_WM_SYNC_REQUEST protocol described here:
http://standards.freedesktop.org/wm-spec/1.3/ar01s06.html

This is supposed to make window resizing smoother when dragging
a resize handle provided by the window manager, by waiting to
change the window manager's frame until the GNUstep window is
finished repainting.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@33045 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2011-05-15 08:37:44 +00:00
parent 09c3361700
commit 6c0d48eeec
7 changed files with 84 additions and 2 deletions

View file

@ -1,3 +1,19 @@
2011-05-15 Eric Wasylishen <ewasylishen@gmail.com>
* Source/x11/XGServerWindow.m:
* Source/x11/XGServer.m:
* Source/x11/XGServerEvent.m:
* Headers/x11/XGGeneric.h:
* Headers/x11/XGServerWindow.h:
* Headers/x11/XGServer.h:
Implement the _NET_WM_SYNC_REQUEST protocol described here:
http://standards.freedesktop.org/wm-spec/1.3/ar01s06.html
This is supposed to make window resizing smoother when dragging
a resize handle provided by the window manager, by waiting to
change the window manager's frame until the GNUstep window is
finished repainting.
2011-05-05 Eric Wasylishen <ewasylishen@gmail.com>
* Undo the previous change and try a different approach..

View file

@ -105,6 +105,8 @@ struct XGGeneric {
Atom take_focus_atom;
Atom wm_state_atom;
Atom net_wm_ping_atom;
Atom net_wm_sync_request_atom;
Atom net_wm_sync_request_counter_atom;
Atom miniaturize_atom;
Atom win_decor_atom;
Atom titlebar_state_atom;

View file

@ -34,7 +34,9 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "x11/XGGeneric.h"
#ifdef HAVE_LIBXEXT
#include <X11/extensions/sync.h>
#endif
/*
* Enumerated type to say how we should draw pixels to the X display - used
* to select different drawing mechanisms to try to optimise.

View file

@ -115,6 +115,11 @@ typedef struct _gswindow_device_t {
void *gdriver; /* gdriver ident. Managed by gdriver */
int gdriverProtocol; /* Managed by gdriver */
BOOL ignore_take_focus;
#ifdef HAVE_LIBXEXT
uint32_t net_wm_sync_request_counter_value_low;
uint32_t net_wm_sync_request_counter_value_high;
XSyncCounter net_wm_sync_request_counter;
#endif
} gswindow_device_t;
#define GET_XDRAWABLE(win) ((win)->buffer ? (win)->buffer: (win)->ident)

View file

@ -447,6 +447,15 @@ _parse_display_name(NSString *name, int *dn, int *sn)
XSetErrorHandler(XGErrorHandler);
#ifdef HAVE_LIBXEXT
{
int xsync_evbase, xsync_errbase;
int major, minor;
if (XSyncQueryExtension(dpy, &xsync_evbase, &xsync_errbase))
XSyncInitialize(dpy, &major, &minor);
}
#endif
if (GSDebugSet(@"XSynchronize") == YES)
XSynchronize(dpy, True);

View file

@ -635,6 +635,14 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
(SubstructureRedirectMask | SubstructureNotifyMask),
&xEvent);
}
#ifdef HAVE_LIBXEXT
else if ((Atom)xEvent.xclient.data.l[0]
== generic.net_wm_sync_request_atom)
{
cWin->net_wm_sync_request_counter_value_low = (Atom)xEvent.xclient.data.l[2];
cWin->net_wm_sync_request_counter_value_high = (Atom)xEvent.xclient.data.l[3];
}
#endif
}
else if (xEvent.xclient.message_type == dnd.XdndEnter)
{
@ -911,7 +919,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
data1: n.origin.x
data2: n.origin.y];
}
}
}
break;
// same as ConfigureNotify but we get this event

View file

@ -1447,6 +1447,9 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
if ((generic.wm & XGWM_EWMH) != 0)
{
window->protocols[window->numProtocols++] = generic.net_wm_ping_atom;
#ifdef HAVE_LIBXEXT
window->protocols[window->numProtocols++] = generic.net_wm_sync_request_atom;
#endif
}
if ((generic.wm & XGWM_WINDOWMAKER) != 0
&& (window->win_attrs.window_style & NSMiniaturizableWindowMask) != 0)
@ -1484,6 +1487,8 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
generic.delete_win_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
generic.wm_state_atom = XInternAtom(dpy, "WM_STATE", False);
generic.net_wm_ping_atom = XInternAtom(dpy, "_NET_WM_PING", False);
generic.net_wm_sync_request_atom = XInternAtom(dpy, "_NET_WM_SYNC_REQUEST", False);
generic.net_wm_sync_request_counter_atom = XInternAtom(dpy, "_NET_WM_SYNC_REQUEST_COUNTER", False);
generic.miniaturize_atom
= XInternAtom(dpy, "_GNUSTEP_WM_MINIATURIZE_WINDOW", False);
generic.win_decor_atom = XInternAtom(dpy,"_GNUSTEP_WM_ATTR", False);
@ -2074,6 +2079,27 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
// All the windows of a GNUstep application belong to one group.
window->gen_hints.flags |= WindowGroupHint;
window->gen_hints.window_group = ROOT;
#ifdef HAVE_LIBXEXT
/**
* Setup net_wm_sync_request_counter
*/
{
XSyncValue value;
XSyncIntToValue(&value, 0);
window->net_wm_sync_request_counter = XSyncCreateCounter(dpy, value);
XChangeProperty(dpy,
window->ident,
generic.net_wm_sync_request_counter_atom,
XA_CARDINAL,
32,
PropModeReplace,
(unsigned char *) &(window->net_wm_sync_request_counter),
1);
window->net_wm_sync_request_counter_value_low = 0;
window->net_wm_sync_request_counter_value_high = 0;
}
#endif
/*
* Prepare the protocols supported by the window.
@ -3620,6 +3646,20 @@ static BOOL didCreatePixmaps;
}
}
#ifdef HAVE_LIBXEXT
if (window->net_wm_sync_request_counter_value_low != 0
|| window->net_wm_sync_request_counter_value_high != 0)
{
XSyncValue value;
XSyncIntsToValue(&value,
window->net_wm_sync_request_counter_value_low,
window->net_wm_sync_request_counter_value_high);
XSyncSetCounter(dpy, window->net_wm_sync_request_counter, value);
window->net_wm_sync_request_counter_value_low = 0;
window->net_wm_sync_request_counter_value_high = 0;
}
#endif
XFlush(dpy);
}