Commit e27632cd authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi

Abstract some GdkWindow API into an interface that the backends must

2008-06-27  Emmanuele Bassi  <ebassi@gnome.org>

	Abstract some GdkWindow API into an interface that the backends
	must implement. (based on a patch by Alex Larsson)

	* gdk/Makefile.am: Add gdkwindowimpl.[ch]

	* gdk/gdk.symbols: Move symbols around.

	* gdk/gdkinternals.h:
	* gdk/gdkwindowimpl.[ch]: Move some of the GdkWindow API we require
	from the backends to a GInterface that the backends should implement
	instead.

	* gdk/gdkwindow.c: Provide some of the GdkWindow public API as a
	wrapper call around the GdkWindowImpl interface vtable.

	* gdk/x11/gdkevents-x11.c:
	* gdk/x11/gdkgeometry-x11.c:
	* gdk/x11/gdkprivate-x11.h:
	* gdk/x11/gdkwindow-x11.c:
	* gdk/x11/gdkwindow-x11.h: Update the X11 backend to implement
	the GdkWindowImpl interface.

svn path=/trunk/; revision=20695
parent cf1df130
2008-06-27 Emmanuele Bassi <ebassi@gnome.org>
Abstract some GdkWindow API into an interface that the backends
must implement. (based on a patch by Alex Larsson)
* gdk/Makefile.am: Add gdkwindowimpl.[ch]
* gdk/gdk.symbols: Move symbols around.
* gdk/gdkinternals.h:
* gdk/gdkwindowimpl.[ch]: Move some of the GdkWindow API we require
from the backends to a GInterface that the backends should implement
instead.
* gdk/gdkwindow.c: Provide some of the GdkWindow public API as a
wrapper call around the GdkWindowImpl interface vtable.
* gdk/x11/gdkevents-x11.c:
* gdk/x11/gdkgeometry-x11.c:
* gdk/x11/gdkprivate-x11.h:
* gdk/x11/gdkwindow-x11.c:
* gdk/x11/gdkwindow-x11.h: Update the X11 backend to implement
the GdkWindowImpl interface.
2008-06-27 Martyn Russell <martyn@imendio.com>
Bug 540318 - Invalid URL
......
......@@ -98,6 +98,8 @@ gdk_built_public_sources = \
gdkenumtypes.h
gdk_built_private_headers = \
gdkprivate.h \
gdkwindowimpl.h \
gdkalias.h
gdk_c_sources = \
......@@ -133,7 +135,8 @@ gdk_c_sources = \
gdkscreen.c \
gdkselection.c \
gdkvisual.c \
gdkwindow.c
gdkwindow.c \
gdkwindowimpl.c
gdk_built_sources = \
gdkaliasdef.c \
......
......@@ -647,6 +647,29 @@ gdk_window_impl_x11_get_type G_GNUC_CONST
#if IN_FILE(__GDK_WINDOW_C__)
gdk_get_default_root_window
gdk_window_new
gdk_window_show_unraised
gdk_window_show
gdk_window_hide
gdk_window_withdraw
gdk_window_get_events
gdk_window_set_events
gdk_window_raise
gdk_window_lower
gdk_window_move
gdk_window_resize
gdk_window_move_resize
gdk_window_scroll
gdk_window_move_region
gdk_window_set_background
gdk_window_set_back_pixmap
gdk_window_set_cursor
gdk_window_get_geometry
gdk_window_get_origin
gdk_window_shape_combine_mask
gdk_window_shape_combine_region
gdk_window_set_child_shapes
gdk_window_merge_child_shapes
gdk_window_set_static_gravities
gdk_window_reparent
gdk_window_add_filter
gdk_window_at_pointer
......@@ -698,28 +721,12 @@ gdk_window_register_dnd
#endif
#endif
#if IN_HEADER(__GDK_WINDOW_H__)
#if IN_FILE(__GDK_GEOMETRY_X11_C__)
gdk_window_scroll
gdk_window_move_region
#endif
#endif
#if IN_HEADER(__GDK_WINDOW_H__)
#if IN_FILE(__GDK_WINDOW_X11_C__)
gdk_window_foreign_new_for_display
gdk_window_focus
gdk_window_lookup
gdk_window_lookup_for_display
gdk_window_show_unraised
gdk_window_show
gdk_window_hide
gdk_window_withdraw
gdk_window_move
gdk_window_resize
gdk_window_move_resize
gdk_window_raise
gdk_window_lower
gdk_window_focus
#ifndef GDK_DISABLE_DEPRECATED
gdk_window_set_hints
gdk_window_get_deskrelative_origin
......@@ -735,17 +742,8 @@ gdk_window_set_title
gdk_window_set_role
gdk_window_set_startup_id
gdk_window_set_transient_for
gdk_window_set_background
gdk_window_set_back_pixmap
gdk_window_set_cursor
gdk_window_get_geometry
gdk_window_get_origin
gdk_window_get_root_origin
gdk_window_get_frame_extents
gdk_window_get_events
gdk_window_set_events
gdk_window_shape_combine_mask
gdk_window_shape_combine_region
gdk_window_input_shape_combine_mask
gdk_window_input_shape_combine_region
gdk_window_set_override_redirect
......@@ -771,11 +769,8 @@ gdk_window_set_group
gdk_window_get_decorations
gdk_window_set_decorations
gdk_window_set_functions
gdk_window_set_child_shapes
gdk_window_merge_child_shapes
gdk_window_set_child_input_shapes
gdk_window_merge_child_input_shapes
gdk_window_set_static_gravities
gdk_window_begin_move_drag
gdk_window_begin_resize_drag
gdk_window_enable_synchronized_configure
......
......@@ -240,11 +240,14 @@ void _gdk_gc_update_context (GdkGC *gc,
* Interfaces used by windowing code *
*************************************/
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
GdkWindow *_gdk_window_new (GdkWindow *window,
GdkWindowAttr *attributes,
gint attributes_mask);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
void _gdk_screen_close (GdkScreen *screen);
void _gdk_screen_close (GdkScreen *screen);
const char *_gdk_get_sm_client_id (void);
......@@ -283,16 +286,6 @@ gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
void _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset);
void _gdk_windowing_window_clear_area (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_windowing_window_clear_area_e (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_windowing_get_pointer (GdkDisplay *display,
GdkScreen **screen,
......
This diff is collapsed.
/* 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/.
*/
#include "config.h"
#include "gdkwindowimpl.h"
#include "gdkinternals.h"
GType
gdk_window_impl_get_type (void)
{
static GType gtype = 0;
if (G_UNLIKELY (!gtype))
{
gtype = g_type_register_static_simple (G_TYPE_INTERFACE,
"GdkWindowImpl",
sizeof (GdkWindowImplIface),
NULL, 0, NULL, 0);
g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT);
}
return gtype;
}
/* 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_WINDOW_IMPL_H__
#define __GDK_WINDOW_IMPL_H__
#include <gdk/gdkwindow.h>
G_BEGIN_DECLS
#define GDK_TYPE_WINDOW_IMPL (gdk_window_impl_get_type ())
#define GDK_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
#define GDK_IS_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WINDOW_IMPL))
#define GDK_WINDOW_IMPL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplIface))
typedef struct _GdkWindowImpl GdkWindowImpl; /* dummy */
typedef struct _GdkWindowImplIface GdkWindowImplIface;
struct _GdkWindowImplIface
{
GTypeInterface g_iface;
void (* show) (GdkWindow *window,
gboolean raise);
void (* hide) (GdkWindow *window);
void (* withdraw) (GdkWindow *window);
void (* raise) (GdkWindow *window);
void (* lower) (GdkWindow *window);
void (* move_resize) (GdkWindow *window,
gboolean with_move,
gint x,
gint y,
gint width,
gint height);
void (* move_region) (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy);
void (* scroll) (GdkWindow *window,
gint dx,
gint dy);
void (* clear_area) (GdkWindow *window,
gint x,
gint y,
gint width,
gint height,
gboolean send_expose);
void (* set_background) (GdkWindow *window,
const GdkColor *color);
void (* set_back_pixmap) (GdkWindow *window,
GdkPixmap *pixmap,
gboolean parent_relative);
GdkEventMask (* get_events) (GdkWindow *window);
void (* set_events) (GdkWindow *window,
GdkEventMask event_mask);
gboolean (* reparent) (GdkWindow *window,
GdkWindow *new_parent,
gint x,
gint y);
void (* set_cursor) (GdkWindow *window,
GdkCursor *cursor);
void (* get_geometry) (GdkWindow *window,
gint *x,
gint *y,
gint *width,
gint *height,
gint *depth);
gint (* get_origin) (GdkWindow *window,
gint *x,
gint *y);
void (* get_offsets) (GdkWindow *window,
gint *x_offset,
gint *y_offset);
void (* shape_combine_mask) (GdkWindow *window,
GdkBitmap *mask,
gint x,
gint y);
void (* shape_combine_region) (GdkWindow *window,
const GdkRegion *shape_region,
gint offset_x,
gint offset_y);
void (* set_child_shapes) (GdkWindow *window);
void (* merge_child_shapes) (GdkWindow *window);
gboolean (* set_static_gravities) (GdkWindow *window,
gboolean use_static);
};
/* Interface Functions */
GType gdk_window_impl_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_WINDOW_IMPL_H__ */
......@@ -1043,7 +1043,7 @@ gdk_event_translate (GdkDisplay *display,
if (window)
{
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
_gdk_x11_window_get_offsets (window, &xoffset, &yoffset);
}
else
{
......
......@@ -192,9 +192,9 @@ static void gdk_window_clip_changed (GdkWindow *window,
GdkRectangle *new_clip);
void
_gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
_gdk_x11_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
GdkWindowImplX11 *impl =
GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
......@@ -395,25 +395,10 @@ gdk_window_guffaw_scroll (GdkWindow *window,
g_list_foreach (obj->children, (GFunc) gdk_window_postmove, &parent_pos);
}
/**
* gdk_window_scroll:
* @window: a #GdkWindow
* @dx: Amount to scroll in the X direction
* @dy: Amount to scroll in the Y direction
*
* Scroll the contents of @window, both pixels and children, by the given
* amount. @window itself does not move. Portions of the window that the scroll
* operation brings in from offscreen areas are invalidated. The invalidated
* region may be bigger than what would strictly be necessary. (For X11, a
* minimum area will be invalidated if the window has no subwindows, or if the
* edges of the window's parent do not extend beyond the edges of the window. In
* other cases, a multi-step process is used to scroll the window which may
* produce temporary visual artifacts and unnecessary invalidations.)
**/
void
gdk_window_scroll (GdkWindow *window,
gint dx,
gint dy)
_gdk_x11_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
gboolean can_guffaw_scroll = FALSE;
GdkRegion *invalidate_region;
......@@ -421,17 +406,9 @@ gdk_window_scroll (GdkWindow *window,
GdkWindowObject *obj;
GdkRectangle src_rect, dest_rect;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_X11 (obj->impl);
if (dx == 0 && dy == 0)
return;
/* Move the current invalid region */
if (obj->update_area)
gdk_region_offset (obj->update_area, dx, dy);
......@@ -483,26 +460,11 @@ gdk_window_scroll (GdkWindow *window,
gdk_window_guffaw_scroll (window, dx, dy);
}
/**
* gdk_window_move_region:
* @window: a #GdkWindow
* @region: The #GdkRegion to move
* @dx: Amount to move in the X direction
* @dy: Amount to move in the Y direction
*
* Move the part of @window indicated by @region by @dy pixels in the Y
* direction and @dx pixels in the X direction. The portions of @region
* that not covered by the new position of @region are invalidated.
*
* Child windows are not moved.
*
* Since: 2.8
**/
void
gdk_window_move_region (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy)
_gdk_x11_window_move_region (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy)
{
GdkWindowImplX11 *impl;
GdkWindowObject *private;
......@@ -514,18 +476,9 @@ gdk_window_move_region (GdkWindow *window,
GdkRectangle dest_extents;
GdkGC *gc;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (region != NULL);
if (GDK_WINDOW_DESTROYED (window))
return;
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_X11 (private->impl);
if (dx == 0 && dy == 0)
return;
window_clip = gdk_region_rectangle (&impl->position_info.clip_rect);
/* compute source regions */
......
......@@ -128,6 +128,14 @@ void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
void _gdk_x11_window_scroll (GdkWindow *window,
gint dx,
gint dy);
void _gdk_x11_window_move_region (GdkWindow *window,
const GdkRegion *region,
gint dx,
gint dy);
void _gdk_selection_window_destroyed (GdkWindow *window);
gboolean _gdk_selection_filter_clear_event (XSelectionClearEvent *event);
......
This diff is collapsed.
......@@ -169,6 +169,9 @@ void _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
GdkCursor *_gdk_x11_window_get_cursor (GdkWindow *window);
void _gdk_x11_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment