Move X11 extension queries to MetaX11Display
Also split extension queries into their own functions https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
parent
dacc041d0c
commit
c64d5ad8af
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include "meta-backend-private.h"
|
#include "meta-backend-private.h"
|
||||||
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
|
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
|
||||||
|
#include "x11/meta-x11-display-private.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT);
|
||||||
|
|
||||||
@ -195,13 +196,13 @@ gboolean
|
|||||||
meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||||
XEvent *xevent)
|
XEvent *xevent)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||||
XFixesCursorNotifyEvent *notify_event;
|
XFixesCursorNotifyEvent *notify_event;
|
||||||
|
|
||||||
if (meta_is_wayland_compositor ())
|
if (meta_is_wayland_compositor ())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (xevent->xany.type != display->xfixes_event_base + XFixesCursorNotify)
|
if (xevent->xany.type != x11_display->xfixes_event_base + XFixesCursorNotify)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
notify_event = (XFixesCursorNotifyEvent *)xevent;
|
notify_event = (XFixesCursorNotifyEvent *)xevent;
|
||||||
|
@ -71,7 +71,7 @@ _meta_barrier_impl_x11_release (MetaBarrierImpl *impl,
|
|||||||
MetaDisplay *display = priv->barrier->priv->display;
|
MetaDisplay *display = priv->barrier->priv->display;
|
||||||
Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_XINPUT_23 (display))
|
if (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display))
|
||||||
{
|
{
|
||||||
XIBarrierReleasePointer (dpy,
|
XIBarrierReleasePointer (dpy,
|
||||||
META_VIRTUAL_CORE_POINTER_ID,
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
@ -747,8 +747,10 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
|||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
|
MetaX11Display *x11_display = compositor->display->x11_display;
|
||||||
|
|
||||||
if (!meta_is_wayland_compositor () &&
|
if (!meta_is_wayland_compositor () &&
|
||||||
event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
|
event->type == meta_x11_display_get_damage_event_base (x11_display) + XDamageNotify)
|
||||||
{
|
{
|
||||||
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
|
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
|
||||||
* ourselves
|
* ourselves
|
||||||
|
@ -257,40 +257,9 @@ struct _MetaDisplay
|
|||||||
MetaAlarmFilter alarm_filter;
|
MetaAlarmFilter alarm_filter;
|
||||||
gpointer alarm_filter_data;
|
gpointer alarm_filter_data;
|
||||||
|
|
||||||
int composite_event_base;
|
|
||||||
int composite_error_base;
|
|
||||||
int composite_major_version;
|
|
||||||
int composite_minor_version;
|
|
||||||
int damage_event_base;
|
|
||||||
int damage_error_base;
|
|
||||||
int xfixes_event_base;
|
|
||||||
int xfixes_error_base;
|
|
||||||
int xinput_error_base;
|
|
||||||
int xinput_event_base;
|
|
||||||
int xinput_opcode;
|
|
||||||
|
|
||||||
ClutterActor *current_pad_osd;
|
ClutterActor *current_pad_osd;
|
||||||
|
|
||||||
MetaStartupNotification *startup_notification;
|
MetaStartupNotification *startup_notification;
|
||||||
|
|
||||||
int xsync_event_base;
|
|
||||||
int xsync_error_base;
|
|
||||||
int shape_event_base;
|
|
||||||
int shape_error_base;
|
|
||||||
unsigned int have_xsync : 1;
|
|
||||||
#define META_DISPLAY_HAS_XSYNC(display) ((display)->have_xsync)
|
|
||||||
unsigned int have_shape : 1;
|
|
||||||
#define META_DISPLAY_HAS_SHAPE(display) ((display)->have_shape)
|
|
||||||
unsigned int have_composite : 1;
|
|
||||||
unsigned int have_damage : 1;
|
|
||||||
#define META_DISPLAY_HAS_COMPOSITE(display) ((display)->have_composite)
|
|
||||||
#define META_DISPLAY_HAS_DAMAGE(display) ((display)->have_damage)
|
|
||||||
#ifdef HAVE_XI23
|
|
||||||
gboolean have_xinput_23 : 1;
|
|
||||||
#define META_DISPLAY_HAS_XINPUT_23(display) ((display)->have_xinput_23)
|
|
||||||
#else
|
|
||||||
#define META_DISPLAY_HAS_XINPUT_23(display) FALSE
|
|
||||||
#endif /* HAVE_XI23 */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaDisplayClass
|
struct _MetaDisplayClass
|
||||||
|
@ -474,15 +474,19 @@ meta_display_remove_pending_pings_for_window (MetaDisplay *display,
|
|||||||
static void
|
static void
|
||||||
enable_compositor (MetaDisplay *display)
|
enable_compositor (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
if (!META_DISPLAY_HAS_COMPOSITE (display) ||
|
MetaX11Display *x11_display = display->x11_display;
|
||||||
!META_DISPLAY_HAS_DAMAGE (display))
|
|
||||||
|
if (!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ||
|
||||||
|
!META_X11_DISPLAY_HAS_DAMAGE (x11_display))
|
||||||
{
|
{
|
||||||
meta_warning ("Missing %s extension required for compositing",
|
meta_warning ("Missing %s extension required for compositing",
|
||||||
!META_DISPLAY_HAS_COMPOSITE (display) ? "composite" : "damage");
|
!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ?
|
||||||
|
"composite" : "damage");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int version = (display->composite_major_version * 10) + display->composite_minor_version;
|
int version = (x11_display->composite_major_version * 10) +
|
||||||
|
x11_display->composite_minor_version;
|
||||||
if (version < 3)
|
if (version < 3)
|
||||||
{
|
{
|
||||||
meta_warning ("Your version of COMPOSITE is too old.");
|
meta_warning ("Your version of COMPOSITE is too old.");
|
||||||
@ -692,167 +696,6 @@ meta_display_open (void)
|
|||||||
display->xids = g_hash_table_new (meta_unsigned_long_hash,
|
display->xids = g_hash_table_new (meta_unsigned_long_hash,
|
||||||
meta_unsigned_long_equal);
|
meta_unsigned_long_equal);
|
||||||
|
|
||||||
{
|
|
||||||
int major, minor;
|
|
||||||
|
|
||||||
display->have_xsync = FALSE;
|
|
||||||
|
|
||||||
display->xsync_error_base = 0;
|
|
||||||
display->xsync_event_base = 0;
|
|
||||||
|
|
||||||
/* I don't think we really have to fill these in */
|
|
||||||
major = SYNC_MAJOR_VERSION;
|
|
||||||
minor = SYNC_MINOR_VERSION;
|
|
||||||
|
|
||||||
if (!XSyncQueryExtension (xdisplay,
|
|
||||||
&display->xsync_event_base,
|
|
||||||
&display->xsync_error_base) ||
|
|
||||||
!XSyncInitialize (xdisplay,
|
|
||||||
&major, &minor))
|
|
||||||
{
|
|
||||||
display->xsync_error_base = 0;
|
|
||||||
display->xsync_event_base = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
display->have_xsync = TRUE;
|
|
||||||
XSyncSetPriority (xdisplay, None, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n",
|
|
||||||
major, minor,
|
|
||||||
display->xsync_error_base,
|
|
||||||
display->xsync_event_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
display->have_shape = FALSE;
|
|
||||||
|
|
||||||
display->shape_error_base = 0;
|
|
||||||
display->shape_event_base = 0;
|
|
||||||
|
|
||||||
if (!XShapeQueryExtension (xdisplay,
|
|
||||||
&display->shape_event_base,
|
|
||||||
&display->shape_error_base))
|
|
||||||
{
|
|
||||||
display->shape_error_base = 0;
|
|
||||||
display->shape_event_base = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
display->have_shape = TRUE;
|
|
||||||
|
|
||||||
meta_verbose ("Attempted to init Shape, found error base %d event base %d\n",
|
|
||||||
display->shape_error_base,
|
|
||||||
display->shape_event_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
display->have_composite = FALSE;
|
|
||||||
|
|
||||||
display->composite_error_base = 0;
|
|
||||||
display->composite_event_base = 0;
|
|
||||||
|
|
||||||
if (!XCompositeQueryExtension (xdisplay,
|
|
||||||
&display->composite_event_base,
|
|
||||||
&display->composite_error_base))
|
|
||||||
{
|
|
||||||
display->composite_error_base = 0;
|
|
||||||
display->composite_event_base = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
display->composite_major_version = 0;
|
|
||||||
display->composite_minor_version = 0;
|
|
||||||
if (XCompositeQueryVersion (xdisplay,
|
|
||||||
&display->composite_major_version,
|
|
||||||
&display->composite_minor_version))
|
|
||||||
{
|
|
||||||
display->have_composite = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
display->composite_major_version = 0;
|
|
||||||
display->composite_minor_version = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_verbose ("Attempted to init Composite, found error base %d event base %d "
|
|
||||||
"extn ver %d %d\n",
|
|
||||||
display->composite_error_base,
|
|
||||||
display->composite_event_base,
|
|
||||||
display->composite_major_version,
|
|
||||||
display->composite_minor_version);
|
|
||||||
|
|
||||||
display->have_damage = FALSE;
|
|
||||||
|
|
||||||
display->damage_error_base = 0;
|
|
||||||
display->damage_event_base = 0;
|
|
||||||
|
|
||||||
if (!XDamageQueryExtension (xdisplay,
|
|
||||||
&display->damage_event_base,
|
|
||||||
&display->damage_error_base))
|
|
||||||
{
|
|
||||||
display->damage_error_base = 0;
|
|
||||||
display->damage_event_base = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
display->have_damage = TRUE;
|
|
||||||
|
|
||||||
meta_verbose ("Attempted to init Damage, found error base %d event base %d\n",
|
|
||||||
display->damage_error_base,
|
|
||||||
display->damage_event_base);
|
|
||||||
|
|
||||||
display->xfixes_error_base = 0;
|
|
||||||
display->xfixes_event_base = 0;
|
|
||||||
|
|
||||||
if (XFixesQueryExtension (xdisplay,
|
|
||||||
&display->xfixes_event_base,
|
|
||||||
&display->xfixes_error_base))
|
|
||||||
{
|
|
||||||
int xfixes_major, xfixes_minor;
|
|
||||||
|
|
||||||
XFixesQueryVersion (xdisplay, &xfixes_major, &xfixes_minor);
|
|
||||||
|
|
||||||
if (xfixes_major * 100 + xfixes_minor < 500)
|
|
||||||
meta_fatal ("Mutter requires XFixes 5.0");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
meta_fatal ("Mutter requires XFixes 5.0");
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_verbose ("Attempted to init XFixes, found error base %d event base %d\n",
|
|
||||||
display->xfixes_error_base,
|
|
||||||
display->xfixes_event_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int major = 2, minor = 3;
|
|
||||||
gboolean has_xi = FALSE;
|
|
||||||
|
|
||||||
if (XQueryExtension (xdisplay,
|
|
||||||
"XInputExtension",
|
|
||||||
&display->xinput_opcode,
|
|
||||||
&display->xinput_error_base,
|
|
||||||
&display->xinput_event_base))
|
|
||||||
{
|
|
||||||
if (XIQueryVersion (xdisplay, &major, &minor) == Success)
|
|
||||||
{
|
|
||||||
int version = (major * 10) + minor;
|
|
||||||
if (version >= 22)
|
|
||||||
has_xi = TRUE;
|
|
||||||
|
|
||||||
#ifdef HAVE_XI23
|
|
||||||
if (version >= 23)
|
|
||||||
display->have_xinput_23 = TRUE;
|
|
||||||
#endif /* HAVE_XI23 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!has_xi)
|
|
||||||
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
update_cursor_theme ();
|
update_cursor_theme ();
|
||||||
|
|
||||||
/* Create the leader window here. Set its properties and
|
/* Create the leader window here. Set its properties and
|
||||||
@ -2903,17 +2746,6 @@ meta_display_modifiers_accelerator_activate (MetaDisplay *display)
|
|||||||
return freeze;
|
return freeze;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* meta_display_get_xinput_opcode: (skip)
|
|
||||||
* @display: a #MetaDisplay
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
meta_display_get_xinput_opcode (MetaDisplay *display)
|
|
||||||
{
|
|
||||||
return display->xinput_opcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_display_supports_extended_barriers:
|
* meta_display_supports_extended_barriers:
|
||||||
* @display: a #MetaDisplay
|
* @display: a #MetaDisplay
|
||||||
@ -2937,7 +2769,7 @@ meta_display_supports_extended_barriers (MetaDisplay *display)
|
|||||||
|
|
||||||
if (META_IS_BACKEND_X11 (meta_get_backend ()))
|
if (META_IS_BACKEND_X11 (meta_get_backend ()))
|
||||||
{
|
{
|
||||||
return (META_DISPLAY_HAS_XINPUT_23 (display) &&
|
return (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display) &&
|
||||||
!meta_is_wayland_compositor());
|
!meta_is_wayland_compositor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2966,12 +2798,6 @@ meta_display_get_x11_display (MetaDisplay *display)
|
|||||||
return display->x11_display;
|
return display->x11_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_display_has_shape (MetaDisplay *display)
|
|
||||||
{
|
|
||||||
return META_DISPLAY_HAS_SHAPE (display);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_display_get_focus_window:
|
* meta_display_get_focus_window:
|
||||||
* @display: a #MetaDisplay
|
* @display: a #MetaDisplay
|
||||||
@ -2988,18 +2814,6 @@ meta_display_get_focus_window (MetaDisplay *display)
|
|||||||
return display->focus_window;
|
return display->focus_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
meta_display_get_damage_event_base (MetaDisplay *display)
|
|
||||||
{
|
|
||||||
return display->damage_event_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
meta_display_get_shape_event_base (MetaDisplay *display)
|
|
||||||
{
|
|
||||||
return display->shape_event_base;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_display_clear_mouse_mode:
|
* meta_display_clear_mouse_mode:
|
||||||
* @display: a #MetaDisplay
|
* @display: a #MetaDisplay
|
||||||
|
@ -677,7 +677,7 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
XISetMask (mask.mask, XI_FocusIn);
|
XISetMask (mask.mask, XI_FocusIn);
|
||||||
XISetMask (mask.mask, XI_FocusOut);
|
XISetMask (mask.mask, XI_FocusOut);
|
||||||
#ifdef HAVE_XI23
|
#ifdef HAVE_XI23
|
||||||
if (META_DISPLAY_HAS_XINPUT_23 (display))
|
if (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display))
|
||||||
{
|
{
|
||||||
XISetMask (mask.mask, XI_BarrierHit);
|
XISetMask (mask.mask, XI_BarrierHit);
|
||||||
XISetMask (mask.mask, XI_BarrierLeave);
|
XISetMask (mask.mask, XI_BarrierLeave);
|
||||||
|
@ -73,22 +73,16 @@ GType meta_display_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
|
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
|
||||||
|
|
||||||
int meta_display_get_xinput_opcode (MetaDisplay *display);
|
|
||||||
gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
|
gboolean meta_display_supports_extended_barriers (MetaDisplay *display);
|
||||||
|
|
||||||
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
|
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
|
||||||
MetaX11Display *meta_display_get_x11_display (MetaDisplay *display);
|
MetaX11Display *meta_display_get_x11_display (MetaDisplay *display);
|
||||||
|
|
||||||
gboolean meta_display_has_shape (MetaDisplay *display);
|
|
||||||
|
|
||||||
MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
|
MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
|
||||||
|
|
||||||
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
|
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
|
||||||
Window xwindow);
|
Window xwindow);
|
||||||
|
|
||||||
int meta_display_get_damage_event_base (MetaDisplay *display);
|
|
||||||
int meta_display_get_shape_event_base (MetaDisplay *display);
|
|
||||||
|
|
||||||
gboolean meta_display_xserver_time_is_before (MetaDisplay *display,
|
gboolean meta_display_xserver_time_is_before (MetaDisplay *display,
|
||||||
guint32 time1,
|
guint32 time1,
|
||||||
guint32 time2);
|
guint32 time2);
|
||||||
|
@ -34,4 +34,9 @@ int meta_x11_display_get_screen_number (MetaX11Display *x11_display);
|
|||||||
Display *meta_x11_display_get_xdisplay (MetaX11Display *x11_display);
|
Display *meta_x11_display_get_xdisplay (MetaX11Display *x11_display);
|
||||||
Window meta_x11_display_get_xroot (MetaX11Display *x11_display);
|
Window meta_x11_display_get_xroot (MetaX11Display *x11_display);
|
||||||
|
|
||||||
|
int meta_x11_display_get_xinput_opcode (MetaX11Display *x11_display);
|
||||||
|
int meta_x11_display_get_damage_event_base (MetaX11Display *x11_display);
|
||||||
|
int meta_x11_display_get_shape_event_base (MetaX11Display *x11_display);
|
||||||
|
gboolean meta_x11_display_has_shape (MetaX11Display *x11_display);
|
||||||
|
|
||||||
#endif /* META_X11_DISPLAY_H */
|
#endif /* META_X11_DISPLAY_H */
|
||||||
|
@ -1673,9 +1673,9 @@ meta_xwayland_selection_handle_event (XEvent *xevent)
|
|||||||
return meta_xwayland_selection_handle_client_message (compositor, xevent);
|
return meta_xwayland_selection_handle_client_message (compositor, xevent);
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaX11Display *x11_display = meta_get_display ()->x11_display;
|
||||||
|
|
||||||
if (xevent->type - display->xfixes_event_base == XFixesSelectionNotify)
|
if (xevent->type - x11_display->xfixes_event_base == XFixesSelectionNotify)
|
||||||
return meta_xwayland_selection_handle_xfixes_selection_notify (compositor, xevent);
|
return meta_xwayland_selection_handle_xfixes_selection_notify (compositor, xevent);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -49,7 +49,7 @@ get_input_event (MetaDisplay *display,
|
|||||||
XEvent *event)
|
XEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type == GenericEvent &&
|
if (event->type == GenericEvent &&
|
||||||
event->xcookie.extension == display->xinput_opcode)
|
event->xcookie.extension == display->x11_display->xinput_opcode)
|
||||||
{
|
{
|
||||||
XIEvent *input_event;
|
XIEvent *input_event;
|
||||||
|
|
||||||
@ -189,8 +189,8 @@ event_get_modified_window (MetaDisplay *display,
|
|||||||
return None;
|
return None;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (META_DISPLAY_HAS_SHAPE (display) &&
|
if (META_X11_DISPLAY_HAS_SHAPE (display->x11_display) &&
|
||||||
event->type == (display->shape_event_base + ShapeNotify))
|
event->type == (display->x11_display->shape_event_base + ShapeNotify))
|
||||||
{
|
{
|
||||||
XShapeEvent *sev = (XShapeEvent*) event;
|
XShapeEvent *sev = (XShapeEvent*) event;
|
||||||
return sev->window;
|
return sev->window;
|
||||||
@ -583,8 +583,8 @@ meta_spew_core_event (MetaDisplay *display,
|
|||||||
name = "MappingNotify";
|
name = "MappingNotify";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (META_DISPLAY_HAS_XSYNC (display) &&
|
if (META_X11_DISPLAY_HAS_XSYNC (display->x11_display) &&
|
||||||
event->type == (display->xsync_event_base + XSyncAlarmNotify))
|
event->type == (display->x11_display->xsync_event_base + XSyncAlarmNotify))
|
||||||
{
|
{
|
||||||
XSyncAlarmNotifyEvent *aevent = (XSyncAlarmNotifyEvent*) event;
|
XSyncAlarmNotifyEvent *aevent = (XSyncAlarmNotifyEvent*) event;
|
||||||
|
|
||||||
@ -601,8 +601,8 @@ meta_spew_core_event (MetaDisplay *display,
|
|||||||
alarm_state_to_string (aevent->state));
|
alarm_state_to_string (aevent->state));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (META_DISPLAY_HAS_SHAPE (display) &&
|
if (META_X11_DISPLAY_HAS_SHAPE (display->x11_display) &&
|
||||||
event->type == (display->shape_event_base + ShapeNotify))
|
event->type == (display->x11_display->shape_event_base + ShapeNotify))
|
||||||
{
|
{
|
||||||
XShapeEvent *sev = (XShapeEvent*) event;
|
XShapeEvent *sev = (XShapeEvent*) event;
|
||||||
|
|
||||||
@ -675,10 +675,10 @@ meta_spew_event_print (MetaDisplay *display,
|
|||||||
event->type == NoExpose)
|
event->type == NoExpose)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->type == (display->damage_event_base + XDamageNotify))
|
if (event->type == (display->x11_display->damage_event_base + XDamageNotify))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->type == (display->xsync_event_base + XSyncAlarmNotify))
|
if (event->type == (display->x11_display->xsync_event_base + XSyncAlarmNotify))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event->type == PropertyNotify &&
|
if (event->type == PropertyNotify &&
|
||||||
@ -1216,8 +1216,8 @@ handle_other_xevent (MetaDisplay *display,
|
|||||||
window = NULL;
|
window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_XSYNC (display) &&
|
if (META_X11_DISPLAY_HAS_XSYNC (x11_display) &&
|
||||||
event->type == (display->xsync_event_base + XSyncAlarmNotify))
|
event->type == (x11_display->xsync_event_base + XSyncAlarmNotify))
|
||||||
{
|
{
|
||||||
MetaWindow *alarm_window = meta_display_lookup_sync_alarm (display,
|
MetaWindow *alarm_window = meta_display_lookup_sync_alarm (display,
|
||||||
((XSyncAlarmNotifyEvent*)event)->alarm);
|
((XSyncAlarmNotifyEvent*)event)->alarm);
|
||||||
@ -1242,8 +1242,8 @@ handle_other_xevent (MetaDisplay *display,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_SHAPE (display) &&
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display) &&
|
||||||
event->type == (display->shape_event_base + ShapeNotify))
|
event->type == (x11_display->shape_event_base + ShapeNotify))
|
||||||
{
|
{
|
||||||
bypass_gtk = TRUE; /* GTK doesn't want to see this really */
|
bypass_gtk = TRUE; /* GTK doesn't want to see this really */
|
||||||
|
|
||||||
|
@ -53,6 +53,36 @@ struct _MetaX11Display
|
|||||||
#define item(x) Atom atom_##x;
|
#define item(x) Atom atom_##x;
|
||||||
#include "x11/atomnames.h"
|
#include "x11/atomnames.h"
|
||||||
#undef item
|
#undef item
|
||||||
|
|
||||||
|
int composite_event_base;
|
||||||
|
int composite_error_base;
|
||||||
|
int composite_major_version;
|
||||||
|
int composite_minor_version;
|
||||||
|
int damage_event_base;
|
||||||
|
int damage_error_base;
|
||||||
|
int xfixes_event_base;
|
||||||
|
int xfixes_error_base;
|
||||||
|
int xinput_error_base;
|
||||||
|
int xinput_event_base;
|
||||||
|
int xinput_opcode;
|
||||||
|
int xsync_event_base;
|
||||||
|
int xsync_error_base;
|
||||||
|
int shape_event_base;
|
||||||
|
int shape_error_base;
|
||||||
|
unsigned int have_xsync : 1;
|
||||||
|
#define META_X11_DISPLAY_HAS_XSYNC(x11_display) ((x11_display)->have_xsync)
|
||||||
|
unsigned int have_shape : 1;
|
||||||
|
#define META_X11_DISPLAY_HAS_SHAPE(x11_display) ((x11_display)->have_shape)
|
||||||
|
unsigned int have_composite : 1;
|
||||||
|
unsigned int have_damage : 1;
|
||||||
|
#define META_X11_DISPLAY_HAS_COMPOSITE(x11_display) ((x11_display)->have_composite)
|
||||||
|
#define META_X11_DISPLAY_HAS_DAMAGE(x11_display) ((x11_display)->have_damage)
|
||||||
|
#ifdef HAVE_XI23
|
||||||
|
gboolean have_xinput_23 : 1;
|
||||||
|
#define META_X11_DISPLAY_HAS_XINPUT_23(x11_display) ((x11_display)->have_xinput_23)
|
||||||
|
#else
|
||||||
|
#define META_X11_DISPLAY_HAS_XINPUT_23(x11_display) FALSE
|
||||||
|
#endif /* HAVE_XI23 */
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaX11Display *meta_x11_display_new (MetaDisplay *display, GError **error);
|
MetaX11Display *meta_x11_display_new (MetaDisplay *display, GError **error);
|
||||||
|
@ -38,6 +38,15 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
#ifdef HAVE_RANDR
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#endif
|
||||||
|
#include <X11/extensions/shape.h>
|
||||||
|
#include <X11/Xcursor/Xcursor.h>
|
||||||
|
#include <X11/extensions/Xcomposite.h>
|
||||||
|
#include <X11/extensions/Xdamage.h>
|
||||||
|
#include <X11/extensions/Xfixes.h>
|
||||||
|
|
||||||
|
|
||||||
#include "core/util-private.h"
|
#include "core/util-private.h"
|
||||||
#include "meta/errors.h"
|
#include "meta/errors.h"
|
||||||
@ -95,6 +104,183 @@ meta_x11_display_init (MetaX11Display *x11_display)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xsync_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
int major, minor;
|
||||||
|
|
||||||
|
x11_display->have_xsync = FALSE;
|
||||||
|
|
||||||
|
x11_display->xsync_error_base = 0;
|
||||||
|
x11_display->xsync_event_base = 0;
|
||||||
|
|
||||||
|
/* I don't think we really have to fill these in */
|
||||||
|
major = SYNC_MAJOR_VERSION;
|
||||||
|
minor = SYNC_MINOR_VERSION;
|
||||||
|
|
||||||
|
if (!XSyncQueryExtension (x11_display->xdisplay,
|
||||||
|
&x11_display->xsync_event_base,
|
||||||
|
&x11_display->xsync_error_base) ||
|
||||||
|
!XSyncInitialize (x11_display->xdisplay,
|
||||||
|
&major, &minor))
|
||||||
|
{
|
||||||
|
x11_display->xsync_error_base = 0;
|
||||||
|
x11_display->xsync_event_base = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x11_display->have_xsync = TRUE;
|
||||||
|
XSyncSetPriority (x11_display->xdisplay, None, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_verbose ("Attempted to init Xsync, found version %d.%d error base %d event base %d\n",
|
||||||
|
major, minor,
|
||||||
|
x11_display->xsync_error_base,
|
||||||
|
x11_display->xsync_event_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xshape_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
x11_display->have_shape = FALSE;
|
||||||
|
|
||||||
|
x11_display->shape_error_base = 0;
|
||||||
|
x11_display->shape_event_base = 0;
|
||||||
|
|
||||||
|
if (!XShapeQueryExtension (x11_display->xdisplay,
|
||||||
|
&x11_display->shape_event_base,
|
||||||
|
&x11_display->shape_error_base))
|
||||||
|
{
|
||||||
|
x11_display->shape_error_base = 0;
|
||||||
|
x11_display->shape_event_base = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x11_display->have_shape = TRUE;
|
||||||
|
|
||||||
|
meta_verbose ("Attempted to init Shape, found error base %d event base %d\n",
|
||||||
|
x11_display->shape_error_base,
|
||||||
|
x11_display->shape_event_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xcomposite_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
x11_display->have_composite = FALSE;
|
||||||
|
|
||||||
|
x11_display->composite_error_base = 0;
|
||||||
|
x11_display->composite_event_base = 0;
|
||||||
|
|
||||||
|
if (!XCompositeQueryExtension (x11_display->xdisplay,
|
||||||
|
&x11_display->composite_event_base,
|
||||||
|
&x11_display->composite_error_base))
|
||||||
|
{
|
||||||
|
x11_display->composite_error_base = 0;
|
||||||
|
x11_display->composite_event_base = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x11_display->composite_major_version = 0;
|
||||||
|
x11_display->composite_minor_version = 0;
|
||||||
|
if (XCompositeQueryVersion (x11_display->xdisplay,
|
||||||
|
&x11_display->composite_major_version,
|
||||||
|
&x11_display->composite_minor_version))
|
||||||
|
{
|
||||||
|
x11_display->have_composite = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x11_display->composite_major_version = 0;
|
||||||
|
x11_display->composite_minor_version = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_verbose ("Attempted to init Composite, found error base %d event base %d "
|
||||||
|
"extn ver %d %d\n",
|
||||||
|
x11_display->composite_error_base,
|
||||||
|
x11_display->composite_event_base,
|
||||||
|
x11_display->composite_major_version,
|
||||||
|
x11_display->composite_minor_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xdamage_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
x11_display->have_damage = FALSE;
|
||||||
|
|
||||||
|
x11_display->damage_error_base = 0;
|
||||||
|
x11_display->damage_event_base = 0;
|
||||||
|
|
||||||
|
if (!XDamageQueryExtension (x11_display->xdisplay,
|
||||||
|
&x11_display->damage_event_base,
|
||||||
|
&x11_display->damage_error_base))
|
||||||
|
{
|
||||||
|
x11_display->damage_error_base = 0;
|
||||||
|
x11_display->damage_event_base = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x11_display->have_damage = TRUE;
|
||||||
|
|
||||||
|
meta_verbose ("Attempted to init Damage, found error base %d event base %d\n",
|
||||||
|
x11_display->damage_error_base,
|
||||||
|
x11_display->damage_event_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xfixes_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
x11_display->xfixes_error_base = 0;
|
||||||
|
x11_display->xfixes_event_base = 0;
|
||||||
|
|
||||||
|
if (XFixesQueryExtension (x11_display->xdisplay,
|
||||||
|
&x11_display->xfixes_event_base,
|
||||||
|
&x11_display->xfixes_error_base))
|
||||||
|
{
|
||||||
|
int xfixes_major, xfixes_minor;
|
||||||
|
|
||||||
|
XFixesQueryVersion (x11_display->xdisplay, &xfixes_major, &xfixes_minor);
|
||||||
|
|
||||||
|
if (xfixes_major * 100 + xfixes_minor < 500)
|
||||||
|
meta_fatal ("Mutter requires XFixes 5.0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_fatal ("Mutter requires XFixes 5.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_verbose ("Attempted to init XFixes, found error base %d event base %d\n",
|
||||||
|
x11_display->xfixes_error_base,
|
||||||
|
x11_display->xfixes_event_base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
query_xi_extension (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
int major = 2, minor = 3;
|
||||||
|
gboolean has_xi = FALSE;
|
||||||
|
|
||||||
|
if (XQueryExtension (x11_display->xdisplay,
|
||||||
|
"XInputExtension",
|
||||||
|
&x11_display->xinput_opcode,
|
||||||
|
&x11_display->xinput_error_base,
|
||||||
|
&x11_display->xinput_event_base))
|
||||||
|
{
|
||||||
|
if (XIQueryVersion (x11_display->xdisplay, &major, &minor) == Success)
|
||||||
|
{
|
||||||
|
int version = (major * 10) + minor;
|
||||||
|
if (version >= 22)
|
||||||
|
has_xi = TRUE;
|
||||||
|
|
||||||
|
#ifdef HAVE_XI23
|
||||||
|
if (version >= 23)
|
||||||
|
x11_display->have_xinput_23 = TRUE;
|
||||||
|
#endif /* HAVE_XI23 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_xi)
|
||||||
|
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* meta_x11_display_new:
|
* meta_x11_display_new:
|
||||||
*
|
*
|
||||||
@ -193,6 +379,13 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
|
|||||||
#include "x11/atomnames.h"
|
#include "x11/atomnames.h"
|
||||||
#undef item
|
#undef item
|
||||||
|
|
||||||
|
query_xsync_extension (x11_display);
|
||||||
|
query_xshape_extension (x11_display);
|
||||||
|
query_xcomposite_extension (x11_display);
|
||||||
|
query_xdamage_extension (x11_display);
|
||||||
|
query_xfixes_extension (x11_display);
|
||||||
|
query_xi_extension (x11_display);
|
||||||
|
|
||||||
return x11_display;
|
return x11_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +417,35 @@ meta_x11_display_get_xroot (MetaX11Display *x11_display)
|
|||||||
return x11_display->xroot;
|
return x11_display->xroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_x11_display_get_xinput_opcode: (skip)
|
||||||
|
* @x11_display: a #MetaX11Display
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
meta_x11_display_get_xinput_opcode (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
return x11_display->xinput_opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
meta_x11_display_get_damage_event_base (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
return x11_display->damage_event_base;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
meta_x11_display_get_shape_event_base (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
return x11_display->shape_event_base;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_x11_display_has_shape (MetaX11Display *x11_display)
|
||||||
|
{
|
||||||
|
return META_X11_DISPLAY_HAS_SHAPE (x11_display);
|
||||||
|
}
|
||||||
|
|
||||||
Window
|
Window
|
||||||
meta_x11_display_create_offscreen_window (MetaX11Display *x11_display,
|
meta_x11_display_create_offscreen_window (MetaX11Display *x11_display,
|
||||||
Window parent,
|
Window parent,
|
||||||
|
@ -650,7 +650,7 @@ meta_window_x11_unmanage (MetaWindow *window)
|
|||||||
window->user_time_window = None;
|
window->user_time_window = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_SHAPE (window->display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
XShapeSelectInput (x11_display->xdisplay, window->xwindow, NoEventMask);
|
XShapeSelectInput (x11_display->xdisplay, window->xwindow, NoEventMask);
|
||||||
|
|
||||||
meta_window_ungrab_keys (window);
|
meta_window_ungrab_keys (window);
|
||||||
@ -1797,7 +1797,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_SHAPE (window->display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
{
|
{
|
||||||
/* Translate the set of XShape rectangles that we
|
/* Translate the set of XShape rectangles that we
|
||||||
* get from the X server to a cairo_region. */
|
* get from the X server to a cairo_region. */
|
||||||
@ -1900,7 +1900,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
|
|||||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
|
||||||
cairo_region_t *region = NULL;
|
cairo_region_t *region = NULL;
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_SHAPE (window->display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
{
|
{
|
||||||
/* Translate the set of XShape rectangles that we
|
/* Translate the set of XShape rectangles that we
|
||||||
* get from the X server to a cairo_region. */
|
* get from the X server to a cairo_region. */
|
||||||
@ -3140,7 +3140,7 @@ meta_window_x11_new (MetaDisplay *display,
|
|||||||
XISelectEvents (x11_display->xdisplay, xwindow, &mask, 1);
|
XISelectEvents (x11_display->xdisplay, xwindow, &mask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (META_DISPLAY_HAS_SHAPE (display))
|
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||||
XShapeSelectInput (x11_display->xdisplay, xwindow, ShapeNotifyMask);
|
XShapeSelectInput (x11_display->xdisplay, xwindow, ShapeNotifyMask);
|
||||||
|
|
||||||
/* Get rid of any borders */
|
/* Get rid of any borders */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user