Multiple changes to reduce the amount of unprefixed symbols

The X11 backend exports a number of symbols which are _-prefixed
(so don't become part of the gdk api), but are not named in a
way to prevent accidental clashes between backends.

The one API change here is that the gdk_xid_table functions
have been removed - they did not server an purpose, since the
xid table only stores windows anyway, and we already have a
lookup-by-xid function for windows.
This commit is contained in:
Matthias Clasen 2010-12-15 14:49:23 -05:00
parent 33417c36f1
commit 985eb14469
17 changed files with 116 additions and 153 deletions

View File

@ -951,8 +951,6 @@ GDK_CURSOR_XCURSOR
GDK_CURSOR_XDISPLAY
gdkx_visual_get
gdk_x11_window_foreign_new_for_display
gdk_xid_table_lookup
gdk_xid_table_lookup_for_display
gdk_x11_window_lookup_for_display
gdk_x11_lookup_xdisplay
gdk_x11_get_server_time

View File

@ -283,8 +283,6 @@ void gdk_synthesize_window_state (GdkWindow *window,
GdkWindowState unset_flags,
GdkWindowState set_flags);
GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);

View File

@ -66,23 +66,23 @@ struct _GdkDeviceXIClass
};
G_GNUC_INTERNAL
GType gdk_device_xi_get_type (void) G_GNUC_CONST;
GType gdk_device_xi_get_type (void) G_GNUC_CONST;
G_GNUC_INTERNAL
void gdk_device_xi_update_window_info (GdkWindow *window);
void gdk_device_xi_update_window_info (GdkWindow *window);
G_GNUC_INTERNAL
void gdk_device_xi_update_axes (GdkDevice *device,
gint axes_count,
gint first_axis,
gint *axis_data);
void gdk_device_xi_update_axes (GdkDevice *device,
gint axes_count,
gint first_axis,
gint *axis_data);
G_GNUC_INTERNAL
void gdk_device_xi_translate_axes (GdkDevice *device,
GdkWindow *window,
gint *axis_data,
gdouble *axes,
gdouble *x,
gdouble *y);
void gdk_device_xi_translate_axes (GdkDevice *device,
GdkWindow *window,
gint *axis_data,
gdouble *axes,
gdouble *x,
gdouble *y);
G_END_DECLS

View File

@ -51,11 +51,11 @@ struct _GdkDeviceXI2Class
};
G_GNUC_INTERNAL
GType gdk_device_xi2_get_type (void) G_GNUC_CONST;
GType gdk_device_xi2_get_type (void) G_GNUC_CONST;
G_GNUC_INTERNAL
guchar * gdk_device_xi2_translate_event_mask (GdkEventMask event_mask,
int *len);
guchar * gdk_device_xi2_translate_event_mask (GdkEventMask event_mask,
int *len);
G_GNUC_INTERNAL
guint gdk_device_xi2_translate_state (XIModifierState *mods_state,
XIButtonState *buttons_state);

View File

