Skip to content
Snippets Groups Projects
Commit 33d36753 authored by Olivier Fourdan's avatar Olivier Fourdan
Browse files

Add support for shape input with XShape extension 1.1 (Bug #3092)

(Old svn revision: 25369)
parent 45030bdc
No related branches found
No related tags found
No related merge requests found
......@@ -182,9 +182,7 @@ DisplayInfo *
myDisplayInit (GdkDisplay *gdisplay)
{
DisplayInfo *display;
#ifdef HAVE_XSYNC
int xsync_major, xsync_minor;
#endif /* HAVE_XSYNC */
int major, minor;
int dummy;
display = g_new0 (DisplayInfo, 1);
......@@ -205,11 +203,18 @@ myDisplayInit (GdkDisplay *gdisplay)
}
/* Test XShape extension support */
major = 0;
minor = 0;
display->shape_version = 0;
if (XShapeQueryExtension (display->dpy,
&display->shape_event_base,
&dummy))
{
display->have_shape = TRUE;
if (XShapeQueryVersion (display->dpy, &major, &minor))
{
display->shape_version = major * 1000 + minor;
}
}
else
{
......@@ -224,15 +229,15 @@ myDisplayInit (GdkDisplay *gdisplay)
display->xsync_error_base = 0;
display->xsync_event_base = 0;
xsync_major = SYNC_MAJOR_VERSION;
xsync_minor = SYNC_MINOR_VERSION;
major = SYNC_MAJOR_VERSION;
minor = SYNC_MINOR_VERSION;
if (XSyncQueryExtension (display->dpy,
&display->xsync_event_base,
&display->xsync_error_base)
&& XSyncInitialize (display->dpy,
&xsync_major,
&xsync_minor))
&major,
&minor))
{
display->have_xsync = TRUE;
}
......
......@@ -241,6 +241,7 @@ struct _DisplayInfo
gboolean have_render;
gboolean have_xrandr;
gboolean have_xsync;
gint shape_version;
gint shape_event_base;
gint dbl_click_time;
gint xgrabcount;
......
......@@ -37,6 +37,10 @@
#include "frame.h"
#include "compositor.h"
#ifndef ShapeInput
#define ShapeInput 2;
#endif
int
frameDecorationLeft (ScreenInfo *screen_info)
{
......@@ -807,6 +811,13 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
XShapeCombineRectangles (display_info->dpy, shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeIntersect, Unsorted);
XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, shape_win, ShapeBounding, ShapeSet);
/* Set Input shape when using XShape extension 1.1 and later */
if (display_info->shape_version >= 1001)
{
XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
XShapeCombineShape (display_info->dpy, shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
XShapeCombineShape (display_info->dpy, c->frame, ShapeInput, 0, 0, shape_win, ShapeInput, ShapeSet);
}
XDestroyWindow (display_info->dpy, shape_win);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment