diff options
author | Alexander Larsson <alexl@redhat.com> | 2011-01-06 23:36:44 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2011-01-19 19:52:51 +0100 |
commit | 07db0e38b0a50dfc94bf7b4f1a9c49fa68ee19b2 (patch) | |
tree | 1472a2d4ecb1f6e0670e9f3da4ea6051f61fd9f9 | |
parent | 920e8b434367f9aa8aab306721cc024e66892e2e (diff) | |
download | gtk+-07db0e38b0a50dfc94bf7b4f1a9c49fa68ee19b2.tar.gz |
[broadway] Make broadway build with new gdk-backend setup
Convert all global functions to vtable calls, etc.
31 files changed, 1735 insertions, 1492 deletions
diff --git a/Makefile.am b/Makefile.am index 382837057f..df52bcc6b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,11 +55,11 @@ MAINTAINERCLEANFILES = \ ## Copy .pc files to target-specific names -gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc: gtk+-3.0.pc +gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc: gtk+-3.0.pc rm -f $@ && \ cp gtk+-3.0.pc $@ -gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc: gdk-3.0.pc +gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc: gdk-3.0.pc rm -f $@ && \ cp gdk-3.0.pc $@ diff --git a/configure.ac b/configure.ac index ad0b8c3904..bac94f563f 100644 --- a/configure.ac +++ b/configure.ac @@ -352,6 +352,7 @@ fi if test "x$enable_broadway_backend" == xyes; then GDK_BACKENDS="$GDK_BACKENDS broadway" + cairo_backends="$cairo_backends cairo" GDK_WINDOWING="$GDK_WINDOWING #define GDK_WINDOWING_BROADWAY" GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz" diff --git a/gdk/broadway/Makefile.am b/gdk/broadway/Makefile.am index e1afcdfdc7..bcdb1416df 100644 --- a/gdk/broadway/Makefile.am +++ b/gdk/broadway/Makefile.am @@ -37,6 +37,7 @@ broadway_built_sources = \ libgdk_broadway_la_SOURCES = \ ${broadway_built_private_headers}\ gdkapplaunchcontext-broadway.c \ + gdkbroadwaydisplaymanager.h \ gdkcursor-broadway.c \ gdkdevice-broadway.h \ gdkdevice-broadway.c \ @@ -44,6 +45,7 @@ libgdk_broadway_la_SOURCES = \ gdkdevicemanager-broadway.c \ gdkdisplay-broadway.c \ gdkdisplay-broadway.h \ + gdkdisplaymanager-broadway.c \ gdkdnd-broadway.c \ gdkeventsource.c \ gdkeventsource.h \ @@ -56,7 +58,6 @@ libgdk_broadway_la_SOURCES = \ gdkscreen-broadway.c \ gdkscreen-broadway.h \ gdkselection-broadway.c \ - gdkspawn-broadway.c \ gdktestutils-broadway.c \ gdkvisual-broadway.c \ gdkwindow-broadway.c \ diff --git a/gdk/broadway/gdkapplaunchcontext-broadway.c b/gdk/broadway/gdkapplaunchcontext-broadway.c index 23e311f4ed..911c4cf6f2 100644 --- a/gdk/broadway/gdkapplaunchcontext-broadway.c +++ b/gdk/broadway/gdkapplaunchcontext-broadway.c @@ -29,7 +29,6 @@ #include "gdkintl.h" #include <glib.h> -#include <gio/gdesktopappinfo.h> #include <string.h> #include <unistd.h> diff --git a/gdk/broadway/gdkbroadwaycursor.h b/gdk/broadway/gdkbroadwaycursor.h new file mode 100644 index 0000000000..36afb5eea5 --- /dev/null +++ b/gdk/broadway/gdkbroadwaycursor.h @@ -0,0 +1,56 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * 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. + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if !defined (__GDKX_H_INSIDE__) && !defined (GDK_COMPILATION) +#error "Only <gdk/gdkx.h> can be included directly." +#endif + +#ifndef __GDK_BROADWAY_CURSOR_H__ +#define __GDK_BROADWAY_CURSOR_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS + +#define GDK_TYPE_BROADWAY_CURSOR (gdk_broadway_cursor_get_type ()) +#define GDK_BROADWAY_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_CURSOR, GdkBroadwayCursor)) +#define GDK_BROADWAY_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_CURSOR, GdkBroadwayCursorClass)) +#define GDK_IS_BROADWAY_CURSOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_CURSOR)) +#define GDK_IS_BROADWAY_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_CURSOR)) +#define GDK_BROADWAY_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_CURSOR, GdkBroadwayCursorClass)) + +#ifdef GDK_COMPILATION +typedef struct _GdkBroadwayCursor GdkBroadwayCursor; +#else +typedef GdkCursor GdkBroadwayCursor; +#endif +typedef struct _GdkBroadwayCursorClass GdkBroadwayCursorClass; + +GType gdk_broadway_cursor_get_type (void); + +G_END_DECLS + +#endif /* __GDK_BROADWAY_CURSOR_H__ */ diff --git a/gdk/broadway/gdkbroadwaydisplaymanager.h b/gdk/broadway/gdkbroadwaydisplaymanager.h new file mode 100644 index 0000000000..df47ccd832 --- /dev/null +++ b/gdk/broadway/gdkbroadwaydisplaymanager.h @@ -0,0 +1,47 @@ +/* gdkbroadwaydisplaymanager.h + * + * Copyright (C) 2005-2007 Imendio AB + * Copyright 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. + */ + +#if !defined(__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION) +#error "Only <gdk/gdkbroadway.h> can be included directly." +#endif + +#ifndef __GDK_BROADWAY_DISPLAY_MANAGER_H__ +#define __GDK_BROADWAY_DISPLAY_MANAGER_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS + +#define GDK_TYPE_BROADWAY_DISPLAY_MANAGER (gdk_broadway_display_manager_get_type ()) +#define GDK_BROADWAY_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DISPLAY_MANAGER, GdkBroadwayDisplayManager)) + +#ifdef GDK_COMPILATION +typedef struct _GdkBroadwayDisplayManager GdkBroadwayDisplayManager; +#else +typedef GdkDisplayManager _GdkBroadwayDisplayManager; +#endif +typedef struct _GdkDisplayManagerClass GdkBroadwayDisplayManagerClass; + +GType gdk_broadway_display_manager_get_type (void); + +G_END_DECLS + +#endif /* __GDK_BROADWAY_DISPLAY_MANAGER_H__ */ diff --git a/gdk/broadway/gdkbroadwayvisual.h b/gdk/broadway/gdkbroadwayvisual.h new file mode 100644 index 0000000000..4890b82f75 --- /dev/null +++ b/gdk/broadway/gdkbroadwayvisual.h @@ -0,0 +1,47 @@ +/* gdkbroadwayvisual.h + * + * Copyright (C) 2011 Alexander Larsson <alexl@redhat.com> + * + * 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_BROADWAY_VISUAL_H__ +#define __GDK_BROADWAY_VISUAL_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS + +#define GDK_TYPE_BROADWAY_VISUAL (gdk_broadway_visual_get_type ()) +#define GDK_BROADWAY_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_VISUAL, GdkBroadwayVisual)) +#define GDK_BROADWAY_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_VISUAL, GdkBroadwayVisualClass)) +#define GDK_IS_BROADWAY_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_VISUAL)) +#define GDK_IS_BROADWAY_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_VISUAL)) +#define GDK_BROADWAY_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_VISUAL, GdkBroadwayVisualClass)) + +#ifdef GDK_COMPILATION +typedef struct _GdkBroadwayVisual GdkBroadwayVisual; +#else +typedef GdkVisual GdkBroadwayVisual; +#endif +typedef struct _GdkBroadwayVisualClass GdkBroadwayVisualClass; + + +GType gdk_broadway_visual_get_type (void); + +G_END_DECLS + +#endif /* __GDK_BROADWAY_VISUAL_H__ */ diff --git a/gdk/broadway/gdkbroadwaywindow.h b/gdk/broadway/gdkbroadwaywindow.h new file mode 100644 index 0000000000..7bb72991ed --- /dev/null +++ b/gdk/broadway/gdkbroadwaywindow.h @@ -0,0 +1,52 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * 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. + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GDK_BROADWAY_WINDOW_H__ +#define __GDK_BROADWAY_WINDOW_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS + +#define GDK_TYPE_BROADWAY_WINDOW (gdk_broadway_window_get_type ()) +#define GDK_BROADWAY_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindow)) +#define GDK_BROADWAY_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindowClass)) +#define GDK_IS_BROADWAY_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_WINDOW)) +#define GDK_IS_BROADWAY_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_WINDOW)) +#define GDK_BROADWAY_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindowClass)) + +#ifdef GDK_COMPILATION +typedef struct _GdkBroadwayWindow GdkBroadwayWindow; +#else +typedef GdkWindow GdkBroadwayWindow; +#endif +typedef struct _GdkBroadwayWindowClass GdkBroadwayWindowClass; + +GType gdk_broadway_window_get_type (void); + +G_END_DECLS + +#endif /* __GDK_BROADWAY_WINDOW_H__ */ diff --git a/gdk/broadway/gdkcursor-broadway.c b/gdk/broadway/gdkcursor-broadway.c index 0699db7b11..3e947de29b 100644 --- a/gdk/broadway/gdkcursor-broadway.c +++ b/gdk/broadway/gdkcursor-broadway.c @@ -31,6 +31,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include "gdkcursor.h" +#include "gdkcursorprivate.h" #include "gdkprivate-broadway.h" #include "gdkdisplay-broadway.h" @@ -38,69 +39,70 @@ #include <string.h> #include <errno.h> - -/* Called by gdk_display_broadway_finalize to flush any cached cursors - * for a dead display. - */ -void -_gdk_broadway_cursor_display_finalize (GdkDisplay *display) +struct _GdkBroadwayCursor { -} + GdkCursor cursor; +}; -GdkCursor* -gdk_cursor_new_for_display (GdkDisplay *display, - GdkCursorType cursor_type) +struct _GdkBroadwayCursorClass { - GdkCursorPrivate *private; - GdkCursor *cursor; + GdkCursorClass cursor_class; +}; - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); +/*** GdkBroadwayCursor ***/ - private = g_new (GdkCursorPrivate, 1); - private->display = display; +G_DEFINE_TYPE (GdkBroadwayCursor, gdk_broadway_cursor, GDK_TYPE_CURSOR) - cursor = (GdkCursor *) private; - cursor->type = cursor_type; - cursor->ref_count = 1; +static GdkPixbuf* gdk_broadway_cursor_get_image (GdkCursor *cursor); - return cursor; +static void +gdk_broadway_cursor_finalize (GObject *object) +{ + G_OBJECT_CLASS (gdk_broadway_cursor_parent_class)->finalize (object); } -void -_gdk_cursor_destroy (GdkCursor *cursor) +static void +gdk_broadway_cursor_class_init (GdkBroadwayCursorClass *xcursor_class) { - GdkCursorPrivate *private; + GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class); + GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class); - g_return_if_fail (cursor != NULL); - g_return_if_fail (cursor->ref_count == 0); - - private = (GdkCursorPrivate *) cursor; + object_class->finalize = gdk_broadway_cursor_finalize; - g_free (private); + cursor_class->get_image = gdk_broadway_cursor_get_image; } +static void +gdk_broadway_cursor_init (GdkBroadwayCursor *cursor) +{ +} -/** - * gdk_cursor_get_display: - * @cursor: a #GdkCursor. - * - * Returns the display on which the #GdkCursor is defined. - * - * Returns: the #GdkDisplay associated to @cursor - * - * Since: 2.2 +/* Called by gdk_display_broadway_finalize to flush any cached cursors + * for a dead display. */ +void +_gdk_broadway_cursor_display_finalize (GdkDisplay *display) +{ +} -GdkDisplay * -gdk_cursor_get_display (GdkCursor *cursor) +GdkCursor* +_gdk_broadway_display_get_cursor_for_type (GdkDisplay *display, + GdkCursorType cursor_type) { - g_return_val_if_fail (cursor != NULL, NULL); + GdkBroadwayCursor *private; + + g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return ((GdkCursorPrivate *)cursor)->display; + private = g_object_new (GDK_TYPE_BROADWAY_CURSOR, + "cursor-type", cursor_type, + "display", display, + NULL); + + return GDK_CURSOR (private); } -GdkPixbuf* -gdk_cursor_get_image (GdkCursor *cursor) +static GdkPixbuf* +gdk_broadway_cursor_get_image (GdkCursor *cursor) { g_return_val_if_fail (cursor != NULL, NULL); @@ -114,48 +116,39 @@ _gdk_broadway_cursor_update_theme (GdkCursor *cursor) } GdkCursor * -gdk_cursor_new_from_pixbuf (GdkDisplay *display, - GdkPixbuf *pixbuf, - gint x, - gint y) +_gdk_broadway_display_get_cursor_for_pixbuf (GdkDisplay *display, + GdkPixbuf *pixbuf, + gint x, + gint y) { - GdkCursorPrivate *private; + GdkBroadwayCursor *private; GdkCursor *cursor; - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); - - private = g_new (GdkCursorPrivate, 1); - private->display = display; - + private = g_object_new (GDK_TYPE_BROADWAY_CURSOR, + "cursor-type", GDK_CURSOR_IS_PIXMAP, + "display", display, + NULL); cursor = (GdkCursor *) private; - cursor->type = GDK_CURSOR_IS_PIXMAP; - cursor->ref_count = 1; return cursor; } GdkCursor* -gdk_cursor_new_from_name (GdkDisplay *display, - const gchar *name) +_gdk_broadway_display_get_cursor_for_name (GdkDisplay *display, + const gchar *name) { - GdkCursorPrivate *private; - GdkCursor *cursor; + GdkBroadwayCursor *private; - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - - private = g_new (GdkCursorPrivate, 1); - private->display = display; + private = g_object_new (GDK_TYPE_BROADWAY_CURSOR, + "cursor-type", GDK_CURSOR_IS_PIXMAP, + "display", display, + NULL); - cursor = (GdkCursor *) private; - cursor->type = GDK_CURSOR_IS_PIXMAP; - cursor->ref_count = 1; - - return cursor; + return GDK_CURSOR (private); } gboolean -gdk_display_supports_cursor_alpha (GdkDisplay *display) +_gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); @@ -163,25 +156,27 @@ gdk_display_supports_cursor_alpha (GdkDisplay *display) } gboolean -gdk_display_supports_cursor_color (GdkDisplay *display) +_gdk_broadway_display_supports_cursor_color (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); return TRUE; } -guint -gdk_display_get_default_cursor_size (GdkDisplay *display) +void +_gdk_broadway_display_get_default_cursor_size (GdkDisplay *display, + guint *width, + guint *height) { - g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); + g_return_if_fail (GDK_IS_DISPLAY (display)); - return 20; + *width = *height = 20; } void -gdk_display_get_maximal_cursor_size (GdkDisplay *display, - guint *width, - guint *height) +_gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display, + guint *width, + guint *height) { g_return_if_fail (GDK_IS_DISPLAY (display)); diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c index 17c690189b..a3dcab0bab 100644 --- a/gdk/broadway/gdkdevice-broadway.c +++ b/gdk/broadway/gdkdevice-broadway.c @@ -24,71 +24,71 @@ #include "gdkwindow.h" #include "gdkprivate-broadway.h" -static gboolean gdk_device_core_get_history (GdkDevice *device, - GdkWindow *window, - guint32 start, - guint32 stop, - GdkTimeCoord ***events, - gint *n_events); -static void gdk_device_core_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask); -static void gdk_device_core_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor); -static void gdk_device_core_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y); -static gboolean gdk_device_core_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **root_window, - GdkWindow **child_window, - gint *root_x, - gint *root_y, - gint *win_x, - gint *win_y, - GdkModifierType *mask); -static GdkGrabStatus gdk_device_core_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_); -static void gdk_device_core_ungrab (GdkDevice *device, - guint32 time_); -static GdkWindow * gdk_device_core_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel); -static void gdk_device_core_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask event_mask); - - -G_DEFINE_TYPE (GdkDeviceCore, gdk_device_core, GDK_TYPE_DEVICE) +static gboolean gdk_broadway_device_get_history (GdkDevice *device, + GdkWindow *window, + guint32 start, + guint32 stop, + GdkTimeCoord ***events, + gint *n_events); +static void gdk_broadway_device_get_state (GdkDevice *device, + GdkWindow *window, + gdouble *axes, + GdkModifierType *mask); +static void gdk_broadway_device_set_window_cursor (GdkDevice *device, + GdkWindow *window, + GdkCursor *cursor); +static void gdk_broadway_device_warp (GdkDevice *device, + GdkScreen *screen, + gint x, + gint y); +static gboolean gdk_broadway_device_query_state (GdkDevice *device, + GdkWindow *window, + GdkWindow **root_window, + GdkWindow **child_window, + gint *root_x, + gint *root_y, + gint *win_x, + gint *win_y, + GdkModifierType *mask); +static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device, + GdkWindow *window, + gboolean owner_events, + GdkEventMask event_mask, + GdkWindow *confine_to, + GdkCursor *cursor, + guint32 time_); +static void gdk_broadway_device_ungrab (GdkDevice *device, + guint32 time_); +static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice *device, + gint *win_x, + gint *win_y, + GdkModifierType *mask, + gboolean get_toplevel); +static void gdk_broadway_device_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask event_mask); + + +G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE) static void -gdk_device_core_class_init (GdkDeviceCoreClass *klass) +gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass) { GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass); - device_class->get_history = gdk_device_core_get_history; - device_class->get_state = gdk_device_core_get_state; - device_class->set_window_cursor = gdk_device_core_set_window_cursor; - device_class->warp = gdk_device_core_warp; - device_class->query_state = gdk_device_core_query_state; - device_class->grab = gdk_device_core_grab; - device_class->ungrab = gdk_device_core_ungrab; - device_class->window_at_position = gdk_device_core_window_at_position; - device_class->select_window_events = gdk_device_core_select_window_events; + device_class->get_history = gdk_broadway_device_get_history; + device_class->get_state = gdk_broadway_device_get_state; + device_class->set_window_cursor = gdk_broadway_device_set_window_cursor; + device_class->warp = gdk_broadway_device_warp; + device_class->query_state = gdk_broadway_device_query_state; + device_class->grab = gdk_broadway_device_grab; + device_class->ungrab = gdk_broadway_device_ungrab; + device_class->window_at_position = gdk_broadway_device_window_at_position; + device_class->select_window_events = gdk_broadway_device_select_window_events; } static void -gdk_device_core_init (GdkDeviceCore *device_core) +gdk_broadway_device_init (GdkBroadwayDevice *device_core) { GdkDevice *device; @@ -99,21 +99,21 @@ gdk_device_core_init (GdkDeviceCore *device_core) } static gboolean -gdk_device_core_get_history (GdkDevice *device, - GdkWindow *window, - guint32 start, - guint32 stop, - GdkTimeCoord ***events, - gint *n_events) +gdk_broadway_device_get_history (GdkDevice *device, + GdkWindow *window, + guint32 start, + guint32 stop, + GdkTimeCoord ***events, + gint *n_events) { return FALSE; } static void -gdk_device_core_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask) +gdk_broadway_device_get_state (GdkDevice *device, + GdkWindow *window, + gdouble *axes, + GdkModifierType *mask) { gint x_int, y_int; @@ -127,65 +127,65 @@ gdk_device_core_get_state (GdkDevice *device, } static void -gdk_device_core_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor) +gdk_broadway_device_set_window_cursor (GdkDevice *device, + GdkWindow *window, + GdkCursor *cursor) { } static void -gdk_device_core_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y) +gdk_broadway_device_warp (GdkDevice *device, + GdkScreen *screen, + gint x, + gint y) { } static gboolean -gdk_device_core_query_state (GdkDevice *device, - GdkWindow *window, - GdkWindow **root_window, - GdkWindow **child_window, - gint *root_x, - gint *root_y, - gint *win_x, - gint *win_y, - GdkModifierType *mask) +gdk_broadway_device_query_state (GdkDevice *device, + GdkWindow *window, + GdkWindow **root_window, + GdkWindow **child_window, + gint *root_x, + gint *root_y, + gint *win_x, + gint *win_y, + GdkModifierType *mask) { return FALSE; } static GdkGrabStatus -gdk_device_core_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_) +gdk_broadway_device_grab (GdkDevice *device, + GdkWindow *window, + gboolean owner_events, + GdkEventMask event_mask, + GdkWindow *confine_to, + GdkCursor *cursor, + guint32 time_) { return GDK_GRAB_NOT_VIEWABLE; } static void -gdk_device_core_ungrab (GdkDevice *device, - guint32 time_) +gdk_broadway_device_ungrab (GdkDevice *device, + guint32 time_) { } static GdkWindow * -gdk_device_core_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel) +gdk_broadway_device_window_at_position (GdkDevice *device, + gint *win_x, + gint *win_y, + GdkModifierType *mask, + gboolean get_toplevel) { return NULL; } static void -gdk_device_core_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask event_mask) +gdk_broadway_device_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask event_mask) { } diff --git a/gdk/broadway/gdkdevice-broadway.h b/gdk/broadway/gdkdevice-broadway.h index 9ff65c96ff..6ae48d3c85 100644 --- a/gdk/broadway/gdkdevice-broadway.h +++ b/gdk/broadway/gdkdevice-broadway.h @@ -24,28 +24,28 @@ G_BEGIN_DECLS -#define GDK_TYPE_DEVICE_CORE (gdk_device_core_get_type ()) -#define GDK_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_CORE, GdkDeviceCore)) -#define GDK_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_CORE, GdkDeviceCoreClass)) -#define GDK_IS_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_CORE)) -#define GDK_IS_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_CORE)) -#define GDK_DEVICE_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_CORE, GdkDeviceCoreClass)) +#define GDK_TYPE_BROADWAY_DEVICE (gdk_broadway_device_get_type ()) +#define GDK_BROADWAY_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_BROADWAY_DEVICE, GdkBroadwayDevice)) +#define GDK_BROADWAY_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_BROADWAY_DEVICE, GdkBroadwayDeviceClass)) +#define GDK_IS_BROADWAY_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_BROADWAY_DEVICE)) +#define GDK_IS_BROADWAY_DEVICE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_BROADWAY_DEVICE)) +#define GDK_BROADWAY_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_BROADWAY_DEVICE, GdkBroadwayDeviceClass)) -typedef struct _GdkDeviceCore GdkDeviceCore; -typedef struct _GdkDeviceCoreClass GdkDeviceCoreClass; +typedef struct _GdkBroadwayDevice GdkBroadwayDevice; +typedef struct _GdkBroadwayDeviceClass GdkBroadwayDeviceClass; -struct _GdkDeviceCore +struct _GdkBroadwayDevice { GdkDevice parent_instance; }; -struct _GdkDeviceCoreClass +struct _GdkBroadwayDeviceClass { GdkDeviceClass parent_class; }; G_GNUC_INTERNAL -GType gdk_device_core_get_type (void) G_GNUC_CONST; +GType gdk_broadway_device_get_type (void) G_GNUC_CONST; G_END_DECLS diff --git a/gdk/broadway/gdkdevicemanager-broadway.c b/gdk/broadway/gdkdevicemanager-broadway.c index 42dd200d61..27f37a4f55 100644 --- a/gdk/broadway/gdkdevicemanager-broadway.c +++ b/gdk/broadway/gdkdevicemanager-broadway.c @@ -30,32 +30,32 @@ #define HAS_FOCUS(toplevel) \ ((toplevel)->has_focus || (toplevel)->has_pointer_focus) -static void gdk_device_manager_core_finalize (GObject *object); -static void gdk_device_manager_core_constructed (GObject *object); +static void gdk_broadway_device_manager_finalize (GObject *object); +static void gdk_broadway_device_manager_constructed (GObject *object); -static GList * gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type); -static GdkDevice * gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager); +static GList * gdk_broadway_device_manager_list_devices (GdkDeviceManager *device_manager, + GdkDeviceType type); +static GdkDevice * gdk_broadway_device_manager_get_client_pointer (GdkDeviceManager *device_manager); -G_DEFINE_TYPE (GdkDeviceManagerCore, gdk_device_manager_core, GDK_TYPE_DEVICE_MANAGER) +G_DEFINE_TYPE (GdkBroadwayDeviceManager, gdk_broadway_device_manager, GDK_TYPE_DEVICE_MANAGER) static void -gdk_device_manager_core_class_init (GdkDeviceManagerCoreClass *klass) +gdk_broadway_device_manager_class_init (GdkBroadwayDeviceManagerClass *klass) { GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = gdk_device_manager_core_finalize; - object_class->constructed = gdk_device_manager_core_constructed; - device_manager_class->list_devices = gdk_device_manager_core_list_devices; - device_manager_class->get_client_pointer = gdk_device_manager_core_get_client_pointer; + object_class->finalize = gdk_broadway_device_manager_finalize; + object_class->constructed = gdk_broadway_device_manager_constructed; + device_manager_class->list_devices = gdk_broadway_device_manager_list_devices; + device_manager_class->get_client_pointer = gdk_broadway_device_manager_get_client_pointer; } static GdkDevice * create_core_pointer (GdkDeviceManager *device_manager, GdkDisplay *display) { - return g_object_new (GDK_TYPE_DEVICE_CORE, + return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Core Pointer", "type", GDK_DEVICE_TYPE_MASTER, "input-source", GDK_SOURCE_MOUSE, @@ -70,7 +70,7 @@ static GdkDevice * create_core_keyboard (GdkDeviceManager *device_manager, GdkDisplay *display) { - return g_object_new (GDK_TYPE_DEVICE_CORE, + return g_object_new (GDK_TYPE_BROADWAY_DEVICE, "name", "Core Keyboard", "type", GDK_DEVICE_TYPE_MASTER, "input-source", GDK_SOURCE_KEYBOARD, @@ -82,30 +82,30 @@ create_core_keyboard (GdkDeviceManager *device_manager, } static void -gdk_device_manager_core_init (GdkDeviceManagerCore *device_manager) +gdk_broadway_device_manager_init (GdkBroadwayDeviceManager *device_manager) { } static void -gdk_device_manager_core_finalize (GObject *object) +gdk_broadway_device_manager_finalize (GObject *object) { - GdkDeviceManagerCore *device_manager_core; + GdkBroadwayDeviceManager *device_manager; - device_manager_core = GDK_DEVICE_MANAGER_CORE (object); + device_manager = GDK_BROADWAY_DEVICE_MANAGER (object); - g_object_unref (device_manager_core->core_pointer); - g_object_unref (device_manager_core->core_keyboard); + g_object_unref (device_manager->core_pointer); + g_object_unref (device_manager->core_keyboard); - G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_broadway_device_manager_parent_class)->finalize (object); } static void -gdk_device_manager_core_constructed (GObject *object) +gdk_broadway_device_manager_constructed (GObject *object) { - GdkDeviceManagerCore *device_manager; + GdkBroadwayDeviceManager *device_manager; GdkDisplay *display; - device_manager = GDK_DEVICE_MANAGER_CORE (object); + device_manager = GDK_BROADWAY_DEVICE_MANAGER (object); display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)); device_manager->core_pointer = create_core_pointer (GDK_DEVICE_MANAGER (device_manager), display); device_manager->core_keyboard = create_core_keyboard (GDK_DEVICE_MANAGER (device_manager), display); @@ -116,35 +116,33 @@ gdk_device_manager_core_constructed (GObject *object) static GList * -gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type) +gdk_broadway_device_manager_list_devices (GdkDeviceManager *device_manager, + GdkDeviceType type) { - GdkDeviceManagerCore *device_manager_core; + GdkBroadwayDeviceManager *broadway_device_manager = (GdkBroadwayDeviceManager *) device_manager; GList *devices = NULL; if (type == GDK_DEVICE_TYPE_MASTER) { - device_manager_core = (GdkDeviceManagerCore *) device_manager; - devices = g_list_prepend (devices, device_manager_core->core_keyboard); - devices = g_list_prepend (devices, device_manager_core->core_pointer); + devices = g_list_prepend (devices, broadway_device_manager->core_keyboard); + devices = g_list_prepend (devices, broadway_device_manager->core_pointer); } return devices; } static GdkDevice * -gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager) +gdk_broadway_device_manager_get_client_pointer (GdkDeviceManager *device_manager) { - GdkDeviceManagerCore *device_manager_core; + GdkBroadwayDeviceManager *broadway_device_manager = (GdkBroadwayDeviceManager *) device_manager; - device_manager_core = (GdkDeviceManagerCore *) device_manager; - return device_manager_core->core_pointer; + return broadway_device_manager->core_pointer; } GdkDeviceManager * -_gdk_device_manager_new (GdkDisplay *display) +_gdk_broadway_device_manager_new (GdkDisplay *display) { - return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE, + return g_object_new (GDK_TYPE_BROADWAY_DEVICE_MANAGER, "display", display, NULL); } diff --git a/gdk/broadway/gdkdevicemanager-broadway.h b/gdk/broadway/gdkdevicemanager-broadway.h index 50ea91d34d..be584e31f8 100644 --- a/gdk/broadway/gdkdevicemanager-broadway.h +++ b/gdk/broadway/gdkdevicemanager-broadway.h @@ -20,34 +20,34 @@ #ifndef __GDK_DEVICE_MANAGER_BROADWAY_H__ #define __GDK_DEVICE_MANAGER_BROADWAY_H__ -#include <gdk/gdkdevicemanager.h> +#include <gdk/gdkdevicemanagerprivate.h> G_BEGIN_DECLS -#define GDK_TYPE_DEVICE_MANAGER_CORE (gdk_device_manager_core_get_type ()) -#define GDK_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCore)) -#define GDK_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass)) -#define GDK_IS_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER_CORE)) -#define GDK_IS_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER_CORE)) -#define GDK_DEVICE_MANAGER_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass)) +#define GDK_TYPE_BROADWAY_DEVICE_MANAGER (gdk_broadway_device_manager_get_type ()) +#define GDK_BROADWAY_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_BROADWAY_DEVICE_MANAGER, GdkBroadwayDeviceManager)) +#define GDK_BROADWAY_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_BROADWAY_DEVICE_MANAGER, GdkBroadwayDeviceManagerClass)) +#define GDK_IS_BROADWAY_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_BROADWAY_DEVICE_MANAGER)) +#define GDK_IS_BROADWAY_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_BROADWAY_DEVICE_MANAGER)) +#define GDK_BROADWAY_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_BROADWAY_DEVICE_MANAGER, GdkBroadwayDeviceManagerClass)) -typedef struct _GdkDeviceManagerCore GdkDeviceManagerCore; -typedef struct _GdkDeviceManagerCoreClass GdkDeviceManagerCoreClass; +typedef struct _GdkBroadwayDeviceManager GdkBroadwayDeviceManager; +typedef struct _GdkBroadwayDeviceManagerClass GdkBroadwayDeviceManagerClass; -struct _GdkDeviceManagerCore +struct _GdkBroadwayDeviceManager { GdkDeviceManager parent_object; GdkDevice *core_pointer; GdkDevice *core_keyboard; }; -struct _GdkDeviceManagerCoreClass +struct _GdkBroadwayDeviceManagerClass { GdkDeviceManagerClass parent_class; }; -GType gdk_device_manager_core_get_type (void) G_GNUC_CONST; - +GType gdk_broadway_device_manager_get_type (void) G_GNUC_CONST; +GdkDeviceManager *_gdk_broadway_device_manager_new (GdkDisplay *display); G_END_DECLS diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index d7f6d5d82d..c71118ea42 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -32,7 +32,7 @@ #include "gdkscreen-broadway.h" #include "gdkinternals.h" #include "gdkdeviceprivate.h" -#include "gdkdevicemanager.h" +#include "gdkdevicemanager-broadway.h" #include <glib.h> #include <glib/gprintf.h> @@ -41,45 +41,37 @@ #include <errno.h> #include <unistd.h> -static void gdk_display_broadway_dispose (GObject *object); -static void gdk_display_broadway_finalize (GObject *object); +static void gdk_broadway_display_dispose (GObject *object); +static void gdk_broadway_display_finalize (GObject *object); -G_DEFINE_TYPE (GdkDisplayBroadway, _gdk_display_broadway, GDK_TYPE_DISPLAY) - - -static void -_gdk_display_broadway_class_init (GdkDisplayBroadwayClass * class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - - object_class->dispose = gdk_display_broadway_dispose; - object_class->finalize = gdk_display_broadway_finalize; -} +G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY) static void -_gdk_display_broadway_init (GdkDisplayBroadway *display) +gdk_broadway_display_init (GdkBroadwayDisplay *display) { + _gdk_broadway_display_manager_add_display (gdk_display_manager_get (), + GDK_DISPLAY_OBJECT (display)); display->id_ht = g_hash_table_new (NULL, NULL); } static void -_gdk_event_init (GdkDisplay *display) +gdk_event_init (GdkDisplay *display) { - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; - display_broadway = GDK_DISPLAY_BROADWAY (display); - display_broadway->event_source = gdk_event_source_new (display); + broadway_display = GDK_BROADWAY_DISPLAY (display); + broadway_display->event_source = _gdk_broadway_event_source_new (display); } static void -_gdk_input_init (GdkDisplay *display) +gdk_broadway_display_init_input (GdkDisplay *display) { - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; GdkDeviceManager *device_manager; GdkDevice *device; GList *list, *l; - display_broadway = GDK_DISPLAY_BROADWAY (display); + broadway_display = GDK_BROADWAY_DISPLAY (display); device_manager = gdk_display_get_device_manager (display); /* For backwards compatibility, just add @@ -94,7 +86,7 @@ _gdk_input_init (GdkDisplay *display) if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) continue; - display_broadway->input_devices = g_list_prepend (display_broadway->input_devices, + broadway_display->input_devices = g_list_prepend (broadway_display->input_devices, g_object_ref (l->data)); } @@ -117,7 +109,7 @@ _gdk_input_init (GdkDisplay *display) } /* Add the core pointer to the devices list */ - display_broadway->input_devices = g_list_prepend (display_broadway->input_devices, + broadway_display->input_devices = g_list_prepend (broadway_display->input_devices, g_object_ref (display->core_pointer)); g_list_free (list); @@ -184,13 +176,13 @@ got_input (GInputStream *stream, message = g_data_input_stream_read_upto_finish (G_DATA_INPUT_STREAM (stream), result, &len, &error); if (message == NULL) { - GDK_DISPLAY_BROADWAY (request->display)->input = NULL; + GDK_BROADWAY_DISPLAY (request->display)->input = NULL; http_request_free (request); return; } g_assert (message[0] == 0); - _gdk_events_got_input (request->display, message + 1); + _gdk_broadway_events_got_input (request->display, message + 1); /* Skip past ending 0xff */ g_data_input_stream_read_byte (request->data, NULL, NULL); @@ -232,11 +224,11 @@ start_input (HttpRequest *request) gsize len; GChecksum *checksum; char *origin, *host; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; - display_broadway = GDK_DISPLAY_BROADWAY (request->display); + broadway_display = GDK_BROADWAY_DISPLAY (request->display); - if (display_broadway->input != NULL) + if (broadway_display->input != NULL) { send_error (request, 409, "Input already handled"); return; @@ -337,7 +329,7 @@ start_input (HttpRequest *request) g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)), challenge, 16, NULL, NULL, NULL); - display_broadway->input = request; + broadway_display->input = request; g_data_input_stream_read_upto_async (request->data, "\xff", 1, 0, NULL, (GAsyncReadyCallback)got_input, request); @@ -349,16 +341,16 @@ static void start_output (HttpRequest *request) { GSocket *socket; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; int fd; socket = g_socket_connection_get_socket (request->connection); - display_broadway = GDK_DISPLAY_BROADWAY (request->display); + broadway_display = GDK_BROADWAY_DISPLAY (request->display); fd = g_socket_get_fd (socket); set_fd_blocking (fd); /* We dup this because otherwise it'll be closed with the request SocketConnection */ - display_broadway->output = broadway_output_new (dup(fd)); + broadway_display->output = broadway_output_new (dup(fd)); _gdk_broadway_resync_windows (); http_request_free (request); } @@ -488,45 +480,40 @@ handle_incoming_connection (GSocketService *service, } GdkDisplay * -gdk_display_open (const gchar *display_name) +_gdk_broadway_display_open (const gchar *display_name) { GdkDisplay *display; - GdkDisplayBroadway *display_broadway; - const char *sm_client_id; + GdkBroadwayDisplay *broadway_display; GError *error; - display = g_object_new (GDK_TYPE_DISPLAY_BROADWAY, NULL); - display_broadway = GDK_DISPLAY_BROADWAY (display); + display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL); + broadway_display = GDK_BROADWAY_DISPLAY (display); - display_broadway->output = NULL; + broadway_display->output = NULL; /* initialize the display's screens */ - display_broadway->screens = g_new (GdkScreen *, 1); - display_broadway->screens[0] = _gdk_broadway_screen_new (display, 0); + broadway_display->screens = g_new (GdkScreen *, 1); + broadway_display->screens[0] = _gdk_broadway_screen_new (display, 0); /* We need to initialize events after we have the screen * structures in places */ - _gdk_screen_broadway_events_init (display_broadway->screens[0]); + _gdk_broadway_screen_events_init (broadway_display->screens[0]); /*set the default screen */ - display_broadway->default_screen = display_broadway->screens[0]; + broadway_display->default_screen = broadway_display->screens[0]; - display->device_manager = _gdk_device_manager_new (display); + display->device_manager = _gdk_broadway_device_manager_new (display); - _gdk_event_init (display); + gdk_event_init (display); - sm_client_id = _gdk_get_sm_client_id (); - if (sm_client_id) - _gdk_windowing_display_set_sm_client_id (display, sm_client_id); + gdk_broadway_display_init_input (display); + _gdk_broadway_display_init_dnd (display); - _gdk_input_init (display); - _gdk_dnd_init (display); + _gdk_broadway_screen_setup (broadway_display->screens[0]); - _gdk_broadway_screen_setup (display_broadway->screens[0]); - - display_broadway->service = g_socket_service_new (); - if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (display_broadway->service), + broadway_display->service = g_socket_service_new (); + if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (broadway_display->service), 8080, G_OBJECT (display), &error)) @@ -535,7 +522,7 @@ gdk_display_open (const gchar *display_name) g_error_free (error); return NULL; } - g_signal_connect (display_broadway->service, "incoming", G_CALLBACK (handle_incoming_connection), NULL); + g_signal_connect (broadway_display->service, "incoming", G_CALLBACK (handle_incoming_connection), NULL); g_signal_emit_by_name (display, "opened"); g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display); @@ -544,68 +531,68 @@ gdk_display_open (const gchar *display_name) } -G_CONST_RETURN gchar * -gdk_display_get_name (GdkDisplay *display) +static G_CONST_RETURN gchar * +gdk_broadway_display_get_name (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); return (gchar *) "Broadway"; } -gint -gdk_display_get_n_screens (GdkDisplay *display) +static gint +gdk_broadway_display_get_n_screens (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); return 1; } -GdkScreen * -gdk_display_get_screen (GdkDisplay *display, - gint screen_num) +static GdkScreen * +gdk_broadway_display_get_screen (GdkDisplay *display, + gint screen_num) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); g_return_val_if_fail (screen_num == 0, NULL); - return GDK_DISPLAY_BROADWAY (display)->screens[screen_num]; + return GDK_BROADWAY_DISPLAY (display)->screens[screen_num]; } -GdkScreen * -gdk_display_get_default_screen (GdkDisplay *display) +static GdkScreen * +gdk_broadway_display_get_default_screen (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_DISPLAY_BROADWAY (display)->default_screen; + return GDK_BROADWAY_DISPLAY (display)->default_screen; } -void -gdk_device_ungrab (GdkDevice *device, - guint32 time_) +static void +gdk_broadway_display_beep (GdkDisplay *display) { + g_return_if_fail (GDK_IS_DISPLAY (display)); } -void -gdk_display_beep (GdkDisplay *display) +static void +gdk_broadway_display_sync (GdkDisplay *display) { g_return_if_fail (GDK_IS_DISPLAY (display)); + } -void -gdk_display_sync (GdkDisplay *display) +static void +gdk_broadway_display_flush (GdkDisplay *display) { g_return_if_fail (GDK_IS_DISPLAY (display)); } -void -gdk_display_flush (GdkDisplay *display) +static gboolean +gdk_broadway_display_has_pending (GdkDisplay *display) { - g_return_if_fail (GDK_IS_DISPLAY (display)); - + return FALSE; } -GdkWindow * -gdk_display_get_default_group (GdkDisplay *display) +static GdkWindow * +gdk_broadway_display_get_default_group (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); @@ -613,156 +600,208 @@ gdk_display_get_default_group (GdkDisplay *display) } static void -gdk_display_broadway_dispose (GObject *object) +gdk_broadway_display_dispose (GObject *object) { - GdkDisplayBroadway *display_broadway = GDK_DISPLAY_BROADWAY (object); + GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object); - g_list_foreach (display_broadway->input_devices, (GFunc) g_object_run_dispose, NULL); + _gdk_broadway_display_manager_remove_display (gdk_display_manager_get (), + GDK_DISPLAY_OBJECT (object)); - _gdk_screen_close (display_broadway->screens[0]); + g_list_foreach (broadway_display->input_devices, (GFunc) g_object_run_dispose, NULL); - if (display_broadway->event_source) + _gdk_screen_close (broadway_display->screens[0]); + + if (broadway_display->event_source) { - g_source_destroy (display_broadway->event_source); - g_source_unref (display_broadway->event_source); - display_broadway->event_source = NULL; + g_source_destroy (broadway_display->event_source); + g_source_unref (broadway_display->event_source); + broadway_display->event_source = NULL; } - G_OBJECT_CLASS (_gdk_display_broadway_parent_class)->dispose (object); + G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object); } static void -gdk_display_broadway_finalize (GObject *object) +gdk_broadway_display_finalize (GObject *object) { - GdkDisplayBroadway *display_broadway = GDK_DISPLAY_BROADWAY (object); + GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object); /* Keymap */ - if (display_broadway->keymap) - g_object_unref (display_broadway->keymap); + if (broadway_display->keymap) + g_object_unref (broadway_display->keymap); - _gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(display_broadway)); + _gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display)); /* Atom Hashtable */ - g_hash_table_destroy (display_broadway->atom_from_virtual); - g_hash_table_destroy (display_broadway->atom_to_virtual); + g_hash_table_destroy (broadway_display->atom_from_virtual); + g_hash_table_destroy (broadway_display->atom_to_virtual); /* input GdkDevice list */ - g_list_foreach (display_broadway->input_devices, (GFunc) g_object_unref, NULL); - g_list_free (display_broadway->input_devices); + g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL); + g_list_free (broadway_display->input_devices); /* Free all GdkScreens */ - g_object_unref (display_broadway->screens[0]); - g_free (display_broadway->screens); - - G_OBJECT_CLASS (_gdk_display_broadway_parent_class)->finalize (object); -} + g_object_unref (broadway_display->screens[0]); + g_free (broadway_display->screens); -void -_gdk_windowing_set_default_display (GdkDisplay *display) -{ + G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object); } void -gdk_notify_startup_complete (void) +_gdk_broadway_display_make_default (GdkDisplay *display) { } -void -gdk_notify_startup_complete_with_id (const gchar* startup_id) +static void +gdk_broadway_display_notify_startup_complete (GdkDisplay *display, + const gchar *startup_id) { } -gboolean -gdk_display_supports_selection_notification (GdkDisplay *display) +static gboolean +gdk_broadway_display_supports_selection_notification (GdkDisplay *display) { return FALSE; } -gboolean -gdk_display_request_selection_notification (GdkDisplay *display, - GdkAtom selection) +static gboolean +gdk_broadway_display_request_selection_notification (GdkDisplay *display, + GdkAtom selection) { return FALSE; } -gboolean -gdk_display_supports_clipboard_persistence (GdkDisplay *display) +static gboolean +gdk_broadway_display_supports_clipboard_persistence (GdkDisplay *display) { return FALSE; } -void -gdk_display_store_clipboard (GdkDisplay *display, - GdkWindow *clipboard_window, - guint32 time_, - const GdkAtom *targets, - gint n_targets) +static void +gdk_broadway_display_store_clipboard (GdkDisplay *display, + GdkWindow *clipboard_window, + guint32 time_, + const GdkAtom *targets, + gint n_targets) { } -gboolean -gdk_display_supports_shapes (GdkDisplay *display) +static gboolean +gdk_broadway_display_supports_shapes (GdkDisplay *display) { return FALSE; } -gboolean -gdk_display_supports_input_shapes (GdkDisplay *display) +static gboolean +gdk_broadway_display_supports_input_shapes (GdkDisplay *display) { return FALSE; } -gboolean -gdk_display_supports_composite (GdkDisplay *display) +static gboolean +gdk_broadway_display_supports_composite (GdkDisplay *display) { return FALSE; } -GList * -gdk_display_list_devices (GdkDisplay *display) +static GList * +gdk_broadway_display_list_devices (GdkDisplay *display) { g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_DISPLAY_BROADWAY (display)->input_devices; + return GDK_BROADWAY_DISPLAY (display)->input_devices; } -gboolean -gdk_event_send_client_message_for_display (GdkDisplay *display, - GdkEvent *event, - GdkNativeWindow winid) +static gboolean +gdk_broadway_display_send_client_message (GdkDisplay *display, + GdkEvent *event, + GdkNativeWindow winid) { return FALSE; } -void -gdk_display_add_client_message_filter (GdkDisplay *display, - GdkAtom message_type, - GdkFilterFunc func, - gpointer data) +static void +gdk_broadway_display_add_client_message_filter (GdkDisplay *display, + GdkAtom message_type, + GdkFilterFunc func, + gpointer data) { } -void -gdk_add_client_message_filter (GdkAtom message_type, - GdkFilterFunc func, - gpointer data) +static gulong +gdk_broadway_display_get_next_serial (GdkDisplay *display) { + return 0; } -void -gdk_flush (void) + +static void +gdk_broadway_display_event_data_copy (GdkDisplay *display, + const GdkEvent *src, + GdkEvent *dst) { - GSList *tmp_list = _gdk_displays; +} - while (tmp_list) - { - gdk_display_flush (GDK_DISPLAY_OBJECT (tmp_list->data)); - tmp_list = tmp_list->next; - } +static void +gdk_broadway_display_event_data_free (GdkDisplay *display, + GdkEvent *event) +{ } -gulong -_gdk_windowing_window_get_next_serial (GdkDisplay *display) +static void +gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class) { - return 0; + GObjectClass *object_class = G_OBJECT_CLASS (class); + GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class); + + object_class->dispose = gdk_broadway_display_dispose; + object_class->finalize = gdk_broadway_display_finalize; + + display_class->window_type = GDK_TYPE_BROADWAY_WINDOW; + + display_class->get_name = gdk_broadway_display_get_name; + display_class->get_n_screens = gdk_broadway_display_get_n_screens; + display_class->get_screen = gdk_broadway_display_get_screen; + display_class->get_default_screen = gdk_broadway_display_get_default_screen; + display_class->beep = gdk_broadway_display_beep; + display_class->sync = gdk_broadway_display_sync; + display_class->flush = gdk_broadway_display_flush; + display_class->has_pending = gdk_broadway_display_has_pending; + display_class->queue_events = _gdk_broadway_display_queue_events; + display_class->get_default_group = gdk_broadway_display_get_default_group; + display_class->supports_selection_notification = gdk_broadway_display_supports_selection_notification; + display_class->request_selection_notification = gdk_broadway_display_request_selection_notification; + display_class->supports_clipboard_persistence = gdk_broadway_display_supports_clipboard_persistence; + display_class->store_clipboard = gdk_broadway_display_store_clipboard; + display_class->supports_shapes = gdk_broadway_display_supports_shapes; + display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes; + display_class->supports_composite = gdk_broadway_display_supports_composite; + display_class->list_devices = gdk_broadway_display_list_devices; + display_class->send_client_message = gdk_broadway_display_send_client_message; + display_class->add_client_message_filter = gdk_broadway_display_add_client_message_filter; + display_class->get_drag_protocol = _gdk_broadway_display_get_drag_protocol; + display_class->get_cursor_for_type = _gdk_broadway_display_get_cursor_for_type; + display_class->get_cursor_for_name = _gdk_broadway_display_get_cursor_for_name; + display_class->get_cursor_for_pixbuf = _gdk_broadway_display_get_cursor_for_pixbuf; + display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size; + display_class->get_maximal_cursor_size = _gdk_broadway_display_get_maximal_cursor_size; + display_class->supports_cursor_alpha = _gdk_broadway_display_supports_cursor_alpha; + display_class->supports_cursor_color = _gdk_broadway_display_supports_cursor_color; + + display_class->before_process_all_updates = _gdk_broadway_display_before_process_all_updates; + display_class->after_process_all_updates = _gdk_broadway_display_after_process_all_updates; + display_class->get_next_serial = gdk_broadway_display_get_next_serial; + display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete; + display_class->event_data_copy = gdk_broadway_display_event_data_copy; + display_class->event_data_free = gdk_broadway_display_event_data_free; + display_class->create_window_impl = _gdk_broadway_display_create_window_impl; + display_class->get_keymap = _gdk_broadway_display_get_keymap; + display_class->get_selection_owner = _gdk_broadway_display_get_selection_owner; + display_class->set_selection_owner = _gdk_broadway_display_set_selection_owner; + display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify; + display_class->get_selection_property = _gdk_broadway_display_get_selection_property; + display_class->convert_selection = _gdk_broadway_display_convert_selection; + display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list; + display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target; } + diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h index 160416def4..e2c9b455e2 100644 --- a/gdk/broadway/gdkdisplay-broadway.h +++ b/gdk/broadway/gdkdisplay-broadway.h @@ -21,31 +21,31 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GDK_DISPLAY_BROADWAY__ -#define __GDK_DISPLAY_BROADWAY__ - -#include <gdk/gdkdisplay.h> -#include <gdk/gdkkeys.h> -#include <gdk/gdkwindow.h> -#include <gdk/gdkinternals.h> -#include <gdk/gdkmain.h> +#ifndef __GDK_BROADWAY_DISPLAY__ +#define __GDK_BROADWAY_DISPLAY__ + +#include "gdkdisplayprivate.h" +#include "gdkkeys.h" +#include "gdkwindow.h" +#include "gdkinternals.h" +#include "gdkmain.h" #include "broadway.h" G_BEGIN_DECLS -typedef struct _GdkDisplayBroadway GdkDisplayBroadway; -typedef struct _GdkDisplayBroadwayClass GdkDisplayBroadwayClass; - -#define GDK_TYPE_DISPLAY_BROADWAY (_gdk_display_broadway_get_type()) -#define GDK_DISPLAY_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_BROADWAY, GdkDisplayBroadway)) -#define GDK_DISPLAY_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_BROADWAY, GdkDisplayBroadwayClass)) -#define GDK_IS_DISPLAY_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_BROADWAY)) -#define GDK_IS_DISPLAY_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_BROADWAY)) -#define GDK_DISPLAY_BROADWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_BROADWAY, GdkDisplayBroadwayClass)) +typedef struct _GdkBroadwayDisplay GdkBroadwayDisplay; +typedef struct _GdkBroadwayDisplayClass GdkBroadwayDisplayClass; typedef struct HttpRequest HttpRequest; -struct _GdkDisplayBroadway +#define GDK_TYPE_BROADWAY_DISPLAY (gdk_broadway_display_get_type()) +#define GDK_BROADWAY_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplay)) +#define GDK_BROADWAY_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplayClass)) +#define GDK_IS_BROADWAY_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DISPLAY)) +#define GDK_IS_BROADWAY_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DISPLAY)) +#define GDK_BROADWAY_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DISPLAY, GdkBroadwayDisplayClass)) + +struct _GdkBroadwayDisplay { GdkDisplay parent_instance; GdkScreen *default_screen; @@ -86,13 +86,13 @@ struct _GdkDisplayBroadway HttpRequest *input; }; -struct _GdkDisplayBroadwayClass +struct _GdkBroadwayDisplayClass { GdkDisplayClass parent_class; }; -GType _gdk_display_broadway_get_type (void); +GType gdk_broadway_display_get_type (void); G_END_DECLS -#endif /* __GDK_DISPLAY_BROADWAY__ */ +#endif /* __GDK_BROADWAY_DISPLAY__ */ diff --git a/gdk/broadway/gdkdisplaymanager-broadway.c b/gdk/broadway/gdkdisplaymanager-broadway.c new file mode 100644 index 0000000000..67fa360af2 --- /dev/null +++ b/gdk/broadway/gdkdisplaymanager-broadway.c @@ -0,0 +1,161 @@ +/* GDK - The GIMP Drawing Kit + * gdkdisplaymanager-broadway.c + * + * Copyright (C) 2005 Imendio AB + * Copyright 2010 Red Hat, Inc. + * + * Author: Matthias clasen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#include "config.h" + +#include "gdkdisplay-broadway.h" +#include "gdkbroadwaydisplaymanager.h" +#include "gdkprivate-broadway.h" + +#include "gdkdisplaymanagerprivate.h" +#include "gdkinternals.h" + +struct _GdkBroadwayDisplayManager +{ + GdkDisplayManager parent; + + GdkDisplay *default_display; + GSList *displays; +}; + +G_DEFINE_TYPE (GdkBroadwayDisplayManager, gdk_broadway_display_manager, GDK_TYPE_DISPLAY_MANAGER) + +static GdkDisplay * +gdk_broadway_display_manager_open_display (GdkDisplayManager *manager, + const gchar *name) +{ + return _gdk_broadway_display_open (name); +} + +static GSList * +gdk_broadway_display_manager_list_displays (GdkDisplayManager *manager) +{ + GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager); + + return g_slist_copy (manager_broadway->displays); +} + +static GdkDisplay * +gdk_broadway_display_manager_get_default_display (GdkDisplayManager *manager) +{ + return GDK_BROADWAY_DISPLAY_MANAGER (manager)->default_display; +} + +static void +gdk_broadway_display_manager_set_default_display (GdkDisplayManager *manager, + GdkDisplay *display) +{ + GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager); + + manager_broadway->default_display = display; +} + +#include "../gdkkeynames.c" + +static gchar * +gdk_broadway_display_manager_get_keyval_name (GdkDisplayManager *manager, + guint keyval) +{ + return _gdk_keyval_name (keyval); +} + +static guint +gdk_broadway_display_manager_lookup_keyval (GdkDisplayManager *manager, + const gchar *name) +{ + return _gdk_keyval_from_name (name); +} + +static void +gdk_broadway_display_manager_keyval_convert_case (GdkDisplayManager *manager, + guint symbol, + guint *lower, + guint *upper) +{ + /* FIXME implement this */ + if (lower) + *lower = symbol; + if (upper) + *upper = symbol; +} + +static void +gdk_broadway_display_manager_init (GdkBroadwayDisplayManager *manager) +{ +} + +static void +gdk_broadway_display_manager_finalize (GObject *object) +{ + g_error ("A GdkBroadwayDisplayManager object was finalized. This should not happen"); + G_OBJECT_CLASS (gdk_broadway_display_manager_parent_class)->finalize (object); +} + +static void +gdk_broadway_display_manager_class_init (GdkBroadwayDisplayManagerClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class); + + object_class->finalize = gdk_broadway_display_manager_finalize; + + manager_class->open_display = gdk_broadway_display_manager_open_display; + manager_class->list_displays = gdk_broadway_display_manager_list_displays; + manager_class->set_default_display = gdk_broadway_display_manager_set_default_display; + manager_class->get_default_display = gdk_broadway_display_manager_get_default_display; + manager_class->atom_intern = _gdk_broadway_display_manager_atom_intern; + manager_class->get_atom_name = _gdk_broadway_display_manager_get_atom_name; + manager_class->lookup_keyval = gdk_broadway_display_manager_lookup_keyval; + manager_class->get_keyval_name = gdk_broadway_display_manager_get_keyval_name; + manager_class->keyval_convert_case = gdk_broadway_display_manager_keyval_convert_case; +} + +void +_gdk_broadway_display_manager_add_display (GdkDisplayManager *manager, + GdkDisplay *display) +{ + GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager); + + if (manager_broadway->displays == NULL) + gdk_display_manager_set_default_display (manager, display); + + manager_broadway->displays = g_slist_prepend (manager_broadway->displays, display); +} + +void +_gdk_broadway_display_manager_remove_display (GdkDisplayManager *manager, + GdkDisplay *display) +{ + GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager); + + manager_broadway->displays = g_slist_remove (manager_broadway->displays, display); + + if (manager_broadway->default_display == display) + { + if (manager_broadway->displays) + gdk_display_manager_set_default_display (manager, manager_broadway->displays->data); + else + gdk_display_manager_set_default_display (manager, NULL); + } +} diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c index 14fd172baa..b5e5850f8d 100644 --- a/gdk/broadway/gdkdnd-broadway.c +++ b/gdk/broadway/gdkdnd-broadway.c @@ -26,9 +26,9 @@ #include "config.h" -#include "gdkdnd.h" +#include "gdkdndprivate.h" -#include "gdkmain.h" +#include "gdkinternals.h" #include "gdkproperty.h" #include "gdkprivate-broadway.h" #include "gdkinternals.h" @@ -37,124 +37,101 @@ #include <string.h> -typedef struct _GdkDragContextPrivateBroadway GdkDragContextPrivateBroadway; +#define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ()) +#define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext)) +#define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass)) +#define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT)) +#define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT)) +#define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass)) -/* Structure that holds information about a drag in progress. - * this is used on both source and destination sides. - */ -struct _GdkDragContextPrivateBroadway { +#ifdef GDK_COMPILATION +typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext; +#else +typedef GdkDragContext GdkBroadwayDragContext; +#endif +typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass; + +GType gdk_broadway_drag_context_get_type (void); + +struct _GdkBroadwayDragContext { GdkDragContext context; }; -#define PRIVATE_DATA(context) ((GdkDragContextPrivateBroadway *) GDK_DRAG_CONTEXT (context)->windowing_data) +struct _GdkBroadwayDragContextClass +{ + GdkDragContextClass parent_class; +}; -static void gdk_drag_context_finalize (GObject *object); +static void gdk_broadway_drag_context_finalize (GObject *object); static GList *contexts; -G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT) +G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT) static void -gdk_drag_context_init (GdkDragContext *dragcontext) +gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext) { - GdkDragContextPrivateBroadway *private; - - private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext, - GDK_TYPE_DRAG_CONTEXT, - GdkDragContextPrivateBroadway); - - dragcontext->windowing_data = private; - contexts = g_list_prepend (contexts, dragcontext); } static void -gdk_drag_context_class_init (GdkDragContextClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = gdk_drag_context_finalize; - - g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateBroadway)); -} - -static void -gdk_drag_context_finalize (GObject *object) +gdk_broadway_drag_context_finalize (GObject *object) { GdkDragContext *context = GDK_DRAG_CONTEXT (object); contexts = g_list_remove (contexts, context); - G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object); } /* Drag Contexts */ GdkDragContext * -gdk_drag_context_new (void) -{ - return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL); -} - -void -gdk_drag_context_set_device (GdkDragContext *context, - GdkDevice *device) -{ - g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); - g_return_if_fail (GDK_IS_DEVICE (device)); -} - -GdkDevice * -gdk_drag_context_get_device (GdkDragContext *context) -{ - g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL); - - return NULL; -} - -GdkDragContext * -gdk_drag_begin (GdkWindow *window, - GList *targets) +_gdk_broadway_window_drag_begin (GdkWindow *window, + GdkDevice *device, + GList *targets) { GdkDragContext *new_context; g_return_val_if_fail (window != NULL, NULL); g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL); - new_context = gdk_drag_context_new (); + new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT, + NULL); return new_context; } GdkNativeWindow -gdk_drag_get_protocol_for_display (GdkDisplay *display, - GdkNativeWindow xid, - GdkDragProtocol *protocol) +_gdk_broadway_display_get_drag_protocol (GdkDisplay *display, + GdkNativeWindow xid, + GdkDragProtocol *protocol, + guint *version) { return 0; } -void -gdk_drag_find_window_for_screen (GdkDragContext *context, - GdkWindow *drag_window, - GdkScreen *screen, - gint x_root, - gint y_root, - GdkWindow **dest_window, - GdkDragProtocol *protocol) +static GdkWindow * +gdk_broadway_drag_context_find_window (GdkDragContext *context, + GdkWindow *drag_window, + GdkScreen *screen, + gint x_root, + gint y_root, + GdkDragProtocol *protocol) { - g_return_if_fail (context != NULL); + g_return_val_if_fail (context != NULL, NULL); + return NULL; } -gboolean -gdk_drag_motion (GdkDragContext *context, - GdkWindow *dest_window, - GdkDragProtocol protocol, - gint x_root, - gint y_root, - GdkDragAction suggested_action, - GdkDragAction possible_actions, - guint32 time) +static gboolean +gdk_broadway_drag_context_drag_motion (GdkDragContext *context, + GdkWindow *dest_window, + GdkDragProtocol protocol, + gint x_root, + gint y_root, + GdkDragAction suggested_action, + GdkDragAction possible_actions, + guint32 time) { g_return_val_if_fail (context != NULL, FALSE); g_return_val_if_fail (dest_window == NULL || GDK_WINDOW_IS_BROADWAY (dest_window), FALSE); @@ -162,61 +139,61 @@ gdk_drag_motion (GdkDragContext *context, return FALSE; } -void -gdk_drag_drop (GdkDragContext *context, - guint32 time) +static void +gdk_broadway_drag_context_drag_drop (GdkDragContext *context, + guint32 time) { g_return_if_fail (context != NULL); } -void -gdk_drag_abort (GdkDragContext *context, - guint32 time) +static void +gdk_broadway_drag_context_drag_abort (GdkDragContext *context, + guint32 time) { g_return_if_fail (context != NULL); } /* Destination side */ -void -gdk_drag_status (GdkDragContext *context, - GdkDragAction action, - guint32 time) +static void +gdk_broadway_drag_context_drag_status (GdkDragContext *context, + GdkDragAction action, + guint32 time) { g_return_if_fail (context != NULL); } -void -gdk_drop_reply (GdkDragContext *context, - gboolean ok, - guint32 time) +static void +gdk_broadway_drag_context_drop_reply (GdkDragContext *context, + gboolean ok, + guint32 time) { g_return_if_fail (context != NULL); } -void -gdk_drop_finish (GdkDragContext *context, - gboolean success, - guint32 time) +static void +gdk_broadway_drag_context_drop_finish (GdkDragContext *context, + gboolean success, + guint32 time) { g_return_if_fail (context != NULL); } void -gdk_window_register_dnd (GdkWindow *window) +_gdk_broadway_window_register_dnd (GdkWindow *window) { } -GdkAtom -gdk_drag_get_selection (GdkDragContext *context) +static GdkAtom +gdk_broadway_drag_context_get_selection (GdkDragContext *context) { g_return_val_if_fail (context != NULL, GDK_NONE); return GDK_NONE; } -gboolean -gdk_drag_drop_succeeded (GdkDragContext *context) +static gboolean +gdk_broadway_drag_context_drop_status (GdkDragContext *context) { g_return_val_if_fail (context != NULL, FALSE); @@ -224,6 +201,25 @@ gdk_drag_drop_succeeded (GdkDragContext *context) } void -_gdk_dnd_init (GdkDisplay *display) +_gdk_broadway_display_init_dnd (GdkDisplay *display) { } + +static void +gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass); + + object_class->finalize = gdk_broadway_drag_context_finalize; + + context_class->find_window = gdk_broadway_drag_context_find_window; + context_class->drag_status = gdk_broadway_drag_context_drag_status; + context_class->drag_motion = gdk_broadway_drag_context_drag_motion; + context_class->drag_abort = gdk_broadway_drag_context_drag_abort; + context_class->drag_drop = gdk_broadway_drag_context_drag_drop; + context_class->drop_reply = gdk_broadway_drag_context_drop_reply; + context_class->drop_finish = gdk_broadway_drag_context_drop_finish; + context_class->drop_status = gdk_broadway_drag_context_drop_status; + context_class->get_selection = gdk_broadway_drag_context_get_selection; +} diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c index 04af8f456c..c4e20022e7 100644 --- a/gdk/broadway/gdkeventsource.c +++ b/gdk/broadway/gdkeventsource.c @@ -89,10 +89,10 @@ gdk_event_source_check (GSource *source) } void -_gdk_events_got_input (GdkDisplay *display, - const char *message) +_gdk_broadway_events_got_input (GdkDisplay *display, + const char *message) { - GdkDisplayBroadway *display_broadway = GDK_DISPLAY_BROADWAY (display); + GdkBroadwayDisplay *display_broadway = GDK_BROADWAY_DISPLAY (display); GdkScreen *screen; GdkWindow *root, *window; char *p; @@ -288,7 +288,7 @@ _gdk_events_got_input (GdkDisplay *display, } void -_gdk_events_queue (GdkDisplay *display) +_gdk_broadway_display_queue_events (GdkDisplay *display) { } @@ -325,7 +325,7 @@ gdk_event_source_finalize (GSource *source) } GSource * -gdk_event_source_new (GdkDisplay *display) +_gdk_broadway_event_source_new (GdkDisplay *display) { GSource *source; GdkEventSource *event_source; @@ -347,20 +347,3 @@ gdk_event_source_new (GdkDisplay *display) return source; } - -gboolean -gdk_events_pending (void) -{ - GList *tmp_list; - - for (tmp_list = event_sources; tmp_list; tmp_list = tmp_list->next) - { - GdkEventSource *tmp_source = tmp_list->data; - GdkDisplay *display = tmp_source->display; - - if (_gdk_event_queue_find_first (display)) - return TRUE; - } - - return FALSE; -} diff --git a/gdk/broadway/gdkeventsource.h b/gdk/broadway/gdkeventsource.h index ca3b9d690d..2d7c9fbbba 100644 --- a/gdk/broadway/gdkeventsource.h +++ b/gdk/broadway/gdkeventsource.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS typedef struct _GdkEventSource GdkEventSource; G_GNUC_INTERNAL -GSource * gdk_event_source_new (GdkDisplay *display); +GSource * _gdk_broadway_event_source_new (GdkDisplay *display); G_END_DECLS diff --git a/gdk/broadway/gdkkeys-broadway.c b/gdk/broadway/gdkkeys-broadway.c index b7e4cbb144..1d5f41a542 100644 --- a/gdk/broadway/gdkkeys-broadway.c +++ b/gdk/broadway/gdkkeys-broadway.c @@ -29,6 +29,7 @@ #include "gdkprivate-broadway.h" #include "gdkinternals.h" #include "gdkdisplay-broadway.h" +#include "gdkkeysprivate.h" #include "gdkkeysyms.h" #include <stdio.h> @@ -38,199 +39,152 @@ #include <limits.h> #include <errno.h> -typedef struct _GdkKeymapBroadway GdkKeymapBroadway; -typedef struct _GdkKeymapClass GdkKeymapBroadwayClass; +typedef struct _GdkBroadwayKeymap GdkBroadwayKeymap; +typedef struct _GdkKeymapClass GdkBroadwayKeymapClass; -#define GDK_TYPE_KEYMAP_BROADWAY (gdk_keymap_broadway_get_type ()) -#define GDK_KEYMAP_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP_BROADWAY, GdkKeymapBroadway)) -#define GDK_IS_KEYMAP_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP_BROADWAY)) +#define GDK_TYPE_BROADWAY_KEYMAP (gdk_broadway_keymap_get_type ()) +#define GDK_BROADWAY_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_KEYMAP, GdkBroadwayKeymap)) +#define GDK_IS_BROADWAY_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_KEYMAP)) typedef struct _DirectionCacheEntry DirectionCacheEntry; -struct _GdkKeymapBroadway +struct _GdkBroadwayKeymap { GdkKeymap parent_instance; - }; -#define KEYMAP_USE_XKB(keymap) GDK_DISPLAY_BROADWAY ((keymap)->display)->use_xkb -#define KEYMAP_XDISPLAY(keymap) GDK_DISPLAY_XDISPLAY ((keymap)->display) - -static GType gdk_keymap_broadway_get_type (void); -static void gdk_keymap_broadway_class_init (GdkKeymapBroadwayClass *klass); -static void gdk_keymap_broadway_init (GdkKeymapBroadway *keymap); -static void gdk_keymap_broadway_finalize (GObject *object); - -static GdkKeymapClass *parent_class = NULL; - -static GType -gdk_keymap_broadway_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - const GTypeInfo object_info = - { - sizeof (GdkKeymapClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_keymap_broadway_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkKeymapBroadway), - 0, /* n_preallocs */ - (GInstanceInitFunc) gdk_keymap_broadway_init, - }; - - object_type = g_type_register_static (GDK_TYPE_KEYMAP, - g_intern_static_string ("GdkKeymapBroadway"), - &object_info, 0); - } - - return object_type; -} - -static void -gdk_keymap_broadway_class_init (GdkKeymapBroadwayClass *klass) +struct _GdkBroadwayKeymapClass { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GdkKeymapClass keymap_class; +}; - parent_class = g_type_class_peek_parent (klass); +G_DEFINE_TYPE (GdkBroadwayKeymap, gdk_broadway_keymap, GDK_TYPE_KEYMAP) - object_class->finalize = gdk_keymap_broadway_finalize; -} +static void gdk_broadway_keymap_finalize (GObject *object); static void -gdk_keymap_broadway_init (GdkKeymapBroadway *keymap) +gdk_broadway_keymap_init (GdkBroadwayKeymap *keymap) { } static void -gdk_keymap_broadway_finalize (GObject *object) +gdk_broadway_keymap_finalize (GObject *object) { - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_broadway_keymap_parent_class)->finalize (object); } GdkKeymap* -gdk_keymap_get_for_display (GdkDisplay *display) +_gdk_broadway_display_get_keymap (GdkDisplay *display) { - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - display_broadway = GDK_DISPLAY_BROADWAY (display); + broadway_display = GDK_BROADWAY_DISPLAY (display); - if (!display_broadway->keymap) - display_broadway->keymap = g_object_new (gdk_keymap_broadway_get_type (), NULL); + if (!broadway_display->keymap) + broadway_display->keymap = g_object_new (gdk_broadway_keymap_get_type (), NULL); - display_broadway->keymap->display = display; + broadway_display->keymap->display = display; - return display_broadway->keymap; + return broadway_display->keymap; } -PangoDirection -gdk_keymap_get_direction (GdkKeymap *keymap) +static PangoDirection +gdk_broadway_keymap_get_direction (GdkKeymap *keymap) { return PANGO_DIRECTION_NEUTRAL; } -gboolean -gdk_keymap_have_bidi_layouts (GdkKeymap *keymap) +static gboolean +gdk_broadway_keymap_have_bidi_layouts (GdkKeymap *keymap) { return FALSE; } -gboolean -gdk_keymap_get_caps_lock_state (GdkKeymap *keymap) +static gboolean +gdk_broadway_keymap_get_caps_lock_state (GdkKeymap *keymap) { return FALSE; } -gboolean -gdk_keymap_get_num_lock_state (GdkKeymap *keymap) +static gboolean +gdk_broadway_keymap_get_num_lock_state (GdkKeymap *keymap) { return FALSE; } -gboolean -gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap, - guint keyval, - GdkKeymapKey **keys, - gint *n_keys) +static gboolean +gdk_broadway_keymap_get_entries_for_keyval (GdkKeymap *keymap, + guint keyval, + GdkKeymapKey **keys, + gint *n_keys) { *n_keys = 0; return FALSE; } -gboolean -gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap, - guint hardware_keycode, - GdkKeymapKey **keys, - guint **keyvals, - gint *n_entries) +static gboolean +gdk_broadway_keymap_get_entries_for_keycode (GdkKeymap *keymap, + guint hardware_keycode, + GdkKeymapKey **keys, + guint **keyvals, + gint *n_entries) { *n_entries = 0; return FALSE; } -guint -gdk_keymap_lookup_key (GdkKeymap *keymap, - const GdkKeymapKey *key) +static guint +gdk_broadway_keymap_lookup_key (GdkKeymap *keymap, + const GdkKeymapKey *key) { return 0; } -gboolean -gdk_keymap_translate_keyboard_state (GdkKeymap *keymap, - guint hardware_keycode, - GdkModifierType state, - gint group, - guint *keyval, - gint *effective_group, - gint *level, - GdkModifierType *consumed_modifiers) +static gboolean +gdk_broadway_keymap_translate_keyboard_state (GdkKeymap *keymap, + guint hardware_keycode, + GdkModifierType state, + gint group, + guint *keyval, + gint *effective_group, + gint *level, + GdkModifierType *consumed_modifiers) { return FALSE; } - -/* Key handling not part of the keymap */ -gchar* -gdk_keyval_name (guint keyval) +static void +gdk_broadway_keymap_add_virtual_modifiers (GdkKeymap *keymap, + GdkModifierType *state) { - switch (keyval) - { - case GDK_KEY_Page_Up: - return "Page_Up"; - case GDK_KEY_Page_Down: - return "Page_Down"; - case GDK_KEY_KP_Page_Up: - return "KP_Page_Up"; - case GDK_KEY_KP_Page_Down: - return "KP_Page_Down"; - } - - return "TODO"; } -guint -gdk_keyval_from_name (const gchar *keyval_name) +static gboolean +gdk_broadway_keymap_map_virtual_modifiers (GdkKeymap *keymap, + GdkModifierType *state) { - g_return_val_if_fail (keyval_name != NULL, 0); - - return 0; + return FALSE; } -void -gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap, - GdkModifierType *state) +static void +gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass) { -} + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass); -gboolean -gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap, - GdkModifierType *state) -{ - return FALSE; + object_class->finalize = gdk_broadway_keymap_finalize; + + keymap_class->get_direction = gdk_broadway_keymap_get_direction; + keymap_class->have_bidi_layouts = gdk_broadway_keymap_have_bidi_layouts; + keymap_class->get_caps_lock_state = gdk_broadway_keymap_get_caps_lock_state; + keymap_class->get_num_lock_state = gdk_broadway_keymap_get_num_lock_state; + keymap_class->get_entries_for_keyval = gdk_broadway_keymap_get_entries_for_keyval; + keymap_class->get_entries_for_keycode = gdk_broadway_keymap_get_entries_for_keycode; + keymap_class->lookup_key = gdk_broadway_keymap_lookup_key; + keymap_class->translate_keyboard_state = gdk_broadway_keymap_translate_keyboard_state; + keymap_class->add_virtual_modifiers = gdk_broadway_keymap_add_virtual_modifiers; + keymap_class->map_virtual_modifiers = gdk_broadway_keymap_map_virtual_modifiers; } + diff --git a/gdk/broadway/gdkmain-broadway.c b/gdk/broadway/gdkmain-broadway.c index 623379b0c1..d7b115b765 100644 --- a/gdk/broadway/gdkmain-broadway.c +++ b/gdk/broadway/gdkmain-broadway.c @@ -87,36 +87,3 @@ void _gdk_windowing_exit (void) { } - -void -gdk_error_trap_push (void) -{ -} - -void -gdk_error_trap_pop_ignored (void) -{ -} - -gint -gdk_error_trap_pop (void) -{ - return 0; -} - -gchar * -gdk_get_display (void) -{ - return g_strdup (gdk_display_get_name (gdk_display_get_default ())); -} - -void -_gdk_windowing_event_data_copy (const GdkEvent *src, - GdkEvent *dst) -{ -} - -void -_gdk_windowing_event_data_free (GdkEvent *event) -{ -} diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 7892b83d06..e5cbac585d 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -37,22 +37,54 @@ #include "gdkwindow-broadway.h" #include "gdkdisplay-broadway.h" -typedef struct _GdkCursorPrivate GdkCursorPrivate; +#include "gdkbroadwaycursor.h" +#include "gdkbroadwayvisual.h" +#include "gdkbroadwaywindow.h" void _gdk_broadway_resync_windows (void); -struct _GdkCursorPrivate -{ - GdkCursor cursor; - GdkDisplay *display; -}; - +gchar * _gdk_broadway_display_manager_get_atom_name (GdkDisplayManager *manager, + GdkAtom atom); +void _gdk_broadway_display_manager_add_display (GdkDisplayManager *manager, + GdkDisplay *display); +void _gdk_broadway_display_manager_remove_display (GdkDisplayManager *manager, + GdkDisplay *display); +GdkAtom _gdk_broadway_display_manager_atom_intern_static_string (GdkDisplayManager *manager, + const gchar *atom_name); +GdkAtom _gdk_broadway_display_manager_atom_intern (GdkDisplayManager *manager, + const gchar *atom_name, + gboolean only_if_exists); + + +void _gdk_broadway_window_register_dnd (GdkWindow *window); +GdkDragContext * _gdk_broadway_window_drag_begin (GdkWindow *window, + GdkDevice *device, + GList *targets); gboolean _gdk_broadway_window_queue_antiexpose (GdkWindow *window, cairo_region_t *area); void _gdk_broadway_window_translate (GdkWindow *window, cairo_region_t *area, gint dx, gint dy); +gboolean _gdk_broadway_window_get_property (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gulong offset, + gulong length, + gint pdelete, + GdkAtom *actual_property_type, + gint *actual_format_type, + gint *actual_length, + guchar **data); +void _gdk_broadway_window_change_property (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gint format, + GdkPropMode mode, + const guchar *data, + gint nelements); +void _gdk_broadway_window_delete_property (GdkWindow *window, + GdkAtom property); void _gdk_selection_window_destroyed (GdkWindow *window); @@ -66,23 +98,118 @@ gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap, void _gdk_broadway_initialize_locale (void); -void _gdk_screen_broadway_events_init (GdkScreen *screen); - -void _gdk_events_init (GdkDisplay *display); -void _gdk_events_uninit (GdkDisplay *display); -void _gdk_events_got_input (GdkDisplay *display, - const char *message); - -void _gdk_windowing_window_init (GdkScreen *screen); -void _gdk_visual_init (GdkScreen *screen); -void _gdk_dnd_init (GdkDisplay *display); +void _gdk_broadway_screen_events_init (GdkScreen *screen); +GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen); +gint _gdk_broadway_screen_visual_get_best_depth (GdkScreen * screen); +GdkVisualType _gdk_broadway_screen_visual_get_best_type (GdkScreen * screen); +GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen); +GdkVisual*_gdk_broadway_screen_visual_get_best (GdkScreen * screen); +GdkVisual*_gdk_broadway_screen_visual_get_best_with_depth (GdkScreen * screen, + gint depth); +GdkVisual*_gdk_broadway_screen_visual_get_best_with_type (GdkScreen * screen, + GdkVisualType visual_type); +GdkVisual*_gdk_broadway_screen_visual_get_best_with_both (GdkScreen * screen, + gint depth, + GdkVisualType visual_type); +void _gdk_broadway_screen_query_depths (GdkScreen * screen, + gint **depths, + gint *count); +void _gdk_broadway_screen_query_visual_types (GdkScreen * screen, + GdkVisualType **visual_types, + gint *count); +GList *_gdk_broadway_screen_list_visuals (GdkScreen *screen); + +void _gdk_broadway_events_got_input (GdkDisplay *display, + const char *message); + +void _gdk_broadway_screen_init_root_window (GdkScreen *screen); +void _gdk_broadway_screen_init_visuals (GdkScreen *screen); +void _gdk_broadway_display_init_dnd (GdkDisplay *display); +GdkDisplay * _gdk_broadway_display_open (const gchar *display_name); +void _gdk_broadway_display_queue_events (GdkDisplay *display); +GdkNativeWindow _gdk_broadway_display_get_drag_protocol (GdkDisplay *display, + GdkNativeWindow xid, + GdkDragProtocol *protocol, + guint *version); +GdkCursor*_gdk_broadway_display_get_cursor_for_type (GdkDisplay *display, + GdkCursorType cursor_type); +GdkCursor*_gdk_broadway_display_get_cursor_for_name (GdkDisplay *display, + const gchar *name); +GdkCursor *_gdk_broadway_display_get_cursor_for_pixbuf (GdkDisplay *display, + GdkPixbuf *pixbuf, + gint x, + gint y); +gboolean _gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display); +gboolean _gdk_broadway_display_supports_cursor_color (GdkDisplay *display); +void _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display, + guint *width, + guint *height); +void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display, + guint *width, + guint *height); +void _gdk_broadway_display_before_process_all_updates (GdkDisplay *display); +void _gdk_broadway_display_after_process_all_updates (GdkDisplay *display); +void _gdk_broadway_display_create_window_impl (GdkDisplay *display, + GdkWindow *window, + GdkWindow *real_parent, + GdkScreen *screen, + GdkEventMask event_mask, + GdkWindowAttr *attributes, + gint attributes_mask); +gboolean _gdk_broadway_display_set_selection_owner (GdkDisplay *display, + GdkWindow *owner, + GdkAtom selection, + guint32 time, + gboolean send_event); +GdkWindow * _gdk_broadway_display_get_selection_owner (GdkDisplay *display, + GdkAtom selection); +gint _gdk_broadway_display_get_selection_property (GdkDisplay *display, + GdkWindow *requestor, + guchar **data, + GdkAtom *ret_type, + gint *ret_format); +void _gdk_broadway_display_send_selection_notify (GdkDisplay *display, + GdkNativeWindow requestor, + GdkAtom selection, + GdkAtom target, + GdkAtom property, + guint32 time); +void _gdk_broadway_display_convert_selection (GdkDisplay *display, + GdkWindow *requestor, + GdkAtom selection, + GdkAtom target, + guint32 time); +gint _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list); +gchar *_gdk_broadway_display_utf8_to_string_target (GdkDisplay *display, + const gchar *str); +GdkKeymap* _gdk_broadway_display_get_keymap (GdkDisplay *display); + +/* Window methods - testing */ +void _gdk_broadway_window_sync_rendering (GdkWindow *window); +gboolean _gdk_broadway_window_simulate_key (GdkWindow *window, + gint x, + gint y, + guint keyval, + GdkModifierType modifiers, + GdkEventType key_pressrelease); +gboolean _gdk_broadway_window_simulate_button (GdkWindow *window, + gint x, + gint y, + guint button, + GdkModifierType modifiers, + GdkEventType button_pressrelease); void _gdk_broadway_cursor_update_theme (GdkCursor *cursor); void _gdk_broadway_cursor_display_finalize (GdkDisplay *display); -#define GDK_SCREEN_DISPLAY(screen) (GDK_SCREEN_BROADWAY (screen)->display) +#define GDK_SCREEN_DISPLAY(screen) (GDK_BROADWAY_SCREEN (screen)->display) #define GDK_WINDOW_SCREEN(win) (GDK_WINDOW_IMPL_BROADWAY (((GdkWindow *)win)->impl)->screen) -#define GDK_WINDOW_DISPLAY(win) (GDK_SCREEN_BROADWAY (GDK_WINDOW_SCREEN (win))->display) +#define GDK_WINDOW_DISPLAY(win) (GDK_BROADWAY_SCREEN (GDK_WINDOW_SCREEN (win))->display) #define GDK_WINDOW_IS_BROADWAY(win) (GDK_IS_WINDOW_IMPL_BROADWAY (((GdkWindow *)win)->impl)) #endif /* __GDK_PRIVATE_BROADWAY_H__ */ diff --git a/gdk/broadway/gdkproperty-broadway.c b/gdk/broadway/gdkproperty-broadway.c index e1eaa3d2f5..d3e83064e9 100644 --- a/gdk/broadway/gdkproperty-broadway.c +++ b/gdk/broadway/gdkproperty-broadway.c @@ -38,14 +38,16 @@ #include <string.h> GdkAtom -gdk_atom_intern (const gchar *atom_name, - gboolean only_if_exists) +_gdk_broadway_display_manager_atom_intern (GdkDisplayManager *manager, + const gchar *atom_name, + gboolean only_if_exists) { return _GDK_MAKE_ATOM (g_quark_from_string (atom_name)); } GdkAtom -gdk_atom_intern_static_string (const gchar *atom_name) +_gdk_broadway_display_manager_atom_intern_static_string (GdkDisplayManager *manager, + const gchar *atom_name) { return _GDK_MAKE_ATOM (g_quark_from_static_string (atom_name)); } @@ -57,41 +59,42 @@ get_atom_name (GdkAtom atom) } gchar * -gdk_atom_name (GdkAtom atom) +_gdk_broadway_display_manager_get_atom_name (GdkDisplayManager *manager, + GdkAtom atom) { return g_strdup (get_atom_name (atom)); } gboolean -gdk_property_get (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gulong offset, - gulong length, - gint pdelete, - GdkAtom *actual_property_type, - gint *actual_format_type, - gint *actual_length, - guchar **data) +_gdk_broadway_window_get_property (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gulong offset, + gulong length, + gint pdelete, + GdkAtom *actual_property_type, + gint *actual_format_type, + gint *actual_length, + guchar **data) { return FALSE; } void -gdk_property_change (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - const guchar *data, - gint nelements) +_gdk_broadway_window_change_property (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gint format, + GdkPropMode mode, + const guchar *data, + gint nelements) { g_return_if_fail (!window || GDK_WINDOW_IS_BROADWAY (window)); } void -gdk_property_delete (GdkWindow *window, - GdkAtom property) +_gdk_broadway_window_delete_property (GdkWindow *window, + GdkAtom property) { g_return_if_fail (!window || GDK_WINDOW_IS_BROADWAY (window)); } diff --git a/gdk/broadway/gdkscreen-broadway.c b/gdk/broadway/gdkscreen-broadway.c index 527deb3d0e..dd1e38c5c7 100644 --- a/gdk/broadway/gdkscreen-broadway.c +++ b/gdk/broadway/gdkscreen-broadway.c @@ -34,130 +34,121 @@ #include <stdlib.h> #include <string.h> -static void gdk_screen_broadway_dispose (GObject *object); -static void gdk_screen_broadway_finalize (GObject *object); +static void gdk_broadway_screen_dispose (GObject *object); +static void gdk_broadway_screen_finalize (GObject *object); -G_DEFINE_TYPE (GdkScreenBroadway, _gdk_screen_broadway, GDK_TYPE_SCREEN) +G_DEFINE_TYPE (GdkBroadwayScreen, gdk_broadway_screen, GDK_TYPE_SCREEN) static void -_gdk_screen_broadway_class_init (GdkScreenBroadwayClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = gdk_screen_broadway_dispose; - object_class->finalize = gdk_screen_broadway_finalize; -} - -static void -_gdk_screen_broadway_init (GdkScreenBroadway *screen) +gdk_broadway_screen_init (GdkBroadwayScreen *screen) { screen->width = 1024; screen->height = 768; } -GdkDisplay * -gdk_screen_get_display (GdkScreen *screen) +static GdkDisplay * +gdk_broadway_screen_get_display (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return GDK_SCREEN_BROADWAY (screen)->display; + return GDK_BROADWAY_SCREEN (screen)->display; } -gint -gdk_screen_get_width (GdkScreen *screen) +static gint +gdk_broadway_screen_get_width (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return GDK_SCREEN_BROADWAY (screen)->width; + return GDK_BROADWAY_SCREEN (screen)->width; } -gint -gdk_screen_get_height (GdkScreen *screen) +static gint +gdk_broadway_screen_get_height (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return GDK_SCREEN_BROADWAY (screen)->height; + return GDK_BROADWAY_SCREEN (screen)->height; } -gint -gdk_screen_get_width_mm (GdkScreen *screen) +static gint +gdk_broadway_screen_get_width_mm (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); return gdk_screen_get_width (screen) * 25.4 / 96; } -gint -gdk_screen_get_height_mm (GdkScreen *screen) +static gint +gdk_broadway_screen_get_height_mm (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); return gdk_screen_get_height (screen) * 25.4 / 96; } -gint -gdk_screen_get_number (GdkScreen *screen) +static gint +gdk_broadway_screen_get_number (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); return 0; } -GdkWindow * -gdk_screen_get_root_window (GdkScreen *screen) +static GdkWindow * +gdk_broadway_screen_get_root_window (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return GDK_SCREEN_BROADWAY (screen)->root_window; + return GDK_BROADWAY_SCREEN (screen)->root_window; } static void -gdk_screen_broadway_dispose (GObject *object) +gdk_broadway_screen_dispose (GObject *object) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (object); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (object); - if (screen_broadway->root_window) - _gdk_window_destroy (screen_broadway->root_window, TRUE); + if (broadway_screen->root_window) + _gdk_window_destroy (broadway_screen->root_window, TRUE); - G_OBJECT_CLASS (_gdk_screen_broadway_parent_class)->dispose (object); + G_OBJECT_CLASS (gdk_broadway_screen_parent_class)->dispose (object); } static void -gdk_screen_broadway_finalize (GObject *object) +gdk_broadway_screen_finalize (GObject *object) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (object); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (object); gint i; - if (screen_broadway->root_window) - g_object_unref (screen_broadway->root_window); + if (broadway_screen->root_window) + g_object_unref (broadway_screen->root_window); /* Visual Part */ - for (i = 0; i < screen_broadway->nvisuals; i++) - g_object_unref (screen_broadway->visuals[i]); - g_free (screen_broadway->visuals); + for (i = 0; i < broadway_screen->nvisuals; i++) + g_object_unref (broadway_screen->visuals[i]); + g_free (broadway_screen->visuals); - G_OBJECT_CLASS (_gdk_screen_broadway_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_broadway_screen_parent_class)->finalize (object); } -gint -gdk_screen_get_n_monitors (GdkScreen *screen) +static gint +gdk_broadway_screen_get_n_monitors (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); return 1; } -gint -gdk_screen_get_primary_monitor (GdkScreen *screen) +static gint +gdk_broadway_screen_get_primary_monitor (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); return 0; } -gint -gdk_screen_get_monitor_width_mm (GdkScreen *screen, - gint monitor_num) +static gint +gdk_broadway_screen_get_monitor_width_mm (GdkScreen *screen, + gint monitor_num) { g_return_val_if_fail (GDK_IS_SCREEN (screen), -1); g_return_val_if_fail (monitor_num == 0, -1); @@ -165,9 +156,9 @@ gdk_screen_get_monitor_width_mm (GdkScreen *screen, return gdk_screen_get_width_mm (screen); } -gint -gdk_screen_get_monitor_height_mm (GdkScreen *screen, - gint monitor_num) +static gint +gdk_broadway_screen_get_monitor_height_mm (GdkScreen *screen, + gint monitor_num) { g_return_val_if_fail (GDK_IS_SCREEN (screen), -1); g_return_val_if_fail (monitor_num == 0, -1); @@ -175,9 +166,9 @@ gdk_screen_get_monitor_height_mm (GdkScreen *screen, return gdk_screen_get_height_mm (screen); } -gchar * -gdk_screen_get_monitor_plug_name (GdkScreen *screen, - gint monitor_num) +static gchar * +gdk_broadway_screen_get_monitor_plug_name (GdkScreen *screen, + gint monitor_num) { g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); g_return_val_if_fail (monitor_num == 0, NULL); @@ -185,26 +176,12 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen, return g_strdup ("browser"); } -/** - * gdk_screen_get_monitor_geometry: - * @screen: a #GdkScreen - * @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen) - * @dest: a #GdkRectangle to be filled with the monitor geometry - * - * Retrieves the #GdkRectangle representing the size and position of - * the individual monitor within the entire screen area. - * - * Note that the size of the entire screen area can be retrieved via - * gdk_screen_get_width() and gdk_screen_get_height(). - * - * Since: 2.2 - */ -void -gdk_screen_get_monitor_geometry (GdkScreen *screen, - gint monitor_num, - GdkRectangle *dest) +static void +gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen, + gint monitor_num, + GdkRectangle *dest) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (screen); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); g_return_if_fail (GDK_IS_SCREEN (screen)); g_return_if_fail (monitor_num == 0); @@ -213,36 +190,36 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen, { dest->x = 0; dest->y = 0; - dest->width = screen_broadway->width; - dest->height = screen_broadway->height; + dest->width = broadway_screen->width; + dest->height = broadway_screen->height; } } -GdkVisual * -gdk_screen_get_rgba_visual (GdkScreen *screen) +static GdkVisual * +gdk_broadway_screen_get_rgba_visual (GdkScreen *screen) { - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - screen_broadway = GDK_SCREEN_BROADWAY (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); - return screen_broadway->rgba_visual; + return broadway_screen->rgba_visual; } GdkScreen * _gdk_broadway_screen_new (GdkDisplay *display, - gint screen_number) + gint screen_number) { GdkScreen *screen; - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; - screen = g_object_new (GDK_TYPE_SCREEN_BROADWAY, NULL); + screen = g_object_new (GDK_TYPE_BROADWAY_SCREEN, NULL); - screen_broadway = GDK_SCREEN_BROADWAY (screen); - screen_broadway->display = display; - _gdk_visual_init (screen); - _gdk_windowing_window_init (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); + broadway_screen->display = display; + _gdk_broadway_screen_init_visuals (screen); + _gdk_broadway_screen_init_root_window (screen); return screen; } @@ -257,61 +234,55 @@ _gdk_broadway_screen_setup (GdkScreen *screen) { } -gboolean -gdk_screen_is_composited (GdkScreen *screen) +static gboolean +gdk_broadway_screen_is_composited (GdkScreen *screen) { - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); - screen_broadway = GDK_SCREEN_BROADWAY (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); return FALSE; } -gchar * -gdk_screen_make_display_name (GdkScreen *screen) +static gchar * +gdk_broadway_screen_make_display_name (GdkScreen *screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); return g_strdup ("browser"); } -GdkWindow * -gdk_screen_get_active_window (GdkScreen *screen) +static GdkWindow * +gdk_broadway_screen_get_active_window (GdkScreen *screen) { return NULL; } -GList * -gdk_screen_get_window_stack (GdkScreen *screen) +static GList * +gdk_broadway_screen_get_window_stack (GdkScreen *screen) { return NULL; } -void -gdk_screen_broadcast_client_message (GdkScreen *screen, - GdkEvent *event) -{ -} - -gboolean -gdk_screen_get_setting (GdkScreen *screen, - const gchar *name, - GValue *value) +static void +gdk_broadway_screen_broadcast_client_message (GdkScreen *screen, + GdkEvent *event) { - return FALSE; } -gboolean -gdk_net_wm_supports (GdkAtom property) +static gboolean +gdk_broadway_screen_get_setting (GdkScreen *screen, + const gchar *name, + GValue *value) { return FALSE; } void -_gdk_screen_broadway_events_init (GdkScreen *screen) +_gdk_broadway_screen_events_init (GdkScreen *screen) { } @@ -322,3 +293,44 @@ _gdk_windowing_substitute_screen_number (const gchar *display_name, return g_strdup ("browser"); } +static void +gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass); + + object_class->dispose = gdk_broadway_screen_dispose; + object_class->finalize = gdk_broadway_screen_finalize; + + screen_class->get_display = gdk_broadway_screen_get_display; + screen_class->get_width = gdk_broadway_screen_get_width; + screen_class->get_height = gdk_broadway_screen_get_height; + screen_class->get_width_mm = gdk_broadway_screen_get_width_mm; + screen_class->get_height_mm = gdk_broadway_screen_get_height_mm; + screen_class->get_number = gdk_broadway_screen_get_number; + screen_class->get_root_window = gdk_broadway_screen_get_root_window; + screen_class->get_n_monitors = gdk_broadway_screen_get_n_monitors; + screen_class->get_primary_monitor = gdk_broadway_screen_get_primary_monitor; + screen_class->get_monitor_width_mm = gdk_broadway_screen_get_monitor_width_mm; + screen_class->get_monitor_height_mm = gdk_broadway_screen_get_monitor_height_mm; + screen_class->get_monitor_plug_name = gdk_broadway_screen_get_monitor_plug_name; + screen_class->get_monitor_geometry = gdk_broadway_screen_get_monitor_geometry; + screen_class->is_composited = gdk_broadway_screen_is_composited; + screen_class->make_display_name = gdk_broadway_screen_make_display_name; + screen_class->get_active_window = gdk_broadway_screen_get_active_window; + screen_class->get_window_stack = gdk_broadway_screen_get_window_stack; + screen_class->broadcast_client_message = gdk_broadway_screen_broadcast_client_message; + screen_class->get_setting = gdk_broadway_screen_get_setting; + screen_class->get_rgba_visual = gdk_broadway_screen_get_rgba_visual; + screen_class->get_system_visual = _gdk_broadway_screen_get_system_visual; + screen_class->visual_get_best_depth = _gdk_broadway_screen_visual_get_best_depth; + screen_class->visual_get_best_type = _gdk_broadway_screen_visual_get_best_type; + screen_class->visual_get_best = _gdk_broadway_screen_visual_get_best; + screen_class->visual_get_best_with_depth = _gdk_broadway_screen_visual_get_best_with_depth; + screen_class->visual_get_best_with_type = _gdk_broadway_screen_visual_get_best_with_type; + screen_class->visual_get_best_with_both = _gdk_broadway_screen_visual_get_best_with_both; + screen_class->query_depths = _gdk_broadway_screen_query_depths; + screen_class->query_visual_types = _gdk_broadway_screen_query_visual_types; + screen_class->list_visuals = _gdk_broadway_screen_list_visuals; +} + diff --git a/gdk/broadway/gdkscreen-broadway.h b/gdk/broadway/gdkscreen-broadway.h index d4b730b7e1..df1f865e3b 100644 --- a/gdk/broadway/gdkscreen-broadway.h +++ b/gdk/broadway/gdkscreen-broadway.h @@ -21,28 +21,28 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GDK_SCREEN_BROADWAY_H__ -#define __GDK_SCREEN_BROADWAY_H__ +#ifndef __GDK_BROADWAY_SCREEN_H__ +#define __GDK_BROADWAY_SCREEN_H__ -#include <gdk/gdkscreen.h> +#include <gdk/gdkscreenprivate.h> #include <gdk/gdkvisual.h> #include "gdkprivate-broadway.h" G_BEGIN_DECLS -typedef struct _GdkScreenBroadway GdkScreenBroadway; -typedef struct _GdkScreenBroadwayClass GdkScreenBroadwayClass; +typedef struct _GdkBroadwayScreen GdkBroadwayScreen; +typedef struct _GdkBroadwayScreenClass GdkBroadwayScreenClass; -#define GDK_TYPE_SCREEN_BROADWAY (_gdk_screen_broadway_get_type ()) -#define GDK_SCREEN_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SCREEN_BROADWAY, GdkScreenBroadway)) -#define GDK_SCREEN_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SCREEN_BROADWAY, GdkScreenBroadwayClass)) -#define GDK_IS_SCREEN_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SCREEN_BROADWAY)) -#define GDK_IS_SCREEN_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SCREEN_BROADWAY)) -#define GDK_SCREEN_BROADWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SCREEN_BROADWAY, GdkScreenBroadwayClass)) +#define GDK_TYPE_BROADWAY_SCREEN (gdk_broadway_screen_get_type ()) +#define GDK_BROADWAY_SCREEN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_SCREEN, GdkBroadwayScreen)) +#define GDK_BROADWAY_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_SCREEN, GdkBroadwayScreenClass)) +#define GDK_IS_BROADWAY_SCREEN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_SCREEN)) +#define GDK_IS_BROADWAY_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SCREEN)) +#define GDK_BROADWAY_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SCREEN, GdkBroadwayScreenClass)) typedef struct _GdkBroadwayMonitor GdkBroadwayMonitor; -struct _GdkScreenBroadway +struct _GdkBroadwayScreen { GdkScreen parent_instance; @@ -63,18 +63,18 @@ struct _GdkScreenBroadway gint navailable_types; }; -struct _GdkScreenBroadwayClass +struct _GdkBroadwayScreenClass { GdkScreenClass parent_class; - void (* window_manager_changed) (GdkScreenBroadway *screen_broadway); + void (* window_manager_changed) (GdkBroadwayScreen *screen); }; -GType _gdk_screen_broadway_get_type (void); +GType gdk_broadway_screen_get_type (void); GdkScreen * _gdk_broadway_screen_new (GdkDisplay *display, gint screen_number); -void _gdk_broadway_screen_setup (GdkScreen *screen); +void _gdk_broadway_screen_setup (GdkScreen *screen); G_END_DECLS -#endif /* __GDK_SCREEN_BROADWAY_H__ */ +#endif /* __GDK_BROADWAY_SCREEN_H__ */ diff --git a/gdk/broadway/gdkselection-broadway.c b/gdk/broadway/gdkselection-broadway.c index e466e830cc..dbcfe2ae9f 100644 --- a/gdk/broadway/gdkselection-broadway.c +++ b/gdk/broadway/gdkselection-broadway.c @@ -70,35 +70,37 @@ _gdk_selection_window_destroyed (GdkWindow *window) } gboolean -gdk_selection_owner_set_for_display (GdkDisplay *display, - GdkWindow *owner, - GdkAtom selection, - guint32 time, - gboolean send_event) +_gdk_broadway_display_set_selection_owner (GdkDisplay *display, + GdkWindow *owner, + GdkAtom selection, + guint32 time, + gboolean send_event) { return FALSE; } GdkWindow * -gdk_selection_owner_get_for_display (GdkDisplay *display, - GdkAtom selection) +_gdk_broadway_display_get_selection_owner (GdkDisplay *display, + GdkAtom selection) { return NULL; } void -gdk_selection_convert (GdkWindow *requestor, - GdkAtom selection, - GdkAtom target, - guint32 time) +_gdk_broadway_display_convert_selection (GdkDisplay *display, + GdkWindow *requestor, + GdkAtom selection, + GdkAtom target, + guint32 time) { } gint -gdk_selection_property_get (GdkWindow *requestor, - guchar **data, - GdkAtom *ret_type, - gint *ret_format) +_gdk_broadway_display_get_selection_property (GdkDisplay *display, + GdkWindow *requestor, + guchar **data, + GdkAtom *ret_type, + gint *ret_format) { if (ret_type) *ret_type = GDK_NONE; @@ -111,42 +113,23 @@ gdk_selection_property_get (GdkWindow *requestor, } void -gdk_selection_send_notify_for_display (GdkDisplay *display, - GdkNativeWindow requestor, - GdkAtom selection, - GdkAtom target, - GdkAtom property, - guint32 time) +_gdk_broadway_display_send_selection_notify (GdkDisplay *display, + GdkNativeWindow requestor, + GdkAtom selection, + GdkAtom target, + GdkAtom property, + guint32 time) { g_return_if_fail (GDK_IS_DISPLAY (display)); } -gint -gdk_text_property_to_text_list_for_display (GdkDisplay *display, - GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list) -{ - return 0; -} - -void -gdk_free_text_list (gchar **list) -{ - g_return_if_fail (list != NULL); - - g_strfreev (list); -} - gint -gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, - GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list) +_gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list) { g_return_val_if_fail (text != NULL, 0); g_return_val_if_fail (length >= 0, 0); @@ -155,37 +138,9 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, return 0; } -gint -gdk_string_to_compound_text_for_display (GdkDisplay *display, - const gchar *str, - GdkAtom *encoding, - gint *format, - guchar **ctext, - gint *length) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); - - return 1; -} - gchar * -gdk_utf8_to_string_target (const gchar *str) +_gdk_broadway_display_utf8_to_string_target (GdkDisplay *display, + const gchar *str) { return g_strdup (str); } - -gboolean -gdk_utf8_to_compound_text_for_display (GdkDisplay *display, - const gchar *str, - GdkAtom *encoding, - gint *format, - guchar **ctext, - gint *length) -{ - return FALSE; -} - -void gdk_free_compound_text (guchar *ctext) -{ - g_free (ctext); -} diff --git a/gdk/broadway/gdkspawn-broadway.c b/gdk/broadway/gdkspawn-broadway.c deleted file mode 100644 index 17db0d92b4..0000000000 --- a/gdk/broadway/gdkspawn-broadway.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2003 Sun Microsystems Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library 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. - * - * Authors: Mark McLoughlin <mark@skynet.ie> - */ - -#include "config.h" - -#include "gdkspawn.h" - -#include <glib.h> -#include <string.h> -#include <stdlib.h> - - -typedef struct { - char *display; - GSpawnChildSetupFunc child_setup; - gpointer user_data; -} UserChildSetup; - -static void -set_environment (gpointer user_data) -{ - UserChildSetup *setup = user_data; - - g_setenv ("DISPLAY", setup->display, TRUE); - - if (setup->child_setup) - setup->child_setup (setup->user_data); -} - -gboolean -gdk_spawn_on_screen (GdkScreen *screen, - const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - GPid *child_pid, - GError **error) -{ - UserChildSetup setup_data; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); - - setup_data.display = gdk_screen_make_display_name (screen); - setup_data.child_setup = child_setup; - setup_data.user_data = user_data; - - return g_spawn_async (working_directory, - argv, - envp, - flags, - set_environment, - &setup_data, - child_pid, - error); -} - -gboolean -gdk_spawn_on_screen_with_pipes (GdkScreen *screen, - const gchar *working_directory, - gchar **argv, - gchar **envp, - GSpawnFlags flags, - GSpawnChildSetupFunc child_setup, - gpointer user_data, - GPid *child_pid, - gint *standard_input, - gint *standard_output, - gint *standard_error, - GError **error) -{ - UserChildSetup setup_data; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); - - setup_data.display = gdk_screen_make_display_name (screen); - setup_data.child_setup = child_setup; - setup_data.user_data = user_data; - - return g_spawn_async_with_pipes (working_directory, - argv, - envp, - flags, - set_environment, - &setup_data, - child_pid, - standard_input, - standard_output, - standard_error, - error); - -} - -gboolean -gdk_spawn_command_line_on_screen (GdkScreen *screen, - const gchar *command_line, - GError **error) -{ - gchar **argv = NULL; - gboolean retval; - - g_return_val_if_fail (command_line != NULL, FALSE); - - if (!g_shell_parse_argv (command_line, - NULL, &argv, - error)) - return FALSE; - - retval = gdk_spawn_on_screen (screen, - NULL, argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, - error); - g_strfreev (argv); - - return retval; -} diff --git a/gdk/broadway/gdktestutils-broadway.c b/gdk/broadway/gdktestutils-broadway.c index ad41d767d2..ed6f25b177 100644 --- a/gdk/broadway/gdktestutils-broadway.c +++ b/gdk/broadway/gdktestutils-broadway.c @@ -17,36 +17,51 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ - #include "config.h" - -#include "gdktestutils.h" - -#include "gdkkeysyms.h" +#include <gdk/gdktestutils.h> +#include <gdk/gdkkeysyms.h> +#include <gdk/gdkinternals.h> void -gdk_test_render_sync (GdkWindow *window) +_gdk_broadway_window_sync_rendering (GdkWindow *window) { + /* FIXME: Find out if there is a way to implement this on broadway. */ } gboolean -gdk_test_simulate_key (GdkWindow *window, - gint x, - gint y, - guint keyval, - GdkModifierType modifiers, - GdkEventType key_pressrelease) +_gdk_broadway_window_simulate_key (GdkWindow *window, + gint x, + gint y, + guint keyval, + GdkModifierType modifiers, + GdkEventType key_pressrelease) { + g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE); + g_return_val_if_fail (window != NULL, FALSE); + + if (!GDK_WINDOW_IS_MAPPED (window)) + return FALSE; + + /* FIXME: Implement. */ + return FALSE; } gboolean -gdk_test_simulate_button (GdkWindow *window, - gint x, - gint y, - guint button, /*1..3*/ - GdkModifierType modifiers, - GdkEventType button_pressrelease) +_gdk_broadway_window_simulate_button (GdkWindow *window, + gint x, + gint y, + guint button, /*1..3*/ + GdkModifierType modifiers, + GdkEventType button_pressrelease) { + g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE); + g_return_val_if_fail (window != NULL, FALSE); + + if (!GDK_WINDOW_IS_MAPPED (window)) + return FALSE; + + /* FIXME: Implement. */ + return FALSE; } diff --git a/gdk/broadway/gdkvisual-broadway.c b/gdk/broadway/gdkvisual-broadway.c index ff77d3bcf8..26df16fc48 100644 --- a/gdk/broadway/gdkvisual-broadway.c +++ b/gdk/broadway/gdkvisual-broadway.c @@ -26,18 +26,18 @@ #include "config.h" -#include "gdkvisual.h" +#include "gdkvisualprivate.h" #include "gdkprivate-broadway.h" #include "gdkscreen-broadway.h" #include "gdkinternals.h" -struct _GdkVisualPrivate +struct _GdkBroadwayVisual { - GdkScreen *screen; + GdkVisual visual; }; -struct _GdkVisualClass +struct _GdkBroadwayVisualClass { GObjectClass parent_class; }; @@ -47,48 +47,42 @@ static void gdk_visual_decompose_mask (gulong mask, gint *prec); -G_DEFINE_TYPE (GdkVisual, gdk_visual, G_TYPE_OBJECT) +G_DEFINE_TYPE (GdkBroadwayVisual, gdk_broadway_visual, GDK_TYPE_VISUAL) static void -gdk_visual_finalize (GObject *object) +gdk_broadway_visual_finalize (GObject *object) { - G_OBJECT_CLASS (gdk_visual_parent_class)->finalize (object); + G_OBJECT_CLASS (gdk_broadway_visual_parent_class)->finalize (object); } static void -gdk_visual_class_init (GdkVisualClass *visual_class) +gdk_broadway_visual_class_init (GdkBroadwayVisualClass *visual_class) { GObjectClass *object_class = G_OBJECT_CLASS (visual_class); - g_type_class_add_private (object_class, sizeof (GdkVisualPrivate)); - - object_class->finalize = gdk_visual_finalize; + object_class->finalize = gdk_broadway_visual_finalize; } static void -gdk_visual_init (GdkVisual *visual) +gdk_broadway_visual_init (GdkBroadwayVisual *visual) { - visual->priv = G_TYPE_INSTANCE_GET_PRIVATE (visual, - GDK_TYPE_VISUAL, - GdkVisualPrivate); - } void -_gdk_visual_init (GdkScreen *screen) +_gdk_broadway_screen_init_visuals (GdkScreen *screen) { - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; GdkVisual **visuals; int nvisuals; g_return_if_fail (GDK_IS_SCREEN (screen)); - screen_broadway = GDK_SCREEN_BROADWAY (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); nvisuals = 2; visuals = g_new (GdkVisual *, nvisuals); - visuals[0] = g_object_new (GDK_TYPE_VISUAL, NULL); - visuals[0]->priv->screen = screen; + visuals[0] = g_object_new (GDK_TYPE_BROADWAY_VISUAL, NULL); + visuals[0]->screen = screen; visuals[0]->type = GDK_VISUAL_TRUE_COLOR; visuals[0]->depth = 32; visuals[0]->byte_order = (G_BYTE_ORDER == G_LITTLE_ENDIAN) ? GDK_LSB_FIRST : GDK_MSB_FIRST; @@ -107,8 +101,8 @@ _gdk_visual_init (GdkScreen *screen) &visuals[0]->blue_shift, &visuals[0]->blue_prec); - visuals[1] = g_object_new (GDK_TYPE_VISUAL, NULL); - visuals[1]->priv->screen = screen; + visuals[1] = g_object_new (GDK_TYPE_BROADWAY_VISUAL, NULL); + visuals[1]->screen = screen; visuals[1]->type = GDK_VISUAL_TRUE_COLOR; visuals[1]->depth = 24; visuals[1]->byte_order = (G_BYTE_ORDER == G_LITTLE_ENDIAN) ? GDK_LSB_FIRST : GDK_MSB_FIRST; @@ -127,64 +121,61 @@ _gdk_visual_init (GdkScreen *screen) &visuals[1]->blue_shift, &visuals[1]->blue_prec); - screen_broadway->system_visual = visuals[1]; - screen_broadway->rgba_visual = visuals[0]; + broadway_screen->system_visual = visuals[1]; + broadway_screen->rgba_visual = visuals[0]; - screen_broadway->navailable_depths = 2; - screen_broadway->available_depths[0] = 32; - screen_broadway->available_depths[1] = 24; + broadway_screen->navailable_depths = 2; + broadway_screen->available_depths[0] = 32; + broadway_screen->available_depths[1] = 24; - screen_broadway->navailable_types = 1; - screen_broadway->available_types[0] = GDK_VISUAL_TRUE_COLOR; + broadway_screen->navailable_types = 1; + broadway_screen->available_types[0] = GDK_VISUAL_TRUE_COLOR; - screen_broadway->visuals = visuals; - screen_broadway->nvisuals = nvisuals; + broadway_screen->visuals = visuals; + broadway_screen->nvisuals = nvisuals; } gint -gdk_visual_get_best_depth (void) +_gdk_broadway_screen_visual_get_best_depth (GdkScreen * screen) { - GdkScreen *screen = gdk_screen_get_default(); - - return GDK_SCREEN_BROADWAY (screen)->available_depths[0]; + return GDK_BROADWAY_SCREEN (screen)->available_depths[0]; } GdkVisualType -gdk_visual_get_best_type (void) +_gdk_broadway_screen_visual_get_best_type (GdkScreen * screen) { - GdkScreen *screen = gdk_screen_get_default(); - - return GDK_SCREEN_BROADWAY (screen)->available_types[0]; + return GDK_BROADWAY_SCREEN (screen)->available_types[0]; } GdkVisual * -gdk_screen_get_system_visual (GdkScreen * screen) +_gdk_broadway_screen_get_system_visual (GdkScreen * screen) { g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return ((GdkVisual *) GDK_SCREEN_BROADWAY (screen)->system_visual); + return ((GdkVisual *) GDK_BROADWAY_SCREEN (screen)->system_visual); } GdkVisual* -gdk_visual_get_best (void) +_gdk_broadway_screen_visual_get_best (GdkScreen * screen) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); - return (GdkVisual *)screen_broadway->visuals[0]; + return (GdkVisual *)broadway_screen->visuals[0]; } GdkVisual* -gdk_visual_get_best_with_depth (gint depth) +_gdk_broadway_screen_visual_get_best_with_depth (GdkScreen * screen, + gint depth) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default ()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); GdkVisual *return_val; int i; return_val = NULL; - for (i = 0; i < screen_broadway->nvisuals; i++) - if (depth == screen_broadway->visuals[i]->depth) + for (i = 0; i < broadway_screen->nvisuals; i++) + if (depth == broadway_screen->visuals[i]->depth) { - return_val = (GdkVisual *) screen_broadway->visuals[i]; + return_val = (GdkVisual *) broadway_screen->visuals[i]; break; } @@ -192,17 +183,18 @@ gdk_visual_get_best_with_depth (gint depth) } GdkVisual* -gdk_visual_get_best_with_type (GdkVisualType visual_type) +_gdk_broadway_screen_visual_get_best_with_type (GdkScreen * screen, + GdkVisualType visual_type) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default ()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); GdkVisual *return_val; int i; return_val = NULL; - for (i = 0; i < screen_broadway->nvisuals; i++) - if (visual_type == screen_broadway->visuals[i]->type) + for (i = 0; i < broadway_screen->nvisuals; i++) + if (visual_type == broadway_screen->visuals[i]->type) { - return_val = (GdkVisual *) screen_broadway->visuals[i]; + return_val = (GdkVisual *) broadway_screen->visuals[i]; break; } @@ -210,19 +202,20 @@ gdk_visual_get_best_with_type (GdkVisualType visual_type) } GdkVisual* -gdk_visual_get_best_with_both (gint depth, - GdkVisualType visual_type) +_gdk_broadway_screen_visual_get_best_with_both (GdkScreen * screen, + gint depth, + GdkVisualType visual_type) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default ()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); GdkVisual *return_val; int i; return_val = NULL; - for (i = 0; i < screen_broadway->nvisuals; i++) - if ((depth == screen_broadway->visuals[i]->depth) && - (visual_type == screen_broadway->visuals[i]->type)) + for (i = 0; i < broadway_screen->nvisuals; i++) + if ((depth == broadway_screen->visuals[i]->depth) && + (visual_type == broadway_screen->visuals[i]->type)) { - return_val = (GdkVisual *) screen_broadway->visuals[i]; + return_val = (GdkVisual *) broadway_screen->visuals[i]; break; } @@ -230,39 +223,41 @@ gdk_visual_get_best_with_both (gint depth, } void -gdk_query_depths (gint **depths, - gint *count) +_gdk_broadway_screen_query_depths (GdkScreen * screen, + gint **depths, + gint *count) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default ()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); - *count = screen_broadway->navailable_depths; - *depths = screen_broadway->available_depths; + *count = broadway_screen->navailable_depths; + *depths = broadway_screen->available_depths; } void -gdk_query_visual_types (GdkVisualType **visual_types, - gint *count) +_gdk_broadway_screen_query_visual_types (GdkScreen * screen, + GdkVisualType **visual_types, + gint *count) { - GdkScreenBroadway *screen_broadway = GDK_SCREEN_BROADWAY (gdk_screen_get_default ()); + GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); - *count = screen_broadway->navailable_types; - *visual_types = screen_broadway->available_types; + *count = broadway_screen->navailable_types; + *visual_types = broadway_screen->available_types; } GList * -gdk_screen_list_visuals (GdkScreen *screen) +_gdk_broadway_screen_list_visuals (GdkScreen *screen) { GList *list; - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; guint i; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - screen_broadway = GDK_SCREEN_BROADWAY (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); list = NULL; - for (i = 0; i < screen_broadway->nvisuals; ++i) - list = g_list_append (list, screen_broadway->visuals[i]); + for (i = 0; i < broadway_screen->nvisuals; ++i) + list = g_list_append (list, broadway_screen->visuals[i]); return list; } @@ -293,11 +288,3 @@ gdk_visual_decompose_mask (gulong mask, mask >>= 1; } } - -GdkScreen * -gdk_visual_get_screen (GdkVisual *visual) -{ - g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL); - - return visual->priv->screen; -} diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c index 8098fc90d9..3ff7ad54a7 100644 --- a/gdk/broadway/gdkwindow-broadway.c +++ b/gdk/broadway/gdkwindow-broadway.c @@ -61,6 +61,26 @@ static const cairo_user_data_key_t gdk_broadway_cairo_key; GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \ GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN) +struct _GdkBroadwayWindow { + GdkWindow parent; +}; + +struct _GdkBroadwayWindowClass { + GdkWindowClass parent_class; +}; + +G_DEFINE_TYPE (GdkBroadwayWindow, gdk_broadway_window, GDK_TYPE_WINDOW) + +static void +gdk_broadway_window_class_init (GdkBroadwayWindowClass *broadway_window_class) +{ +} + +static void +gdk_broadway_window_init (GdkBroadwayWindow *broadway_window) +{ +} + G_DEFINE_TYPE (GdkWindowImplBroadway, gdk_window_impl_broadway, GDK_TYPE_WINDOW_IMPL) @@ -143,12 +163,12 @@ static gboolean dirty_flush_idle (gpointer data) { GList *l; - GdkDisplayBroadway *display; + GdkBroadwayDisplay *display; BroadwayOutput *output; dirty_flush_id = 0; - display = GDK_DISPLAY_BROADWAY (gdk_display_get_default ()); + display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ()); output = display->output; if (output == NULL) return FALSE; @@ -174,7 +194,7 @@ dirty_flush_idle (gpointer data) } static void -queue_dirty_flush (GdkDisplayBroadway *display) +queue_dirty_flush (GdkBroadwayDisplay *display) { if (dirty_flush_id == 0 && display->output != NULL) dirty_flush_id = gdk_threads_add_idle (dirty_flush_idle, NULL); @@ -183,12 +203,12 @@ queue_dirty_flush (GdkDisplayBroadway *display) void _gdk_broadway_resync_windows (void) { - GdkDisplayBroadway *display; + GdkBroadwayDisplay *display; GList *l; dirty_flush_id = 0; - display = GDK_DISPLAY_BROADWAY (gdk_display_get_default ()); + display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ()); for (l = display->toplevels; l != NULL; l = l->next) { @@ -231,7 +251,7 @@ gdk_window_impl_broadway_finalize (GObject *object) { GdkWindow *wrapper; GdkWindowImplBroadway *impl; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; g_return_if_fail (GDK_IS_WINDOW_IMPL_BROADWAY (object)); @@ -239,40 +259,40 @@ gdk_window_impl_broadway_finalize (GObject *object) wrapper = impl->wrapper; - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (impl->wrapper)); + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper)); - if (display_broadway->mouse_in_toplevel == GDK_WINDOW (wrapper)) + if (broadway_display->mouse_in_toplevel == GDK_WINDOW (wrapper)) { /* TODO: Send leave + enter event, update cursors, etc */ - display_broadway->mouse_in_toplevel = NULL; + broadway_display->mouse_in_toplevel = NULL; } - g_hash_table_remove (display_broadway->id_ht, GINT_TO_POINTER(impl->id)); + g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id)); if (impl->cursor) gdk_cursor_unref (impl->cursor); g_hash_table_destroy (impl->device_cursor); - display_broadway->toplevels = g_list_remove (display_broadway->toplevels, impl); + broadway_display->toplevels = g_list_remove (broadway_display->toplevels, impl); G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object); } void -_gdk_windowing_window_init (GdkScreen * screen) +_gdk_broadway_screen_init_root_window (GdkScreen * screen) { GdkWindow *window; GdkWindowImplBroadway *impl; - GdkScreenBroadway *screen_broadway; + GdkBroadwayScreen *broadway_screen; - screen_broadway = GDK_SCREEN_BROADWAY (screen); + broadway_screen = GDK_BROADWAY_SCREEN (screen); - g_assert (screen_broadway->root_window == NULL); + g_assert (broadway_screen->root_window == NULL); - screen_broadway->root_window = g_object_new (GDK_TYPE_WINDOW, NULL); + broadway_screen->root_window = g_object_new (GDK_TYPE_BROADWAY_WINDOW, NULL); - window = screen_broadway->root_window; + window = broadway_screen->root_window; window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL); window->impl_window = window; window->visual = gdk_screen_get_system_visual (screen); @@ -293,29 +313,30 @@ _gdk_windowing_window_init (GdkScreen * screen) window->height = gdk_screen_get_height (screen); window->viewable = TRUE; - _gdk_window_update_size (screen_broadway->root_window); + _gdk_window_update_size (broadway_screen->root_window); } void -_gdk_window_impl_new (GdkWindow *window, - GdkWindow *real_parent, - GdkScreen *screen, - GdkEventMask event_mask, - GdkWindowAttr *attributes, - gint attributes_mask) +_gdk_broadway_display_create_window_impl (GdkDisplay *display, + GdkWindow *window, + GdkWindow *real_parent, + GdkScreen *screen, + GdkEventMask event_mask, + GdkWindowAttr *attributes, + gint attributes_mask) { GdkWindowImplBroadway *impl; - GdkScreenBroadway *screen_broadway; - GdkDisplayBroadway *display_broadway; + GdkBroadwayScreen *broadway_screen; + GdkBroadwayDisplay *broadway_display; static int current_id = 1; /* 0 is the root window */ - screen_broadway = GDK_SCREEN_BROADWAY (screen); - display_broadway = GDK_DISPLAY_BROADWAY (GDK_SCREEN_DISPLAY (screen)); + broadway_display = GDK_BROADWAY_DISPLAY (display); + broadway_screen = GDK_BROADWAY_SCREEN (screen); impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL); window->impl = (GdkWindowImpl *)impl; impl->id = current_id++; - g_hash_table_insert (display_broadway->id_ht, GINT_TO_POINTER(impl->id), window); + g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), window); impl->wrapper = window; impl->screen = screen; @@ -324,7 +345,7 @@ _gdk_window_impl_new (GdkWindow *window, window->window_type == GDK_WINDOW_TEMP); g_assert (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT); - display_broadway->toplevels = g_list_prepend (display_broadway->toplevels, impl); + broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl); /* Instead of window manager placement we have this mini hack so that the main/first window is not covered in the demos. */ @@ -334,8 +355,8 @@ _gdk_window_impl_new (GdkWindow *window, window->y = 20; } - if (display_broadway->output) - broadway_output_new_surface (display_broadway->output, + if (broadway_display->output) + broadway_output_new_surface (broadway_display->output, impl->id, window->x, window->y, @@ -343,26 +364,6 @@ _gdk_window_impl_new (GdkWindow *window, window->height); } - -GdkWindow * -gdk_window_foreign_new_for_display (GdkDisplay *display, - GdkNativeWindow anid) -{ - return NULL; -} - -GdkWindow * -gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) -{ - return NULL; -} - -GdkWindow * -gdk_window_lookup (GdkNativeWindow anid) -{ - return NULL; -} - static void resize_surface (GdkWindow *window) { @@ -465,7 +466,7 @@ _gdk_broadway_window_destroy (GdkWindow *window, gboolean foreign_destroy) { GdkWindowImplBroadway *impl; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -488,9 +489,9 @@ _gdk_broadway_window_destroy (GdkWindow *window, impl->last_surface = NULL; } - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)); - if (display_broadway->output) - broadway_output_destroy_surface (display_broadway->output, + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); + if (broadway_display->output) + broadway_output_destroy_surface (broadway_display->output, impl->id); } @@ -506,15 +507,15 @@ gdk_window_broadway_resize_cairo_surface (GdkWindow *window, return NULL; } -void -_gdk_windowing_window_destroy_foreign (GdkWindow *window) +static void +gdk_broadway_window_destroy_foreign (GdkWindow *window) { } /* This function is called when the XWindow is really gone. */ -void -gdk_window_destroy_notify (GdkWindow *window) +static void +gdk_broadway_window_destroy_notify (GdkWindow *window) { GdkWindowImplBroadway *window_impl; @@ -535,7 +536,7 @@ static void gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped) { GdkWindowImplBroadway *impl; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; impl = GDK_WINDOW_IMPL_BROADWAY (window->impl); @@ -545,11 +546,11 @@ gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped) if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK) _gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE); - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)); - if (display_broadway->output) + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); + if (broadway_display->output) { - broadway_output_show_surface (display_broadway->output, impl->id); - queue_dirty_flush (display_broadway); + broadway_output_show_surface (broadway_display->output, impl->id); + queue_dirty_flush (broadway_display); } } @@ -557,7 +558,7 @@ static void gdk_window_broadway_hide (GdkWindow *window) { GdkWindowImplBroadway *impl; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; impl = GDK_WINDOW_IMPL_BROADWAY (window->impl); @@ -567,17 +568,17 @@ gdk_window_broadway_hide (GdkWindow *window) if (window->parent && window->parent->event_mask & GDK_SUBSTRUCTURE_MASK) _gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE); - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)); - if (display_broadway->output) + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); + if (broadway_display->output) { - broadway_output_hide_surface (display_broadway->output, impl->id); - queue_dirty_flush (display_broadway); + broadway_output_hide_surface (broadway_display->output, impl->id); + queue_dirty_flush (broadway_display); } - if (display_broadway->mouse_in_toplevel == window) + if (broadway_display->mouse_in_toplevel == window) { /* TODO: Send leave + enter event, update cursors, etc */ - display_broadway->mouse_in_toplevel = NULL; + broadway_display->mouse_in_toplevel = NULL; } _gdk_window_clear_update_area (window); @@ -598,22 +599,22 @@ gdk_window_broadway_move_resize (GdkWindow *window, gint height) { GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl); - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; gboolean changed; changed = FALSE; - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)); + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); if (with_move) { changed = TRUE; window->x = x; window->y = y; - if (display_broadway->output != NULL) + if (broadway_display->output != NULL) { - broadway_output_move_surface (display_broadway->output, + broadway_output_move_surface (broadway_display->output, impl->id, x, y); - queue_dirty_flush (display_broadway); + queue_dirty_flush (broadway_display); } } @@ -635,9 +636,9 @@ gdk_window_broadway_move_resize (GdkWindow *window, impl->dirty = TRUE; impl->last_synced = FALSE; - broadway_output_resize_surface (display_broadway->output, + broadway_output_resize_surface (broadway_display->output, impl->id, width, height); - queue_dirty_flush (display_broadway); + queue_dirty_flush (broadway_display); window->width = width; window->height = height; @@ -658,10 +659,10 @@ gdk_window_broadway_move_resize (GdkWindow *window, event->configure.width = window->width; event->configure.height = window->height; - gdk_event_set_device (event, GDK_DISPLAY_OBJECT (display_broadway)->core_pointer); + gdk_event_set_device (event, GDK_DISPLAY_OBJECT (broadway_display)->core_pointer); - node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (display_broadway), event); - _gdk_windowing_got_event (GDK_DISPLAY_OBJECT (display_broadway), node, event, 0); + node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (broadway_display), event); + _gdk_windowing_got_event (GDK_DISPLAY_OBJECT (broadway_display), node, event, 0); } } @@ -698,90 +699,90 @@ gdk_window_broadway_lower (GdkWindow *window) } -void -gdk_window_focus (GdkWindow *window, - guint32 timestamp) +static void +gdk_broadway_window_focus (GdkWindow *window, + guint32 timestamp) { } -void -gdk_window_set_type_hint (GdkWindow *window, - GdkWindowTypeHint hint) +static void +gdk_broadway_window_set_type_hint (GdkWindow *window, + GdkWindowTypeHint hint) { } -GdkWindowTypeHint -gdk_window_get_type_hint (GdkWindow *window) +static GdkWindowTypeHint +gdk_broadway_window_get_type_hint (GdkWindow *window) { return GDK_WINDOW_TYPE_HINT_NORMAL; } -void -gdk_window_set_modal_hint (GdkWindow *window, - gboolean modal) +static void +gdk_broadway_window_set_modal_hint (GdkWindow *window, + gboolean modal) { } -void -gdk_window_set_skip_taskbar_hint (GdkWindow *window, - gboolean skips_taskbar) +static void +gdk_broadway_window_set_skip_taskbar_hint (GdkWindow *window, + gboolean skips_taskbar) { } -void -gdk_window_set_skip_pager_hint (GdkWindow *window, - gboolean skips_pager) +static void +gdk_broadway_window_set_skip_pager_hint (GdkWindow *window, + gboolean skips_pager) { } -void -gdk_window_set_urgency_hint (GdkWindow *window, - gboolean urgent) +static void +gdk_broadway_window_set_urgency_hint (GdkWindow *window, + gboolean urgent) { } -void -gdk_window_set_geometry_hints (GdkWindow *window, - const GdkGeometry *geometry, - GdkWindowHints geom_mask) +static void +gdk_broadway_window_set_geometry_hints (GdkWindow *window, + const GdkGeometry *geometry, + GdkWindowHints geom_mask) { } -void -gdk_window_set_title (GdkWindow *window, - const gchar *title) +static void +gdk_broadway_window_set_title (GdkWindow *window, + const gchar *title) { } -void -gdk_window_set_role (GdkWindow *window, - const gchar *role) +static void +gdk_broadway_window_set_role (GdkWindow *window, + const gchar *role) { } -void -gdk_window_set_startup_id (GdkWindow *window, - const gchar *startup_id) +static void +gdk_broadway_window_set_startup_id (GdkWindow *window, + const gchar *startup_id) { } -void -gdk_window_set_transient_for (GdkWindow *window, - GdkWindow *parent) +static void +gdk_broadway_window_set_transient_for (GdkWindow *window, + GdkWindow *parent) { } static void gdk_window_broadway_set_background (GdkWindow *window, - cairo_pattern_t *pattern) + cairo_pattern_t *pattern) { return; } static void gdk_window_broadway_set_device_cursor (GdkWindow *window, - GdkDevice *device, - GdkCursor *cursor) + GdkDevice *device, + GdkCursor *cursor) { GdkWindowImplBroadway *impl; @@ -817,11 +818,10 @@ _gdk_broadway_window_get_cursor (GdkWindow *window) static void gdk_window_broadway_get_geometry (GdkWindow *window, - gint *x, - gint *y, - gint *width, - gint *height, - gint *depth) + gint *x, + gint *y, + gint *width, + gint *height) { } @@ -840,10 +840,10 @@ gdk_window_broadway_get_root_coords (GdkWindow *window, return 1; } -void -gdk_window_get_root_origin (GdkWindow *window, - gint *x, - gint *y) +static void +gdk_broadway_window_get_root_origin (GdkWindow *window, + gint *x, + gint *y) { if (x) *x = 0; @@ -852,9 +852,9 @@ gdk_window_get_root_origin (GdkWindow *window, *y = 0; } -void -gdk_window_get_frame_extents (GdkWindow *window, - GdkRectangle *rect) +static void +gdk_broadway_window_get_frame_extents (GdkWindow *window, + GdkRectangle *rect) { g_return_if_fail (rect != NULL); @@ -864,23 +864,6 @@ gdk_window_get_frame_extents (GdkWindow *window, rect->height = window->height; } -void -_gdk_windowing_get_device_state (GdkDisplay *display, - GdkDevice *device, - GdkScreen **screen, - gint *x, - gint *y, - GdkModifierType *mask) -{ - if (display->closed) - return; - - *screen = gdk_display_get_default_screen (display); - *x = 0; - *y = 0; - *mask = 0; -} - static gboolean gdk_window_broadway_get_device_state (GdkWindow *window, GdkDevice *device, @@ -894,65 +877,6 @@ gdk_window_broadway_get_device_state (GdkWindow *window, return FALSE; } -void -gdk_display_warp_pointer (GdkDisplay *display, - GdkScreen *screen, - gint x, - gint y) -{ - GdkDevice *device; - - g_return_if_fail (GDK_IS_DISPLAY (display)); - g_return_if_fail (GDK_IS_SCREEN (screen)); - - device = display->core_pointer; - GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y); -} - -void -gdk_display_warp_device (GdkDisplay *display, - GdkDevice *device, - GdkScreen *screen, - gint x, - gint y) -{ - g_return_if_fail (GDK_IS_DISPLAY (display)); - g_return_if_fail (GDK_IS_DEVICE (device)); - g_return_if_fail (GDK_IS_SCREEN (screen)); - g_return_if_fail (display == gdk_device_get_display (device)); - - GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y); -} - -GdkWindow* -_gdk_windowing_window_at_device_position (GdkDisplay *display, - GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel) -{ - GdkWindow *window; - GdkDisplayBroadway *display_broadway; - GdkScreen *screen; - - display_broadway = GDK_DISPLAY_BROADWAY (display); - screen = gdk_display_get_screen (display, 0); - window = _gdk_window_find_child_at (gdk_screen_get_root_window (screen), - display_broadway->last_x, - display_broadway->last_y); - - if (window != NULL) - { - *win_x = display_broadway->last_x - window->x; - *win_y = display_broadway->last_y - window->y; - if (mask) - *mask = 0; - } - - return window; -} - static GdkEventMask gdk_window_broadway_get_events (GdkWindow *window) { @@ -961,9 +885,10 @@ gdk_window_broadway_get_events (GdkWindow *window) return 0; } + static void gdk_window_broadway_set_events (GdkWindow *window, - GdkEventMask event_mask) + GdkEventMask event_mask) { if (!GDK_WINDOW_DESTROYED (window)) { @@ -972,30 +897,30 @@ gdk_window_broadway_set_events (GdkWindow *window, static void gdk_window_broadway_shape_combine_region (GdkWindow *window, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) + const cairo_region_t *shape_region, + gint offset_x, + gint offset_y) { } static void gdk_window_broadway_input_shape_combine_region (GdkWindow *window, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) + const cairo_region_t *shape_region, + gint offset_x, + gint offset_y) { } -void -gdk_window_set_override_redirect (GdkWindow *window, - gboolean override_redirect) +static void +gdk_broadway_window_set_override_redirect (GdkWindow *window, + gboolean override_redirect) { } -void -gdk_window_set_accept_focus (GdkWindow *window, - gboolean accept_focus) +static void +gdk_broadway_window_set_accept_focus (GdkWindow *window, + gboolean accept_focus) { accept_focus = accept_focus != FALSE; @@ -1005,9 +930,9 @@ gdk_window_set_accept_focus (GdkWindow *window, } } -void -gdk_window_set_focus_on_map (GdkWindow *window, - gboolean focus_on_map) +static void +gdk_broadway_window_set_focus_on_map (GdkWindow *window, + gboolean focus_on_map) { focus_on_map = focus_on_map != FALSE; @@ -1018,15 +943,15 @@ gdk_window_set_focus_on_map (GdkWindow *window, } -void -gdk_window_set_icon_list (GdkWindow *window, - GList *pixbufs) +static void +gdk_broadway_window_set_icon_list (GdkWindow *window, + GList *pixbufs) { } -void -gdk_window_set_icon_name (GdkWindow *window, - const gchar *name) +static void +gdk_broadway_window_set_icon_name (GdkWindow *window, + const gchar *name) { GdkDisplay *display; @@ -1040,24 +965,24 @@ gdk_window_set_icon_name (GdkWindow *window, GUINT_TO_POINTER (name != NULL)); } -void -gdk_window_iconify (GdkWindow *window) +static void +gdk_broadway_window_iconify (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) return; } -void -gdk_window_deiconify (GdkWindow *window) +static void +gdk_broadway_window_deiconify (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) return; } -void -gdk_window_stick (GdkWindow *window) +static void +gdk_broadway_window_stick (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1065,8 +990,8 @@ gdk_window_stick (GdkWindow *window) } -void -gdk_window_unstick (GdkWindow *window) +static void +gdk_broadway_window_unstick (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1074,8 +999,8 @@ gdk_window_unstick (GdkWindow *window) } -void -gdk_window_maximize (GdkWindow *window) +static void +gdk_broadway_window_maximize (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1083,8 +1008,8 @@ gdk_window_maximize (GdkWindow *window) } -void -gdk_window_unmaximize (GdkWindow *window) +static void +gdk_broadway_window_unmaximize (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1092,8 +1017,8 @@ gdk_window_unmaximize (GdkWindow *window) } -void -gdk_window_fullscreen (GdkWindow *window) +static void +gdk_broadway_window_fullscreen (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1101,8 +1026,8 @@ gdk_window_fullscreen (GdkWindow *window) } -void -gdk_window_unfullscreen (GdkWindow *window) +static void +gdk_broadway_window_unfullscreen (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1110,9 +1035,9 @@ gdk_window_unfullscreen (GdkWindow *window) } -void -gdk_window_set_keep_above (GdkWindow *window, - gboolean setting) +static void +gdk_broadway_window_set_keep_above (GdkWindow *window, + gboolean setting) { g_return_if_fail (GDK_IS_WINDOW (window)); @@ -1122,8 +1047,8 @@ gdk_window_set_keep_above (GdkWindow *window, } -void -gdk_window_set_keep_below (GdkWindow *window, gboolean setting) +static void +gdk_broadway_window_set_keep_below (GdkWindow *window, gboolean setting) { g_return_if_fail (GDK_IS_WINDOW (window)); @@ -1133,8 +1058,8 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting) } -GdkWindow * -gdk_window_get_group (GdkWindow *window) +static GdkWindow * +gdk_broadway_window_get_group (GdkWindow *window) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) @@ -1143,15 +1068,15 @@ gdk_window_get_group (GdkWindow *window) return window; } -void -gdk_window_set_group (GdkWindow *window, - GdkWindow *leader) +static void +gdk_broadway_window_set_group (GdkWindow *window, + GdkWindow *leader) { } -void -gdk_window_set_decorations (GdkWindow *window, - GdkWMDecoration decorations) +static void +gdk_broadway_window_set_decorations (GdkWindow *window, + GdkWMDecoration decorations) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window)) @@ -1159,9 +1084,9 @@ gdk_window_set_decorations (GdkWindow *window, } -gboolean -gdk_window_get_decorations(GdkWindow *window, - GdkWMDecoration *decorations) +static gboolean +gdk_broadway_window_get_decorations (GdkWindow *window, + GdkWMDecoration *decorations) { gboolean result = FALSE; @@ -1172,9 +1097,9 @@ gdk_window_get_decorations(GdkWindow *window, return result; } -void -gdk_window_set_functions (GdkWindow *window, - GdkWMFunction functions) +static void +gdk_broadway_window_set_functions (GdkWindow *window, + GdkWMFunction functions) { g_return_if_fail (GDK_IS_WINDOW (window)); @@ -1183,14 +1108,14 @@ gdk_window_set_functions (GdkWindow *window, return; } -cairo_region_t * -_gdk_windowing_window_get_shape (GdkWindow *window) +static cairo_region_t * +gdk_broadway_window_get_shape (GdkWindow *window) { return NULL; } -cairo_region_t * -_gdk_windowing_window_get_input_shape (GdkWindow *window) +static cairo_region_t * +gdk_broadway_window_get_input_shape (GdkWindow *window) { return NULL; } @@ -1198,13 +1123,13 @@ _gdk_windowing_window_get_input_shape (GdkWindow *window) static gboolean gdk_window_broadway_set_static_gravities (GdkWindow *window, - gboolean use_static) + gboolean use_static) { return TRUE; } -void -gdk_window_begin_resize_drag (GdkWindow *window, +static void +gdk_broadway_window_begin_resize_drag (GdkWindow *window, GdkWindowEdge edge, gint button, gint root_x, @@ -1217,12 +1142,12 @@ gdk_window_begin_resize_drag (GdkWindow *window, } -void -gdk_window_begin_move_drag (GdkWindow *window, - gint button, - gint root_x, - gint root_y, - guint32 timestamp) +static void +gdk_broadway_window_begin_move_drag (GdkWindow *window, + gint button, + gint root_x, + gint root_y, + guint32 timestamp) { if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) @@ -1230,35 +1155,29 @@ gdk_window_begin_move_drag (GdkWindow *window, } -void -gdk_window_enable_synchronized_configure (GdkWindow *window) +static void +gdk_broadway_window_enable_synchronized_configure (GdkWindow *window) { if (!GDK_IS_WINDOW_IMPL_BROADWAY (window->impl)) return; } -void -gdk_window_configure_finished (GdkWindow *window) +static void +gdk_broadway_window_configure_finished (GdkWindow *window) { if (!WINDOW_IS_TOPLEVEL (window)) return; } -void -_gdk_windowing_window_beep (GdkWindow *window) +static gboolean +gdk_broadway_window_beep (GdkWindow *window) { - GdkDisplay *display; - - g_return_if_fail (GDK_IS_WINDOW (window)); - - display = GDK_WINDOW_DISPLAY (window); - - gdk_display_beep (display); + return FALSE; } -void -gdk_window_set_opacity (GdkWindow *window, - gdouble opacity) +static void +gdk_broadway_window_set_opacity (GdkWindow *window, + gdouble opacity) { GdkDisplay *display; @@ -1277,15 +1196,15 @@ gdk_window_set_opacity (GdkWindow *window, } -void -_gdk_windowing_window_set_composited (GdkWindow *window, - gboolean composited) +static void +gdk_broadway_window_set_composited (GdkWindow *window, + gboolean composited) { } -void -_gdk_windowing_window_process_updates_recurse (GdkWindow *window, - cairo_region_t *region) +static void +gdk_broadway_window_process_updates_recurse (GdkWindow *window, + cairo_region_t *region) { GdkWindowImplBroadway *impl; @@ -1293,22 +1212,22 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window, impl = GDK_WINDOW_IMPL_BROADWAY (window->impl); impl->dirty = TRUE; - queue_dirty_flush (GDK_DISPLAY_BROADWAY (gdk_window_get_display (window))); + queue_dirty_flush (GDK_BROADWAY_DISPLAY (gdk_window_get_display (window))); } void -_gdk_windowing_before_process_all_updates (void) +_gdk_broadway_display_before_process_all_updates (GdkDisplay *display) { } void -_gdk_windowing_after_process_all_updates (void) +_gdk_broadway_display_after_process_all_updates (GdkDisplay *display) { } gboolean _gdk_broadway_window_queue_antiexpose (GdkWindow *window, - cairo_region_t *area) + cairo_region_t *area) { return TRUE; } @@ -1347,7 +1266,7 @@ _gdk_broadway_window_translate (GdkWindow *window, gint dy) { GdkWindowImplBroadway *impl; - GdkDisplayBroadway *display_broadway; + GdkBroadwayDisplay *broadway_display; int n_rects, i; BroadwayRect *rects; cairo_rectangle_int_t rect; @@ -1370,11 +1289,11 @@ _gdk_broadway_window_translate (GdkWindow *window, rects[i].width = rect.width; rects[i].height = rect.height; } - display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window)); - broadway_output_copy_rectangles (display_broadway->output, + broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)); + broadway_output_copy_rectangles (broadway_display->output, GDK_WINDOW_IMPL_BROADWAY (impl)->id, rects, n_rects, dx, dy); - queue_dirty_flush (display_broadway); + queue_dirty_flush (broadway_display); g_free (rects); } } @@ -1411,5 +1330,61 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass) impl_class->queue_antiexpose = _gdk_broadway_window_queue_antiexpose; impl_class->translate = _gdk_broadway_window_translate; impl_class->destroy = _gdk_broadway_window_destroy; + impl_class->destroy_foreign = gdk_broadway_window_destroy_foreign; impl_class->resize_cairo_surface = gdk_window_broadway_resize_cairo_surface; + impl_class->get_shape = gdk_broadway_window_get_shape; + impl_class->get_input_shape = gdk_broadway_window_get_input_shape; + impl_class->beep = gdk_broadway_window_beep; + + impl_class->focus = gdk_broadway_window_focus; + impl_class->set_type_hint = gdk_broadway_window_set_type_hint; + impl_class->get_type_hint = gdk_broadway_window_get_type_hint; + impl_class->set_modal_hint = gdk_broadway_window_set_modal_hint; + impl_class->set_skip_taskbar_hint = gdk_broadway_window_set_skip_taskbar_hint; + impl_class->set_skip_pager_hint = gdk_broadway_window_set_skip_pager_hint; + impl_class->set_urgency_hint = gdk_broadway_window_set_urgency_hint; + impl_class->set_geometry_hints = gdk_broadway_window_set_geometry_hints; + impl_class->set_title = gdk_broadway_window_set_title; + impl_class->set_role = gdk_broadway_window_set_role; + impl_class->set_startup_id = gdk_broadway_window_set_startup_id; + impl_class->set_transient_for = gdk_broadway_window_set_transient_for; + impl_class->get_root_origin = gdk_broadway_window_get_root_origin; + impl_class->get_frame_extents = gdk_broadway_window_get_frame_extents; + impl_class->set_override_redirect = gdk_broadway_window_set_override_redirect; + impl_class->set_accept_focus = gdk_broadway_window_set_accept_focus; + impl_class->set_focus_on_map = gdk_broadway_window_set_focus_on_map; + impl_class->set_icon_list = gdk_broadway_window_set_icon_list; + impl_class->set_icon_name = gdk_broadway_window_set_icon_name; + impl_class->iconify = gdk_broadway_window_iconify; + impl_class->deiconify = gdk_broadway_window_deiconify; + impl_class->stick = gdk_broadway_window_stick; + impl_class->unstick = gdk_broadway_window_unstick; + impl_class->maximize = gdk_broadway_window_maximize; + impl_class->unmaximize = gdk_broadway_window_unmaximize; + impl_class->fullscreen = gdk_broadway_window_fullscreen; + impl_class->unfullscreen = gdk_broadway_window_unfullscreen; + impl_class->set_keep_above = gdk_broadway_window_set_keep_above; + impl_class->set_keep_below = gdk_broadway_window_set_keep_below; + impl_class->get_group = gdk_broadway_window_get_group; + impl_class->set_group = gdk_broadway_window_set_group; + impl_class->set_decorations = gdk_broadway_window_set_decorations; + impl_class->get_decorations = gdk_broadway_window_get_decorations; + impl_class->set_functions = gdk_broadway_window_set_functions; + impl_class->set_functions = gdk_broadway_window_set_functions; + impl_class->begin_resize_drag = gdk_broadway_window_begin_resize_drag; + impl_class->begin_move_drag = gdk_broadway_window_begin_move_drag; + impl_class->enable_synchronized_configure = gdk_broadway_window_enable_synchronized_configure; + impl_class->configure_finished = gdk_broadway_window_configure_finished; + impl_class->set_opacity = gdk_broadway_window_set_opacity; + impl_class->set_composited = gdk_broadway_window_set_composited; + impl_class->destroy_notify = gdk_broadway_window_destroy_notify; + impl_class->register_dnd = _gdk_broadway_window_register_dnd; + impl_class->drag_begin = _gdk_broadway_window_drag_begin; + impl_class->process_updates_recurse = gdk_broadway_window_process_updates_recurse; + impl_class->sync_rendering = _gdk_broadway_window_sync_rendering; + impl_class->simulate_key = _gdk_broadway_window_simulate_key; + impl_class->simulate_button = _gdk_broadway_window_simulate_button; + impl_class->get_property = _gdk_broadway_window_get_property; + impl_class->change_property = _gdk_broadway_window_change_property; + impl_class->delete_property = _gdk_broadway_window_delete_property; } diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c index 79ed85aebd..452f700058 100644 --- a/gdk/gdkdisplaymanager.c +++ b/gdk/gdkdisplaymanager.c @@ -44,6 +44,10 @@ #include "quartz/gdkquartzdisplaymanager.h" #endif +#ifdef GDK_WINDOWING_BROADWAY +#include "broadway/gdkbroadwaydisplaymanager.h" +#endif + #ifdef GDK_WINDOWING_WIN32 #include "win32/gdkwin32.h" #endif @@ -203,6 +207,11 @@ gdk_display_manager_get (void) manager = g_object_new (gdk_win32_display_manager_get_type (), NULL); else #endif +#ifdef GDK_WINDOWING_BROADWAY + if (backend == NULL || strcmp (backend, "broadway") == 0) + manager = g_object_new (gdk_broadway_display_manager_get_type (), NULL); + else +#endif if (backend != NULL) g_error ("Unsupported GDK backend: %s", backend); else |