Commit ea96e5e1 authored by Matthias Clasen's avatar Matthias Clasen

Explode gdkinternals.h into per-class private headers

At the same time, move some more class and instance structs
out of public headers.
parent ff8a3347
......@@ -96,9 +96,18 @@ gdk_built_public_sources = \
gdkenumtypes.h
gdk_private_headers = \
gdkinternals.h \
gdkapplaunchcontextprivate.h \
gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
gdkintl.h
gdkdisplaymanagerprivate.h \
gdkdisplayprivate.h \
gdkdndprivate.h \
gdkscreenprivate.h \
gdkinternals.h \
gdkintl.h \
gdkkeysprivate.h \
gdkvisualprivate.h \
gdkpoly-generic.h
gdk_c_sources = \
gdk.c \
......
......@@ -22,9 +22,7 @@
#include "config.h"
#include "gdkapplaunchcontext.h"
#include "gdkinternals.h"
#include "gdkapplaunchcontextprivate.h"
#include "gdkscreen.h"
#include "gdkintl.h"
......@@ -81,39 +79,29 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
context_class->get_display = gdk_app_launch_context_get_display;
context_class->get_startup_notify_id = gdk_app_launch_context_get_startup_notify_id;
context_class->launch_failed = gdk_app_launch_context_launch_failed;
g_type_class_add_private (klass, sizeof (GdkAppLaunchContextPrivate));
}
static void
gdk_app_launch_context_init (GdkAppLaunchContext *context)
{
context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context,
GDK_TYPE_APP_LAUNCH_CONTEXT,
GdkAppLaunchContextPrivate);
context->priv->workspace = -1;
context->workspace = -1;
}
static void
gdk_app_launch_context_finalize (GObject *object)
{
GdkAppLaunchContext *context;
GdkAppLaunchContextPrivate *priv;
context = GDK_APP_LAUNCH_CONTEXT (object);
GdkAppLaunchContext *context = GDK_APP_LAUNCH_CONTEXT (object);
priv = context->priv;
if (context->display)
g_object_unref (context->display);
if (priv->display)
g_object_unref (priv->display);
if (context->screen)
g_object_unref (context->screen);
if (priv->screen)
g_object_unref (priv->screen);
if (context->icon)
g_object_unref (context->icon);
if (priv->icon)
g_object_unref (priv->icon);
g_free (priv->icon_name);
g_free (context->icon_name);
G_OBJECT_CLASS (gdk_app_launch_context_parent_class)->finalize (object);
}
......@@ -123,16 +111,14 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
GdkAppLaunchContext *ctx = GDK_APP_LAUNCH_CONTEXT (context);
GdkDisplay *display;
GdkAppLaunchContextPrivate *priv;
priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
if (priv->screen)
return gdk_screen_make_display_name (priv->screen);
if (ctx->screen)
return gdk_screen_make_display_name (ctx->screen);
if (priv->display)
display = priv->display;
if (ctx->display)
display = ctx->display;
else
display = gdk_display_get_default ();
......@@ -158,7 +144,7 @@ gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display));
g_warn_if_fail (display == NULL || display == context->priv->display);
g_warn_if_fail (display == NULL || display == context->display);
}
/**
......@@ -182,16 +168,16 @@ gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
g_return_if_fail (screen == NULL || gdk_screen_get_display (screen) == context->priv->display);
g_return_if_fail (screen == NULL || gdk_screen_get_display (screen) == context->display);
if (context->priv->screen)
if (context->screen)
{
g_object_unref (context->priv->screen);
context->priv->screen = NULL;
g_object_unref (context->screen);
context->screen = NULL;
}
if (screen)
context->priv->screen = g_object_ref (screen);
context->screen = g_object_ref (screen);
}
/**
......@@ -217,7 +203,7 @@ gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
context->priv->workspace = desktop;
context->workspace = desktop;
}
/**
......@@ -241,7 +227,7 @@ gdk_app_launch_context_set_timestamp (GdkAppLaunchContext *context,
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
context->priv->timestamp = timestamp;
context->timestamp = timestamp;
}
/**
......@@ -266,14 +252,14 @@ gdk_app_launch_context_set_icon (GdkAppLaunchContext *context,
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (icon == NULL || G_IS_ICON (icon));
if (context->priv->icon)
if (context->icon)
{
g_object_unref (context->priv->icon);
context->priv->icon = NULL;
g_object_unref (context->icon);
context->icon = NULL;
}
if (icon)
context->priv->icon = g_object_ref (icon);
context->icon = g_object_ref (icon);
}
/**
......@@ -298,8 +284,8 @@ gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_free (context->priv->icon_name);
context->priv->icon_name = g_strdup (icon_name);
g_free (context->icon_name);
context->icon_name = g_strdup (icon_name);
}
/**
......
......@@ -40,20 +40,7 @@ G_BEGIN_DECLS
#define GDK_IS_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDK_TYPE_APP_LAUNCH_CONTEXT))
#define GDK_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContextClass))
typedef struct GdkAppLaunchContextClass GdkAppLaunchContextClass;
typedef struct GdkAppLaunchContextPrivate GdkAppLaunchContextPrivate;
struct GdkAppLaunchContext
{
GAppLaunchContext parent_instance;
GdkAppLaunchContextPrivate *priv;
};
struct GdkAppLaunchContextClass
{
GAppLaunchContextClass parent_class;
};
typedef GAppLaunchContextClass GdkAppLaunchContextClass;
GType gdk_app_launch_context_get_type (void);
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_APP_LAUNCH_CONTEXT_PRIVATE_H__
#define __GDK_APP_LAUNCH_CONTEXT_PRIVATE_H__
#include <gio/gio.h>
#include "gdkapplaunchcontext.h"
#include "gdktypes.h"
G_BEGIN_DECLS
struct _GdkAppLaunchContext
{
GAppLaunchContext parent_instance;
GdkDisplay *display;
GdkScreen *screen;
gint workspace;
guint32 timestamp;
GIcon *icon;
char *icon_name;
};
G_END_DECLS
#endif
......@@ -19,10 +19,9 @@
#include "config.h"
#include "gdkdevice.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
typedef struct _GdkAxisInfo GdkAxisInfo;
......
......@@ -19,10 +19,9 @@
#include "config.h"
#include "gdkdevicemanager.h"
#include "gdkdevicemanagerprivate.h"
#include "gdkdisplay.h"
#include "gdkintl.h"
#include "gdkinternals.h"
/**
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010 Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_DEVICE_MANAGER_PRIVATE_H__
#define __GDK_DEVICE_MANAGER_PRIVATE_H__
#include "gdkdevicemanager.h"
G_BEGIN_DECLS
struct _GdkDeviceManager
{
GObject parent_instance;
GdkDisplay *display;
};
struct _GdkDeviceManagerClass
{
GObjectClass parent_class;
/* Signals */
void (* device_added) (GdkDeviceManager *device_manager,
GdkDevice *device);
void (* device_removed) (GdkDeviceManager *device_manager,
GdkDevice *device);
void (* device_changed) (GdkDeviceManager *device_manager,
GdkDevice *device);
/* VMethods */
GList * (* list_devices) (GdkDeviceManager *device_manager,
GdkDeviceType type);
GdkDevice * (* get_client_pointer) (GdkDeviceManager *device_manager);
};
G_END_DECLS
#endif
......@@ -20,8 +20,8 @@
#ifndef __GDK_DEVICE_PRIVATE_H__
#define __GDK_DEVICE_PRIVATE_H__
#include "gdkdevicemanager.h"
#include "gdkdevice.h"
#include "gdkdevicemanager.h"
#include "gdkevents.h"
G_BEGIN_DECLS
......
......@@ -24,6 +24,7 @@
#include "config.h"
#include "gdkdisplay.h"
#include "gdkdisplayprivate.h"
#include "gdkevents.h"
#include "gdkwindowimpl.h"
......
......@@ -34,10 +34,6 @@
G_BEGIN_DECLS
typedef struct _GdkDisplayClass GdkDisplayClass;
typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
#define GDK_TYPE_DISPLAY (gdk_display_get_type ())
#define GDK_DISPLAY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay))
#define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
......@@ -45,76 +41,8 @@ typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
#define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
#define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
/* Tracks information about the keyboard grab on this display */
typedef struct
{
GdkWindow *window;
GdkWindow *native_window;
gulong serial;
gboolean owner_events;
guint32 time;
} GdkKeyboardGrabInfo;
/* Tracks information about which window and position the pointer last was in.
* This is useful when we need to synthesize events later.
* Note that we track toplevel_under_pointer using enter/leave events,
* so in the case of a grab, either with owner_events==FALSE or with the
* pointer in no clients window the x/y coordinates may actually be outside
* the window.
*/
typedef struct
{
GdkWindow *toplevel_under_pointer; /* The toplevel window with mouse inside, tracked via native events */
GdkWindow *window_under_pointer; /* The window that last got sent a normal enter event */
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
} GdkPointerWindowInfo;
typedef struct
{
guint32 button_click_time[2]; /* The last 2 button click times. */
GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
gint button_number[2]; /* The last 2 buttons to be pressed. */
gint button_x[2]; /* The last 2 button click positions. */
gint button_y[2];
} GdkMultipleClickInfo;
struct _GdkDisplay
{
GObject parent_instance;
/*< private >*/
GList *GSEAL (queued_events);
GList *GSEAL (queued_tail);
/* Information for determining if the latest button click
* is part of a double-click or triple-click
*/
GHashTable *GSEAL (multiple_click_info);
guint GSEAL (double_click_time); /* Maximum time between clicks in msecs */
GdkDevice *GSEAL (core_pointer); /* Core pointer device */
const GdkDisplayDeviceHooks *GSEAL (device_hooks); /* Current hooks for querying pointer */
guint GSEAL (closed) : 1; /* Whether this display has been closed */
guint GSEAL (ignore_core_events) : 1; /* Don't send core motion and button event */
guint GSEAL (double_click_distance); /* Maximum distance between clicks in pixels */
GHashTable *GSEAL (device_grabs);
GHashTable *GSEAL (motion_hint_info);
/* Hashtable containing a GdkPointerWindowInfo for each device */
GHashTable *GSEAL (pointers_info);
/* Last reported event time from server */
guint32 GSEAL (last_event_time);
/* Device manager associated to the display */
GdkDeviceManager *GSEAL (device_manager);
};
typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
/**
* GdkDisplayPointerHooks:
......
......@@ -27,10 +27,7 @@
#include "config.h"
#include "gdkconfig.h"
#include "gdkdisplaymanager.h"
#include "gdkscreen.h"
#include "gdkdisplay.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkinternals.h"
#include "gdkmarshalers.h"
#include "gdkintl.h"
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010, Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_DISPLAY_MANAGER_PRIVATE_H__
#define __GDK_DISPLAY_MANAGER_PRIVATE_H__
#include "gdkdisplaymanager.h"
G_BEGIN_DECLS
struct _GdkDisplayManager
{
GObject parent_instance;
};
struct _GdkDisplayManagerClass
{
GObjectClass parent_class;
GSList * (*list_displays) (GdkDisplayManager *manager);
GdkDisplay * (*get_default_display) (GdkDisplayManager *manager);
void (*set_default_display) (GdkDisplayManager *manager,
GdkDisplay *display);
GdkDisplay * (*open_display) (GdkDisplayManager *manager,
const gchar *name);
/* signals */
void (*display_opened) (GdkDisplayManager *manager,
GdkDisplay *display);
};
G_END_DECLS
#endif
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_DISPLAY_PRIVATE_H__
#define __GDK_DISPLAY_PRIVATE_H__
#include "gdkdisplay.h"
G_BEGIN_DECLS
typedef struct _GdkDisplayClass GdkDisplayClass;
/* Tracks information about the keyboard grab on this display */
typedef struct
{
GdkWindow *window;
GdkWindow *native_window;
gulong serial;
gboolean owner_events;
guint32 time;
} GdkKeyboardGrabInfo;
/* Tracks information about the pointer grab on this display */
typedef struct
{
GdkWindow *window;
GdkWindow *native_window;
gulong serial_start;
gulong serial_end; /* exclusive, i.e. not active on serial_end */
gboolean owner_events;
guint event_mask;
gboolean implicit;
guint32 time;
GdkGrabOwnership ownership;
guint activated : 1;
guint implicit_ungrab : 1;
} GdkDeviceGrabInfo;
/* Tracks information about which window and position the pointer last was in.
* This is useful when we need to synthesize events later.
* Note that we track toplevel_under_pointer using enter/leave events,
* so in the case of a grab, either with owner_events==FALSE or with the
* pointer in no clients window the x/y coordinates may actually be outside
* the window.
*/
typedef struct
{
GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
/* tracked via native events */
GdkWindow *window_under_pointer; /* window that last got a normal enter event */
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
} GdkPointerWindowInfo;
typedef struct
{
guint32 button_click_time[2]; /* last 2 button click times */
GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
gint button_number[2]; /* last 2 buttons to be pressed */
gint button_x[2]; /* last 2 button click positions */
gint button_y[2];
} GdkMultipleClickInfo;
struct _GdkDisplay
{
GObject parent_instance;
GList *queued_events;
GList *queued_tail;
/* Information for determining if the latest button click
* is part of a double-click or triple-click
*/
GHashTable *multiple_click_info;
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
const GdkDisplayDeviceHooks *device_hooks; /* Hooks for querying pointer */
guint closed : 1; /* Whether this display has been closed */
guint ignore_core_events : 1; /* Don't send core motion and button event */
guint double_click_distance; /* Maximum distance between clicks in pixels */
GHashTable *device_grabs;
GHashTable *motion_hint_info;
GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
guint32 last_event_time; /* Last reported event time from server */
GdkDeviceManager *device_manager;
};
struct _GdkDisplayClass
{
GObjectClass parent_class;
G_CONST_RETURN gchar * (*get_name) (GdkDisplay *display);
gint (*get_n_screens) (GdkDisplay *display);
GdkScreen * (*get_screen) (GdkDisplay *display,
gint screen_num);
GdkScreen * (*get_default_screen) (GdkDisplay *display);
void (*beep) (GdkDisplay *display);
void (*sync) (GdkDisplay *display);
void (*flush) (GdkDisplay *display);
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
GdkWindow * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_selection_notification) (GdkDisplay *display);
gboolean (*request_selection_notification) (GdkDisplay *display,
GdkAtom selection);
gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
void (*store_clipboard) (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
const GdkAtom *targets,
gint n_targets);
gboolean (*supports_shapes) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
gboolean (*supports_composite) (GdkDisplay *display);
GList * (*list_devices) (GdkDisplay *display);
gboolean (*send_client_message) (GdkDisplay *display,
GdkEvent *event,
GdkNativeWindow winid);
void (*add_client_message_filter) (GdkDisplay *display,
GdkAtom message_type,
GdkFilterFunc func,
gpointer data);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
GdkNativeWindow winid,
GdkDragProtocol *protocol,
guint *version);
/* Signals */
void (*closed) (GdkDisplay *display,
gboolean is_error);
};
typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
GdkDevice *device,
GdkPointerWindowInfo *device_info,
gpointer user_data);
void _gdk_display_device_grab_update (GdkDisplay *display,
GdkDevice *device,
GdkDevice *source_device,
gulong current_serial);
GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
GdkDevice *device);
GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
GdkDevice *device,
GdkWindow *window,
GdkWindow *native_window,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
gulong serial_start,
guint32 time,
gboolean implicit);
GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
GdkDevice *device,
gulong serial);
gboolean _gdk_display_end_device_grab (GdkDisplay *display,
GdkDevice *device,
gulong serial,
GdkWindow *if_child,
gboolean implicit);
gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
GdkDevice *device,
gulong serial);
void _gdk_display_enable_motion_hints (GdkDisplay *display,
GdkDevice *device);
GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
GdkDevice *device);
void _gdk_display_pointer_info_foreach (GdkDisplay *display,
GdkDisplayPointerInfoForeach func,
gpointer user_data);
G_END_DECLS
#endif /* __GDK_DISPLAY_PRIVATE_H__ */
......@@ -26,8 +26,7 @@
#include "config.h"
#include "gdkdnd.h"
#include "gdkinternals.h"
#include "gdkdndprivate.h"
#include "gdkdisplay.h"
#include "gdkwindow.h"
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010, Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GDK_DND_PRIVATE_H__
#define __GDK_DND_PRIVATE_H__
#include "gdkdnd.h"
G_BEGIN_DECLS