@ -29,7 +29,7 @@
#include "gdkx.h"
GdkDeviceManager *
_gdk_device_manager_new (GdkDisplay *display)
_gdk_x11_device_manager_new (GdkDisplay *display)
{
if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
{

View File

@ -1255,12 +1255,12 @@ _gdk_x11_display_open (const gchar *display_name)
* structures in places
*/
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
_gdk_screen_x11_events_init (display_x11->screens[i]);
_gdk_x11_screen_init_events (display_x11->screens[i]);
/*set the default screen */
display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
display->device_manager = _gdk_device_manager_new (display);
display->device_manager = _gdk_x11_device_manager_new (display);
gdk_event_init (display);

View File

@ -605,11 +605,11 @@ is_pointer_within_shape (GdkDisplay *display,
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
cairo_region_t *input_shape;
child->shape = _xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeBounding);
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeBounding);
#ifdef ShapeInput
input_shape = _xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeInput);
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeInput);
if (child->shape && input_shape)
{
cairo_region_intersect (child->shape, input_shape);

View File

@ -202,9 +202,9 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
GdkEventTranslator *translator = list->data;
list = list->next;
event = gdk_event_translator_translate (translator,
event_source->display,
xevent);
event = _gdk_x11_event_translator_translate (translator,
event_source->display,
xevent);
}
if (event &&
@ -394,12 +394,12 @@ gdk_x11_event_source_select_events (GdkEventSource *source,
GdkEventTranslator *translator = list->data;
GdkEventMask translator_mask, mask;
translator_mask = gdk_event_translator_get_handled_events (translator);
translator_mask = _gdk_x11_event_translator_get_handled_events (translator);
mask = event_mask & translator_mask;
if (mask != 0)
{
gdk_event_translator_select_window_events (translator, window, mask);
_gdk_x11_event_translator_select_window_events (translator, window, mask);
event_mask &= ~mask;
}

View File

@ -23,19 +23,19 @@
typedef GdkEventTranslatorIface GdkEventTranslatorInterface;
G_DEFINE_INTERFACE (GdkEventTranslator, gdk_event_translator, G_TYPE_OBJECT);
G_DEFINE_INTERFACE (GdkEventTranslator, _gdk_x11_event_translator, G_TYPE_OBJECT);
static void
gdk_event_translator_default_init (GdkEventTranslatorInterface *iface)
_gdk_x11_event_translator_default_init (GdkEventTranslatorInterface *iface)
{
}
GdkEvent *
gdk_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent)
_gdk_x11_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent)
{
GdkEventTranslatorIface *iface;
GdkEvent *event;
@ -59,7 +59,7 @@ gdk_event_translator_translate (GdkEventTranslator *translator,
}
GdkEventMask
gdk_event_translator_get_handled_events (GdkEventTranslator *translator)
_gdk_x11_event_translator_get_handled_events (GdkEventTranslator *translator)
{
GdkEventTranslatorIface *iface;
@ -74,9 +74,9 @@ gdk_event_translator_get_handled_events (GdkEventTranslator *translator)
}
void
gdk_event_translator_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask)
_gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask)
{
GdkEventTranslatorIface *iface;

View File

@ -26,7 +26,7 @@
G_BEGIN_DECLS
#define GDK_TYPE_EVENT_TRANSLATOR (gdk_event_translator_get_type ())
#define GDK_TYPE_EVENT_TRANSLATOR (_gdk_x11_event_translator_get_type ())
#define GDK_EVENT_TRANSLATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_EVENT_TRANSLATOR, GdkEventTranslator))
#define GDK_IS_EVENT_TRANSLATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_EVENT_TRANSLATOR))
#define GDK_EVENT_TRANSLATOR_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GDK_TYPE_EVENT_TRANSLATOR, GdkEventTranslatorIface))
@ -50,15 +50,15 @@ struct _GdkEventTranslatorIface
GdkEventMask event_mask);
};
GType gdk_event_translator_get_type (void) G_GNUC_CONST;
GType _gdk_x11_event_translator_get_type (void) G_GNUC_CONST;
GdkEvent * gdk_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent);
GdkEventMask gdk_event_translator_get_handled_events (GdkEventTranslator *translator);
void gdk_event_translator_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
GdkEvent * _gdk_x11_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent);
GdkEventMask _gdk_x11_event_translator_get_handled_events (GdkEventTranslator *translator);
void _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
G_END_DECLS

View File

