Rename _gdk_event_mask_table to _gdk_x11_event_mask_table

This commit is contained in:
Matthias Clasen 2010-12-15 17:32:29 -05:00
parent 985eb14469
commit 28b7c6f05d
7 changed files with 91 additions and 94 deletions

105
gdk/gdk.c
View File

@ -8,7 +8,7 @@
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
@ -69,9 +69,9 @@ struct _GdkThreadsDispatch
/* Private variable declarations /* Private variable declarations
*/ */
static int gdk_initialized = 0; /* 1 if the library is initialized, static int gdk_initialized = 0; /* 1 if the library is initialized,
* 0 otherwise. * 0 otherwise.
*/ */
static gchar *gdk_progclass = NULL; static gchar *gdk_progclass = NULL;
@ -82,37 +82,32 @@ static GCallback gdk_threads_unlock = NULL;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
static const GDebugKey gdk_debug_keys[] = { static const GDebugKey gdk_debug_keys[] = {
{"events", GDK_DEBUG_EVENTS}, {"events", GDK_DEBUG_EVENTS},
{"misc", GDK_DEBUG_MISC}, {"misc", GDK_DEBUG_MISC},
{"dnd", GDK_DEBUG_DND}, {"dnd", GDK_DEBUG_DND},
{"xim", GDK_DEBUG_XIM}, {"xim", GDK_DEBUG_XIM},
{"nograbs", GDK_DEBUG_NOGRABS}, {"nograbs", GDK_DEBUG_NOGRABS},
{"colormap", GDK_DEBUG_COLORMAP}, {"colormap", GDK_DEBUG_COLORMAP},
{"input", GDK_DEBUG_INPUT}, {"input", GDK_DEBUG_INPUT},
{"cursor", GDK_DEBUG_CURSOR}, {"cursor", GDK_DEBUG_CURSOR},
{"multihead", GDK_DEBUG_MULTIHEAD}, {"multihead", GDK_DEBUG_MULTIHEAD},
{"xinerama", GDK_DEBUG_XINERAMA}, {"xinerama", GDK_DEBUG_XINERAMA},
{"draw", GDK_DEBUG_DRAW}, {"draw", GDK_DEBUG_DRAW},
{"eventloop", GDK_DEBUG_EVENTLOOP} {"eventloop", GDK_DEBUG_EVENTLOOP}
}; };
static const int gdk_ndebug_keys = G_N_ELEMENTS (gdk_debug_keys);
#endif /* G_ENABLE_DEBUG */
#ifdef G_ENABLE_DEBUG
static gboolean static gboolean
gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError **error) gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{ {
guint debug_value = g_parse_debug_string (value, guint debug_value = g_parse_debug_string (value,
(GDebugKey *) gdk_debug_keys, (GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys); G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0) if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{ {
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-debug")); _("Error parsing option --gdk-debug"));
return FALSE; return FALSE;
} }
@ -125,14 +120,14 @@ static gboolean
gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GError **error) gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{ {
guint debug_value = g_parse_debug_string (value, guint debug_value = g_parse_debug_string (value,
(GDebugKey *) gdk_debug_keys, (GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys); G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0) if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{ {
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-no-debug")); _("Error parsing option --gdk-no-debug"));
return FALSE; return FALSE;
} }
@ -210,10 +205,10 @@ gdk_pre_parse_libgtk_only (void)
gchar *debug_string = getenv("GDK_DEBUG"); gchar *debug_string = getenv("GDK_DEBUG");
if (debug_string != NULL) if (debug_string != NULL)
_gdk_debug_flags = g_parse_debug_string (debug_string, _gdk_debug_flags = g_parse_debug_string (debug_string,
(GDebugKey *) gdk_debug_keys, (GDebugKey *) gdk_debug_keys,
gdk_ndebug_keys); G_N_ELEMENTS (gdk_debug_keys));
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
if (getenv ("GDK_NATIVE_WINDOWS")) if (getenv ("GDK_NATIVE_WINDOWS"))
{ {
@ -247,7 +242,7 @@ gdk_pre_parse_libgtk_only (void)
**/ **/
void void
gdk_parse_args (int *argc, gdk_parse_args (int *argc,
char ***argv) char ***argv)
{ {
GOptionContext *option_context; GOptionContext *option_context;
GOptionGroup *option_group; GOptionGroup *option_group;
@ -527,28 +522,28 @@ gdk_init (int *argc, char ***argv)
* say_something = (yes_or_no != data->what); * say_something = (yes_or_no != data->what);
* *
* if(say_something) * if(say_something)
* { * {
* /<!---->* set the variable *<!---->/ * /<!---->* set the variable *<!---->/
* yes_or_no = data->what; * yes_or_no = data->what;
* } * }
* *
* /<!---->* Unlock the yes_or_no variable *<!---->/ * /<!---->* Unlock the yes_or_no variable *<!---->/
* G_UNLOCK (yes_or_no); * G_UNLOCK (yes_or_no);
* *
* if (say_something) * if (say_something)
* { * {
* /<!---->* get GTK thread lock *<!---->/ * /<!---->* get GTK thread lock *<!---->/
* gdk_threads_enter (<!-- -->); * gdk_threads_enter (<!-- -->);
* *
* /<!---->* set label text *<!---->/ * /<!---->* set label text *<!---->/
* if(data->what == YES_IT_IS) * if(data->what == YES_IT_IS)
* gtk_label_set_text (GTK_LABEL (data->label), "O yes, it is!"); * gtk_label_set_text (GTK_LABEL (data->label), "O yes, it is!");
* else * else
* gtk_label_set_text (GTK_LABEL (data->label), "O no, it isn't!"); * gtk_label_set_text (GTK_LABEL (data->label), "O no, it isn't!");
* *
* /<!---->* release GTK thread lock *<!---->/ * /<!---->* release GTK thread lock *<!---->/
* gdk_threads_leave (<!-- -->); * gdk_threads_leave (<!-- -->);
* } * }
* } * }
* *
* return NULL; * return NULL;
@ -702,10 +697,10 @@ gdk_threads_init (void)
**/ **/
void void
gdk_threads_set_lock_functions (GCallback enter_fn, gdk_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn) GCallback leave_fn)
{ {
g_return_if_fail (gdk_threads_lock == NULL && g_return_if_fail (gdk_threads_lock == NULL &&
gdk_threads_unlock == NULL); gdk_threads_unlock == NULL);
gdk_threads_lock = enter_fn; gdk_threads_lock = enter_fn;
gdk_threads_unlock = leave_fn; gdk_threads_unlock = leave_fn;
@ -795,9 +790,9 @@ gdk_threads_dispatch_free (gpointer data)
*/ */
guint guint
gdk_threads_add_idle_full (gint priority, gdk_threads_add_idle_full (gint priority,
GSourceFunc function, GSourceFunc function,
gpointer data, gpointer data,
GDestroyNotify notify) GDestroyNotify notify)
{ {
GdkThreadsDispatch *dispatch; GdkThreadsDispatch *dispatch;
@ -830,7 +825,7 @@ gdk_threads_add_idle_full (gint priority,
*/ */
guint guint
gdk_threads_add_idle (GSourceFunc function, gdk_threads_add_idle (GSourceFunc function,
gpointer data) gpointer data)
{ {
return gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE, return gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
function, data, NULL); function, data, NULL);

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include "glib.h"
#include "gdkdevice-core.h" #include "gdkdevice-core.h"
#include "gdkinternals.h" #include "gdkinternals.h"
@ -368,10 +369,10 @@ gdk_device_core_grab (GdkDevice *device,
xevent_mask = 0; xevent_mask = 0;
for (i = 0; i < _gdk_nenvent_masks; i++) for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
{ {
if (event_mask & (1 << (i + 1))) if (event_mask & (1 << (i + 1)))
xevent_mask |= _gdk_event_mask_table[i]; xevent_mask |= _gdk_x11_event_mask_table[i];
} }
/* We don't want to set a native motion hint mask, as we're emulating motion /* We don't want to set a native motion hint mask, as we're emulating motion
@ -589,10 +590,10 @@ gdk_device_core_select_window_events (GdkDevice *device,
/* Combine masks */ /* Combine masks */
event_mask |= window_mask; event_mask |= window_mask;
for (i = 0; i < _gdk_nenvent_masks; i++) for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
{ {
if (event_mask & (1 << (i + 1))) if (event_mask & (1 << (i + 1)))
xmask |= _gdk_event_mask_table[i]; xmask |= _gdk_x11_event_mask_table[i];
} }
if (GDK_WINDOW_XID (window) != GDK_WINDOW_XROOTWIN (window)) if (GDK_WINDOW_XID (window) != GDK_WINDOW_XROOTWIN (window))

View File

@ -406,10 +406,10 @@ gdk_x11_event_source_select_events (GdkEventSource *source,
list = list->next; list = list->next;
} }
for (i = 0; i < _gdk_nenvent_masks; i++) for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
{ {
if (event_mask & (1 << (i + 1))) if (event_mask & (1 << (i + 1)))
xmask |= _gdk_event_mask_table[i]; xmask |= _gdk_x11_event_mask_table[i];
} }
XSelectInput (GDK_DISPLAY_XDISPLAY (source->display), window, xmask); XSelectInput (GDK_DISPLAY_XDISPLAY (source->display), window, xmask);

View File

@ -246,10 +246,10 @@ _get_scratch_gc (GdkWindow *window, cairo_region_t *clip_region)
&values); &values);
} }
_gdk_region_get_xrectangles (clip_region, _gdk_x11_region_get_xrectangles (clip_region,
0, 0, 0, 0,
&rectangles, &rectangles,
&n_rects); &n_rects);
XSetClipRectangles (screen->xdisplay, XSetClipRectangles (screen->xdisplay,
screen->subwindow_gcs[depth], screen->subwindow_gcs[depth],

View File

@ -500,11 +500,11 @@ _gdk_send_xevent (GdkDisplay *display,
} }
void void
_gdk_region_get_xrectangles (const cairo_region_t *region, _gdk_x11_region_get_xrectangles (const cairo_region_t *region,
gint x_offset, gint x_offset,
gint y_offset, gint y_offset,
XRectangle **rects, XRectangle **rects,
gint *n_rects) gint *n_rects)
{ {
XRectangle *rectangles; XRectangle *rectangles;
cairo_rectangle_int_t box; cairo_rectangle_int_t box;

View File

@ -83,11 +83,11 @@ void _gdk_xid_table_remove (GdkDisplay *display,
gpointer _gdk_xid_table_lookup (GdkDisplay *display, gpointer _gdk_xid_table_lookup (GdkDisplay *display,
XID xid); XID xid);
gint _gdk_send_xevent (GdkDisplay *display, gint _gdk_send_xevent (GdkDisplay *display,
Window window, Window window,
gboolean propagate, gboolean propagate,
glong event_mask, glong event_mask,
XEvent *event_send); XEvent *event_send);
/* Routines from gdkgeometry-x11.c */ /* Routines from gdkgeometry-x11.c */
void _gdk_window_move_resize_child (GdkWindow *window, void _gdk_window_move_resize_child (GdkWindow *window,
@ -110,14 +110,14 @@ void _gdk_selection_window_destroyed (GdkWindow *window);
gboolean _gdk_selection_filter_clear_event (XSelectionClearEvent *event); gboolean _gdk_selection_filter_clear_event (XSelectionClearEvent *event);
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay, cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window, Window window,
gint shape_type); gint shape_type);
void _gdk_region_get_xrectangles (const cairo_region_t *region, void _gdk_x11_region_get_xrectangles (const cairo_region_t *region,
gint x_offset, gint x_offset,
gint y_offset, gint y_offset,
XRectangle **rects, XRectangle **rects,
gint *n_rects); gint *n_rects);
gboolean _gdk_moveresize_handle_event (XEvent *event); gboolean _gdk_moveresize_handle_event (XEvent *event);
gboolean _gdk_moveresize_configure_done (GdkDisplay *display, gboolean _gdk_moveresize_configure_done (GdkDisplay *display,
@ -209,9 +209,9 @@ cairo_surface_t * _gdk_x11_window_create_bitmap_surface (GdkWindow *window,
int height); int height);
extern gboolean _gdk_use_xshm; extern gboolean _gdk_use_xshm;
extern const int _gdk_nenvent_masks; extern const gint _gdk_x11_event_mask_table[];
extern const int _gdk_event_mask_table[]; extern const gint _gdk_x11_event_mask_table_size;
extern GdkAtom _gdk_selection_property; extern GdkAtom _gdk_selection_property;
extern gboolean _gdk_synchronize; extern gboolean _gdk_synchronize;
#define GDK_SCREEN_DISPLAY(screen) (GDK_SCREEN_X11 (screen)->display) #define GDK_SCREEN_DISPLAY(screen) (GDK_SCREEN_X11 (screen)->display)

View File

@ -72,7 +72,7 @@
#include <X11/extensions/Xdamage.h> #include <X11/extensions/Xdamage.h>
#endif #endif
const int _gdk_event_mask_table[21] = const int _gdk_x11_event_mask_table[21] =
{ {
ExposureMask, ExposureMask,
PointerMotionMask, PointerMotionMask,
@ -91,12 +91,13 @@ const int _gdk_event_mask_table[21] =
StructureNotifyMask, StructureNotifyMask,
PropertyChangeMask, PropertyChangeMask,
VisibilityChangeMask, VisibilityChangeMask,
0, /* PROXIMITY_IN */ 0, /* PROXIMITY_IN */
0, /* PROXIMTY_OUT */ 0, /* PROXIMTY_OUT */
SubstructureNotifyMask, SubstructureNotifyMask,
ButtonPressMask /* SCROLL; on X mouse wheel events is treated as mouse button 4/5 */ ButtonPressMask /* SCROLL; on X mouse wheel events is treated as mouse button 4/5 */
}; };
const int _gdk_nenvent_masks = sizeof (_gdk_event_mask_table) / sizeof (int);
const gint _gdk_x11_event_mask_table_size = G_N_ELEMENTS (_gdk_x11_event_mask_table);
/* Forward declarations */ /* Forward declarations */
static void gdk_window_set_static_win_gravity (GdkWindow *window, static void gdk_window_set_static_win_gravity (GdkWindow *window,
@ -838,9 +839,9 @@ x_event_mask_to_gdk_event_mask (long mask)
GdkEventMask event_mask = 0; GdkEventMask event_mask = 0;
int i; int i;
for (i = 0; i < _gdk_nenvent_masks; i++) for (i = 0; i < _gdk_x11_event_mask_table_size; i++)
{ {
if (mask & _gdk_event_mask_table[i]) if (mask & _gdk_x11_event_mask_table[i])
event_mask |= 1 << (i + 1); event_mask |= 1 << (i + 1);
} }
@ -2883,9 +2884,9 @@ do_shape_combine_region (GdkWindow *window,
gint n_rects = 0; gint n_rects = 0;
XRectangle *xrects = NULL; XRectangle *xrects = NULL;
_gdk_region_get_xrectangles (shape_region, _gdk_x11_region_get_xrectangles (shape_region,
0, 0, 0, 0,
&xrects, &n_rects); &xrects, &n_rects);
if (shape == ShapeBounding) if (shape == ShapeBounding)
{ {