[mutter] monitor: Remove handle_xevent as a generic method
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor: Remove handle_xevent as a generic method
- Date: Wed, 23 Apr 2014 16:16:20 +0000 (UTC)
commit 1dc8a7eca396a21be18778f71e42313a430ff295
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Apr 23 12:07:38 2014 -0400
monitor: Remove handle_xevent as a generic method
src/backends/meta-monitor-manager.c | 13 ---
src/backends/meta-monitor-manager.h | 6 -
src/backends/x11/meta-backend-x11.c | 3 +-
src/backends/x11/meta-monitor-manager-xrandr.c | 117 ++++++++++++------------
src/backends/x11/meta-monitor-manager-xrandr.h | 3 +
5 files changed, 63 insertions(+), 79 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index f9cf778..37439e0 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -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;
-}
-
diff --git a/src/backends/meta-monitor-manager.h b/src/backends/meta-monitor-manager.h
index 5330954..7090f14 100644
--- a/src/backends/meta-monitor-manager.h
+++ b/src/backends/meta-monitor-manager.h
@@ -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);
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
index 458c9bc..bb7fb9b 100644
--- a/src/backends/x11/meta-backend-x11.c
+++ b/src/backends/x11/meta-backend-x11.c
@@ -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;
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index 8044c6d..cc5c7cc 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -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;
-}
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.h b/src/backends/x11/meta-monitor-manager-xrandr.h
index 245a42e..f440b0a 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.h
+++ b/src/backends/x11/meta-monitor-manager-xrandr.h
@@ -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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]