@ -75,11 +75,14 @@ GList * _gdk_screen_x11_list_visuals (GdkScreen *screen
void _gdk_xid_table_insert (GdkDisplay *display,
XID *xid,
gpointer data);
void _gdk_xid_table_remove (GdkDisplay *display,
XID xid);
void _gdk_xid_table_insert (GdkDisplay *display,
XID *xid,
gpointer data);
void _gdk_xid_table_remove (GdkDisplay *display,
XID xid);
gpointer _gdk_xid_table_lookup (GdkDisplay *display,
XID xid);
gint _gdk_send_xevent (GdkDisplay *display,
Window window,
gboolean propagate,
@ -106,9 +109,9 @@ void _gdk_x11_window_translate (GdkWindow *window,
void _gdk_selection_window_destroyed (GdkWindow *window);
gboolean _gdk_selection_filter_clear_event (XSelectionClearEvent *event);
cairo_region_t* _xwindow_get_shape (Display *xdisplay,
Window window,
gint shape_type);
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window,
gint shape_type);
void _gdk_region_get_xrectangles (const cairo_region_t *region,
gint x_offset,
@ -152,6 +155,8 @@ void _gdk_x11_display_update_grab_info_ungrab (GdkDisplay *display,
void _gdk_x11_display_queue_events (GdkDisplay *display);
void _gdk_x11_device_check_extension_events (GdkDevice *device);
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
void _gdk_x11_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
void _gdk_x11_display_manager_remove_display (GdkDisplayManager *manager,
@ -180,13 +185,13 @@ void _gdk_x11_precache_atoms (GdkDisplay *display,
const gchar * const *atom_names,
gint n_atoms);
void _gdk_screen_x11_events_init (GdkScreen *screen);
void _gdk_events_init (GdkDisplay *display);
void _gdk_events_uninit (GdkDisplay *display);
void _gdk_x11_dnd_init (GdkDisplay *display);
void _gdk_events_init (GdkDisplay *display);
void _gdk_events_uninit (GdkDisplay *display);
void _gdk_windowing_window_init (GdkScreen *screen);
void _gdk_x11_visual_init (GdkScreen *screen);
void _gdk_x11_dnd_init (GdkDisplay *display);
void _gdk_x11_screen_init_root_window (GdkScreen *screen);
void _gdk_x11_screen_init_visuals (GdkScreen *screen);
void _gdk_x11_screen_init_events (GdkScreen *screen);
void _gdk_x11_cursor_update_theme (GdkCursor *cursor);
void _gdk_x11_cursor_display_finalize (GdkDisplay *display);

View File

@ -810,8 +810,8 @@ _gdk_x11_screen_new (GdkDisplay *display,
init_multihead (screen);
init_randr_support (screen);
_gdk_x11_visual_init (screen);
_gdk_windowing_window_init (screen);
_gdk_x11_screen_init_visuals (screen);
_gdk_x11_screen_init_root_window (screen);
return screen;
}
@ -1592,7 +1592,7 @@ gdk_xsettings_notify_cb (const char *name,
}
void
_gdk_screen_x11_events_init (GdkScreen *screen)
_gdk_x11_screen_init_events (GdkScreen *screen)
{
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);

View File

@ -101,7 +101,7 @@ gdk_visual_x11_class_init (GdkVisualX11Class *class)
}
void
_gdk_x11_visual_init (GdkScreen *screen)
_gdk_x11_screen_init_visuals (GdkScreen *screen)
{
static const gint possible_depths[8] = { 32, 30, 24, 16, 15, 8, 4, 1 };
static const GdkVisualType possible_types[6] =

View File

@ -450,7 +450,7 @@ _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window)
}
void
_gdk_windowing_window_init (GdkScreen * screen)
_gdk_x11_screen_init_root_window (GdkScreen *screen)
{
GdkWindow *window;
GdkWindowImplX11 *impl;
@ -882,7 +882,7 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
display_x11 = GDK_DISPLAY_X11 (display);
if ((win = gdk_xid_table_lookup_for_display (display, window)) != NULL)
if ((win = _gdk_xid_table_lookup (display, window)) != NULL)
return g_object_ref (win);
gdk_x11_display_error_trap_push (display);
@ -912,7 +912,7 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
impl = GDK_WINDOW_IMPL_X11 (win->impl);
impl->wrapper = win;
win->parent = gdk_xid_table_lookup_for_display (display, parent);
win->parent = _gdk_xid_table_lookup (display, parent);
if (!win->parent || GDK_WINDOW_TYPE (win->parent) == GDK_WINDOW_FOREIGN)
win->parent = gdk_screen_get_root_window (screen);
@ -963,7 +963,7 @@ GdkWindow *
gdk_x11_window_lookup_for_display (GdkDisplay *display,
Window window)
{
return (GdkWindow*) gdk_xid_table_lookup_for_display (display, window);
return (GdkWindow*) _gdk_xid_table_lookup (display, window);
}
static void
@ -3737,9 +3737,9 @@ gdk_x11_window_set_functions (GdkWindow *window,
}
cairo_region_t *
_xwindow_get_shape (Display *xdisplay,
Window window,
gint shape_type)
_gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window,
gint shape_type)
{
cairo_region_t *shape;
GdkRectangle *rl;
@ -3787,8 +3787,9 @@ gdk_x11_window_get_shape (GdkWindow *window)
{
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
return _xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), ShapeBounding);
return _gdk_x11_xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
ShapeBounding);
return NULL;
}
@ -3799,9 +3800,9 @@ gdk_x11_window_get_input_shape (GdkWindow *window)
#if defined(ShapeInput)
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
return _xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
ShapeInput);
return _gdk_x11_xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
ShapeInput);
#endif
return NULL;

View File

@ -185,9 +185,6 @@ GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
GdkVisual* gdkx_visual_get (VisualID xvisualid);
#endif
/* Return the Gdk* for a particular XID */
gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display,
XID xid);
guint32 gdk_x11_get_server_time (GdkWindow *window);
guint32 gdk_x11_display_get_user_time (GdkDisplay *display);
@ -211,7 +208,6 @@ XID gdk_x11_screen_get_monitor_output (GdkScreen *screen,
gint monitor_num);
#ifndef GDK_MULTIHEAD_SAFE
gpointer gdk_xid_table_lookup (XID xid);
gboolean gdk_net_wm_supports (GdkAtom property);
void gdk_x11_grab_server (void);
void gdk_x11_ungrab_server (void);

View File

