summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-09-02 14:29:01 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-09-02 14:29:01 +0300
commitabdd2bf2713f844b99e7e96bbdebcec9be4fee87 (patch)
treee6b1f5b85349f6690cef90f8a57b60062e4f0ef2
parent49fd2b003c1b6720f4502aeb897192e5f285f11f (diff)
downloadmetacity-abdd2bf2713f844b99e7e96bbdebcec9be4fee87.tar.gz
core: remove MetaEventQueue
-rw-r--r--src/Makefile.am2
-rw-r--r--src/core/display-private.h2
-rw-r--r--src/core/display.c2
-rw-r--r--src/core/eventqueue.c182
-rw-r--r--src/core/eventqueue.h38
5 files changed, 0 insertions, 226 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index d0446fdb..383ae884 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,8 +51,6 @@ metacity_SOURCES= \
core/effects.h \
core/errors.c \
include/errors.h \
- core/eventqueue.c \
- core/eventqueue.h \
core/frame.c \
core/frame-private.h \
include/frame.h \
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 7db9ca13..b7246ec9 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -31,7 +31,6 @@
#include <glib.h>
#include <X11/Xlib.h>
-#include "eventqueue.h"
#include "common.h"
#include "boxes.h"
#include "display.h"
@@ -130,7 +129,6 @@ struct _MetaDisplay
/*< private-ish >*/
guint error_trap_synced_at_last_pop : 1;
- MetaEventQueue *events;
MetaScreen *screen;
GHashTable *window_ids;
int error_traps;
diff --git a/src/core/display.c b/src/core/display.c
index 808e376a..7f0698e4 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -390,8 +390,6 @@ meta_display_open (void)
sn_error_trap_pop);
#endif
- the_display->events = NULL;
-
/* Get events */
meta_ui_add_event_func (the_display->xdisplay,
event_callback,
diff --git a/src/core/eventqueue.c b/src/core/eventqueue.c
deleted file mode 100644
index 501d7d7b..00000000
--- a/src/core/eventqueue.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/* Metacity X event source for main loop */
-
-/*
- * Copyright (C) 2001 Havoc Pennington (based on GDK code (C) Owen
- * Taylor, Red Hat Inc.)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include "eventqueue.h"
-#include <X11/Xlib.h>
-
-static gboolean eq_prepare (GSource *source,
- gint *timeout);
-static gboolean eq_check (GSource *source);
-static gboolean eq_dispatch (GSource *source,
- GSourceFunc callback,
- gpointer user_data);
-static void eq_destroy (GSource *source);
-
-static GSourceFuncs eq_funcs = {
- eq_prepare,
- eq_check,
- eq_dispatch,
- eq_destroy
-};
-
-struct _MetaEventQueue
-{
- GSource source;
-
- Display *display;
- GPollFD poll_fd;
- int connection_fd;
- GQueue *events;
-};
-
-MetaEventQueue*
-meta_event_queue_new (Display *display, MetaEventQueueFunc func, gpointer data)
-{
- GSource *source;
- MetaEventQueue *eq;
-
- source = g_source_new (&eq_funcs, sizeof (MetaEventQueue));
- eq = (MetaEventQueue*) source;
-
- eq->connection_fd = ConnectionNumber (display);
- eq->poll_fd.fd = eq->connection_fd;
- eq->poll_fd.events = G_IO_IN;
-
- eq->events = g_queue_new ();
-
- eq->display = display;
-
- g_source_set_priority (source, G_PRIORITY_DEFAULT);
- g_source_add_poll (source, &eq->poll_fd);
- g_source_set_can_recurse (source, TRUE);
-
- g_source_set_callback (source, (GSourceFunc) func, data, NULL);
-
- g_source_attach (source, NULL);
- g_source_unref (source);
-
- return eq;
-}
-
-void
-meta_event_queue_free (MetaEventQueue *eq)
-{
- GSource *source;
-
- source = (GSource*) eq;
-
- g_source_destroy (source);
-}
-
-static gboolean
-eq_events_pending (MetaEventQueue *eq)
-{
- return eq->events->length > 0 || XPending (eq->display);
-}
-
-static void
-eq_queue_events (MetaEventQueue *eq)
-{
- XEvent xevent;
-
- while (XPending (eq->display))
- {
- XEvent *copy;
-
- XNextEvent (eq->display, &xevent);
-
- copy = g_new (XEvent, 1);
- *copy = xevent;
-
- g_queue_push_tail (eq->events, copy);
- }
-}
-
-static gboolean
-eq_prepare (GSource *source, gint *timeout)
-{
- MetaEventQueue *eq;
-
- eq = (MetaEventQueue*) source;
-
- *timeout = -1;
-
- return eq_events_pending (eq);
-}
-
-static gboolean
-eq_check (GSource *source)
-{
- MetaEventQueue *eq;
-
- eq = (MetaEventQueue*) source;
-
- if (eq->poll_fd.revents & G_IO_IN)
- return eq_events_pending (eq);
- else
- return FALSE;
-}
-
-static gboolean
-eq_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
-{
- MetaEventQueue *eq;
-
- eq = (MetaEventQueue*) source;
-
- eq_queue_events (eq);
-
- if (eq->events->length > 0)
- {
- XEvent *event;
- MetaEventQueueFunc func;
-
- event = g_queue_pop_head (eq->events);
- func = (MetaEventQueueFunc) callback;
-
- (* func) (event, user_data);
-
- g_free (event);
- }
-
- return TRUE;
-}
-
-static void
-eq_destroy (GSource *source)
-{
- MetaEventQueue *eq;
-
- eq = (MetaEventQueue*) source;
-
- while (eq->events->length > 0)
- {
- XEvent *event;
-
- event = g_queue_pop_head (eq->events);
-
- g_free (event);
- }
-
- g_queue_free (eq->events);
-
- /* source itself is freed by glib */
-}
diff --git a/src/core/eventqueue.h b/src/core/eventqueue.h
deleted file mode 100644
index db4036f5..00000000
--- a/src/core/eventqueue.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/* Metacity X event source for main loop */
-
-/*
- * Copyright (C) 2001 Havoc Pennington
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef META_EVENT_QUEUE_H
-#define META_EVENT_QUEUE_H
-
-#include <glib.h>
-#include <X11/Xlib.h>
-
-typedef struct _MetaEventQueue MetaEventQueue;
-
-typedef void (* MetaEventQueueFunc) (XEvent *event,
- gpointer data);
-
-MetaEventQueue* meta_event_queue_new (Display *display,
- MetaEventQueueFunc func,
- gpointer data);
-void meta_event_queue_free (MetaEventQueue *eq);
-
-#endif