[at-spi2-core: 5/9] Move the X11 version of SpiDEControllerPrivate to a new header file
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core: 5/9] Move the X11 version of SpiDEControllerPrivate to a new header file
- Date: Tue, 23 Nov 2021 22:52:30 +0000 (UTC)
commit 8cdca3ae975e7415dd6d138a836fb5a58fb10cb4
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 23 12:08:37 2021 -0600
Move the X11 version of SpiDEControllerPrivate to a new header file
This way we can have a single call to g_type_class_add_private()
instead of conditional ones.
registryd/deviceeventcontroller-x11.c | 29 +----------------------------
registryd/deviceeventcontroller-x11.h | 28 ++++++++++++++++++++++++++++
registryd/deviceeventcontroller.c | 23 +++++++++++++++++------
3 files changed, 46 insertions(+), 34 deletions(-)
---
diff --git a/registryd/deviceeventcontroller-x11.c b/registryd/deviceeventcontroller-x11.c
index 0d67e3fa..1146f36e 100644
--- a/registryd/deviceeventcontroller-x11.c
+++ b/registryd/deviceeventcontroller-x11.c
@@ -34,11 +34,6 @@
#include <stdio.h>
#include <sys/time.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XTest.h>
-#include <X11/XKBlib.h>
-
#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/keysymdef.h>
@@ -54,6 +49,7 @@
#include "display.h"
#include "event-source.h"
+#include "deviceeventcontroller-x11.h"
#include "deviceeventcontroller.h"
#include "reentrant-list.h"
@@ -89,29 +85,10 @@ static XModifierKeymap* xmkeymap = NULL;
static int (*x_default_error_handler) (Display *display, XErrorEvent *error_event);
-typedef struct {
- Display *xevie_display;
- unsigned int last_press_keycode;
- unsigned int last_release_keycode;
- struct timeval last_press_time;
- struct timeval last_release_time;
- int have_xkb;
- int xkb_major_extension_opcode;
- int xkb_base_event_code;
- int xkb_base_error_code;
- unsigned int xkb_latch_mask;
- unsigned int pending_xkb_mod_relatch_mask;
- XkbDescPtr xkb_desc;
- KeyCode reserved_keycode;
- KeySym reserved_keysym;
- guint reserved_reset_timeout;
-} SpiDEControllerPrivate;
-
static void spi_controller_register_with_devices (SpiDEController *controller);
static gboolean spi_device_event_controller_forward_key_event (SpiDEController *controller,
const XEvent *event);
-
static SpiDEController *saved_controller;
static unsigned int
@@ -1436,8 +1413,6 @@ spi_dec_x11_generate_mouse_event (SpiDEController *controller,
void
spi_dec_setup_x11 (SpiDEControllerClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
klass->plat.get_keycode = spi_dec_x11_get_keycode;
klass->plat.mouse_check = spi_dec_x11_mouse_check;
klass->plat.synth_keycode_press = spi_dec_x11_synth_keycode_press;
@@ -1452,6 +1427,4 @@ spi_dec_setup_x11 (SpiDEControllerClass *klass)
klass->plat.init = spi_dec_x11_init;
klass->plat.finalize = spi_dec_x11_finalize;
-
- g_type_class_add_private (object_class, sizeof (SpiDEControllerPrivate));
}
diff --git a/registryd/deviceeventcontroller-x11.h b/registryd/deviceeventcontroller-x11.h
new file mode 100644
index 00000000..62e29843
--- /dev/null
+++ b/registryd/deviceeventcontroller-x11.h
@@ -0,0 +1,28 @@
+#ifndef _DEVICEEVENTCONTROLLER_X11_H_
+#define _DEVICEEVENTCONTROLLER_X11_H_
+
+#include <glib.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/XTest.h>
+#include <X11/XKBlib.h>
+
+typedef struct {
+ Display *xevie_display;
+ unsigned int last_press_keycode;
+ unsigned int last_release_keycode;
+ struct timeval last_press_time;
+ struct timeval last_release_time;
+ int have_xkb;
+ int xkb_major_extension_opcode;
+ int xkb_base_event_code;
+ int xkb_base_error_code;
+ unsigned int xkb_latch_mask;
+ unsigned int pending_xkb_mod_relatch_mask;
+ XkbDescPtr xkb_desc;
+ KeyCode reserved_keycode;
+ KeySym reserved_keysym;
+ guint reserved_reset_timeout;
+} SpiDEControllerPrivate;
+
+#endif /* _DEVICEEVENTCONTROLLER_X11_H_ */
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index f3de305a..755261c8 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -43,16 +43,16 @@
#include "de-marshaller.h"
#include "keymasks.h"
+#include "deviceeventcontroller.h"
+#include "reentrant-list.h"
+#include "introspection.h"
+
#ifdef HAVE_X11
+#include "deviceeventcontroller-x11.h"
#include "display.h"
#include "event-source.h"
#endif
-#include "deviceeventcontroller.h"
-#include "reentrant-list.h"
-
-#include "introspection.h"
-
#define CHECK_RELEASE_DELAY 20
#define BIT(c, x) (c[x/8]&(1<<(x%8)))
static SpiDEController *saved_controller;
@@ -60,6 +60,16 @@ static SpiDEController *saved_controller;
/* Our parent Gtk object type */
#define PARENT_TYPE G_TYPE_OBJECT
+#ifndef HAVE_X11
+/* If we are using X11, SpiDEControllerPrivate is defined in deviceeventcontroller-x11.h.
+ * Otherwise, there is no private data and so we use a dummy struct.
+ * This is so that G_ADD_PRIVATE() will have a type to work with.
+ */
+typedef struct {
+ int _dummy;
+} SpiDEControllerPrivate;
+#endif
+
/* A pointer to our parent object class */
static int spi_error_code = 0;
struct _SpiPoint {
@@ -1860,7 +1870,8 @@ spi_device_event_controller_class_init (SpiDEControllerClass *klass)
spi_dec_setup_x11 (klass);
else
#endif
- g_type_class_add_private (object_class, sizeof (long)); /* dummy */
+
+ g_type_class_add_private (object_class, sizeof (SpiDEControllerPrivate));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]