@ -32,15 +32,22 @@
#include <stdio.h>
static guint gdk_xid_hash (XID *xid);
static gboolean gdk_xid_equal (XID *a,
XID *b);
static guint
gdk_xid_hash (XID *xid)
{
return *xid;
}
static gboolean
gdk_xid_equal (XID *a, XID *b)
{
return (*a == *b);
}
void
_gdk_xid_table_insert (GdkDisplay *display,
XID *xid,
gpointer data)
XID *xid,
gpointer data)
{
GdkDisplayX11 *display_x11;
@ -51,7 +58,7 @@ _gdk_xid_table_insert (GdkDisplay *display,
if (!display_x11->xid_ht)
display_x11->xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
(GEqualFunc) gdk_xid_equal);
(GEqualFunc) gdk_xid_equal);
if (g_hash_table_lookup (display_x11->xid_ht, xid))
g_warning ("XID collision, trouble ahead");
@ -61,7 +68,7 @@ _gdk_xid_table_insert (GdkDisplay *display,
void
_gdk_xid_table_remove (GdkDisplay *display,
XID xid)
XID xid)
{
GdkDisplayX11 *display_x11;
@ -73,61 +80,19 @@ _gdk_xid_table_remove (GdkDisplay *display,
g_hash_table_remove (display_x11->xid_ht, &xid);
}
/**
* gdk_xid_table_lookup_for_display:
* @display: the #GdkDisplay.
* @xid: an X id.
*
* Returns the GDK object associated with the given X id.
*
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* of no object is associated with the X id.
*
* Since: 2.2
*/
gpointer
gdk_xid_table_lookup_for_display (GdkDisplay *display,
XID xid)
_gdk_xid_table_lookup (GdkDisplay *display,
XID xid)
{
GdkDisplayX11 *display_x11;
gpointer data = NULL;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
display_x11 = GDK_DISPLAY_X11 (display);
if (display_x11->xid_ht)
data = g_hash_table_lookup (display_x11->xid_ht, &xid);
return data;
}
/**
* gdk_xid_table_lookup:
* @xid: an X id.
*
* Returns the Gdk object associated with the given X id for the default
* display.
*
* Return value: (transfer none): the associated #GdkWindow, or %NULL
* if no object is associated with the X id.
*/
gpointer
gdk_xid_table_lookup (XID xid)
{
return gdk_xid_table_lookup_for_display (gdk_display_get_default (), xid);
}
static guint
gdk_xid_hash (XID *xid)
{
return *xid;
}
static gboolean
gdk_xid_equal (XID *a,
XID *b)
{
return (*a == *b);
}

View File

@ -31,22 +31,22 @@ extern "C" {
/* Renames for GDK inclusion */
#define xsettings_byte_order _gdk_xsettings_byte_order
#define xsettings_client_destroy _gdk_xsettings_client_destroy
#define xsettings_client_get_setting _gdk_xsettings_client_get_setting
#define xsettings_client_new _gdk_xsettings_client_new
#define xsettings_client_new_with_grab_funcs _gdk_xsettings_client_new_with_grab_funcs
#define xsettings_client_set_grab_func _gdk_xsettings_client_set_grab_func
#define xsettings_client_set_ungrab_func _gdk_xsettings_client_set_ungrab_func
#define xsettings_client_process_event _gdk_xsettings_client_process_event
#define xsettings_list_copy _gdk_xsettings_list_copy
#define xsettings_list_delete _gdk_xsettings_list_delete
#define xsettings_list_free _gdk_xsettings_list_free
#define xsettings_list_insert _gdk_xsettings_list_insert
#define xsettings_list_lookup _gdk_xsettings_list_lookup
#define xsettings_setting_copy _gdk_xsettings_setting_copy
#define xsettings_setting_equal _gdk_xsettings_setting_equal
#define xsettings_setting_free _gdk_xsettings_setting_free
#define xsettings_byte_order _gdk_x11_xsettings_byte_order
#define xsettings_client_destroy _gdk_x11_xsettings_client_destroy
#define xsettings_client_get_setting _gdk_x11_xsettings_client_get_setting
#define xsettings_client_new _gdk_x11_xsettings_client_new
#define xsettings_client_new_with_grab_funcs _gdk_x11_xsettings_client_new_with_grab_funcs
#define xsettings_client_set_grab_func _gdk_x11_xsettings_client_set_grab_func
#define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func
#define xsettings_client_process_event _gdk_x11_xsettings_client_process_event
#define xsettings_list_copy _gdk_x11_xsettings_list_copy
#define xsettings_list_delete _gdk_x11_xsettings_list_delete
#define xsettings_list_free _gdk_x11_xsettings_list_free
#define xsettings_list_insert _gdk_x11_xsettings_list_insert
#define xsettings_list_lookup _gdk_x11_xsettings_list_lookup
#define xsettings_setting_copy _gdk_x11_xsettings_setting_copy
#define xsettings_setting_equal _gdk_x11_xsettings_setting_equal
#define xsettings_setting_free _gdk_x11_xsettings_setting_free
typedef struct _XSettingsBuffer XSettingsBuffer;