mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
monitor: Remove handle_xevent as a generic method
This commit is contained in:
parent
861cfc23df
commit
1dc8a7eca3
@ -1217,16 +1217,3 @@ meta_monitor_manager_rebuild_derived (MetaMonitorManager *manager)
|
||||
g_free (old_monitor_infos);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_monitor_manager_handle_xevent (MetaMonitorManager *manager,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaMonitorManagerClass *klass;
|
||||
|
||||
klass = META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||
if (klass->handle_xevent)
|
||||
return klass->handle_xevent (manager, event);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -285,9 +285,6 @@ struct _MetaMonitorManagerClass
|
||||
unsigned short *,
|
||||
unsigned short *,
|
||||
unsigned short *);
|
||||
|
||||
gboolean (*handle_xevent) (MetaMonitorManager *,
|
||||
XEvent *);
|
||||
};
|
||||
|
||||
GType meta_monitor_manager_get_type (void);
|
||||
@ -312,9 +309,6 @@ void meta_monitor_manager_get_resources (MetaMonitorManager
|
||||
|
||||
int meta_monitor_manager_get_primary_index (MetaMonitorManager *manager);
|
||||
|
||||
gboolean meta_monitor_manager_handle_xevent (MetaMonitorManager *manager,
|
||||
XEvent *event);
|
||||
|
||||
void meta_monitor_manager_get_screen_size (MetaMonitorManager *manager,
|
||||
int *width,
|
||||
int *height);
|
||||
|
@ -75,7 +75,8 @@ handle_host_xevent (MetaBackend *backend,
|
||||
|
||||
{
|
||||
MetaMonitorManager *manager = meta_backend_get_monitor_manager (backend);
|
||||
if (meta_monitor_manager_handle_xevent (manager, xevent))
|
||||
if (META_IS_MONITOR_MANAGER_XRANDR (manager) &&
|
||||
meta_monitor_manager_xrandr_handle_xevent (META_MONITOR_MANAGER_XRANDR (manager), xevent))
|
||||
{
|
||||
bypass_clutter = TRUE;
|
||||
goto out;
|
||||
|
@ -994,11 +994,65 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager)
|
||||
meta_monitor_manager_rebuild_derived (manager);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManager *manager,
|
||||
XEvent *event)
|
||||
static void
|
||||
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
|
||||
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
||||
|
||||
manager_xrandr->xdisplay = meta_backend_x11_get_xdisplay (backend);
|
||||
|
||||
if (!XRRQueryExtension (manager_xrandr->xdisplay,
|
||||
&manager_xrandr->rr_event_base,
|
||||
&manager_xrandr->rr_error_base))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We only use ScreenChangeNotify, but GDK uses the others,
|
||||
and we don't want to step on its toes */
|
||||
XRRSelectInput (manager_xrandr->xdisplay,
|
||||
DefaultRootWindow (manager_xrandr->xdisplay),
|
||||
RRScreenChangeNotifyMask
|
||||
| RRCrtcChangeNotifyMask
|
||||
| RROutputPropertyNotifyMask);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_finalize (GObject *object)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (object);
|
||||
|
||||
if (manager_xrandr->resources)
|
||||
XRRFreeScreenResources (manager_xrandr->resources);
|
||||
manager_xrandr->resources = NULL;
|
||||
|
||||
G_OBJECT_CLASS (meta_monitor_manager_xrandr_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
||||
{
|
||||
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_monitor_manager_xrandr_finalize;
|
||||
|
||||
manager_class->read_current = meta_monitor_manager_xrandr_read_current;
|
||||
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
|
||||
manager_class->apply_configuration = meta_monitor_manager_xrandr_apply_configuration;
|
||||
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
|
||||
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
|
||||
manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma;
|
||||
manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
|
||||
MetaOutput *old_outputs;
|
||||
MetaCRTC *old_crtcs;
|
||||
MetaMonitorMode *old_modes;
|
||||
@ -1059,58 +1113,3 @@ meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManager *manager,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_init (MetaMonitorManagerXrandr *manager_xrandr)
|
||||
{
|
||||
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
|
||||
|
||||
manager_xrandr->xdisplay = meta_backend_x11_get_xdisplay (backend);
|
||||
|
||||
if (!XRRQueryExtension (manager_xrandr->xdisplay,
|
||||
&manager_xrandr->rr_event_base,
|
||||
&manager_xrandr->rr_error_base))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We only use ScreenChangeNotify, but GDK uses the others,
|
||||
and we don't want to step on its toes */
|
||||
XRRSelectInput (manager_xrandr->xdisplay,
|
||||
DefaultRootWindow (manager_xrandr->xdisplay),
|
||||
RRScreenChangeNotifyMask
|
||||
| RRCrtcChangeNotifyMask
|
||||
| RROutputPropertyNotifyMask);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_finalize (GObject *object)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (object);
|
||||
|
||||
if (manager_xrandr->resources)
|
||||
XRRFreeScreenResources (manager_xrandr->resources);
|
||||
manager_xrandr->resources = NULL;
|
||||
|
||||
G_OBJECT_CLASS (meta_monitor_manager_xrandr_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
|
||||
{
|
||||
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_monitor_manager_xrandr_finalize;
|
||||
|
||||
manager_class->read_current = meta_monitor_manager_xrandr_read_current;
|
||||
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
|
||||
manager_class->apply_configuration = meta_monitor_manager_xrandr_apply_configuration;
|
||||
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
|
||||
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
|
||||
manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma;
|
||||
manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma;
|
||||
manager_class->handle_xevent = meta_monitor_manager_xrandr_handle_xevent;
|
||||
}
|
||||
|
@ -37,4 +37,7 @@ typedef struct _MetaMonitorManagerXrandr MetaMonitorManagerXrandr;
|
||||
|
||||
GType meta_monitor_manager_xrandr_get_type (void);
|
||||
|
||||
gboolean meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager,
|
||||
XEvent *event);
|
||||
|
||||
#endif /* META_MONITOR_MANAGER_XRANDR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user