[gtk+/client-side-windows: 271/284] CSW Win32 work in progress - builds but does not work yet.
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 271/284] CSW Win32 work in progress - builds but does not work yet.
- Date: Thu, 2 Apr 2009 14:24:41 -0400 (EDT)
commit a93c6cd6e1b788ee2f01588922cb375c986e754a
Author: Cody Russell <cody beamish (none)>
Date: Sat Feb 14 13:23:54 2009 -0500
CSW Win32 work in progress - builds but does not work yet.
---
gdk/gdkinternals.h | 4 +-
gdk/gdkwindow.c | 4 +-
gdk/win32/gdkdisplay-win32.c | 8 +-
gdk/win32/gdkdrawable-win32.c | 235 +++++++++--------
gdk/win32/gdkevents-win32.c | 47 ++--
gdk/win32/gdkgc-win32.c | 12 +-
gdk/win32/gdkgeometry-win32.c | 607 +++--------------------------------------
gdk/win32/gdkinput-win32.c | 116 ++++----
gdk/win32/gdkmain-win32.c | 6 +-
gdk/win32/gdkpixmap-win32.c | 6 +-
gdk/win32/gdkprivate-win32.h | 5 +-
gdk/win32/gdkwindow-win32.c | 502 ++++++++++++++++------------------
gdk/win32/gdkwindow-win32.h | 9 +-
tests/testclientmessage.c | 244 ++++++++--------
14 files changed, 636 insertions(+), 1169 deletions(-)
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 73c15d2..a331e94 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -350,8 +350,8 @@ gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
void _gdk_windowing_window_get_offsets (GdkWindow *window,
- gint *x_offset,
- gint *y_offset);
+ gint *x_offset,
+ gint *y_offset);
GdkRegion *_gdk_windowing_window_get_shape (GdkWindow *window);
GdkRegion *_gdk_windowing_window_get_input_shape(GdkWindow *window);
GdkRegion *_gdk_windowing_get_shape_for_mask (GdkBitmap *mask);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ab44c72..3532741 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -37,8 +37,10 @@
#undef DEBUG_WINDOW_PRINTING
-#ifdef GDK_WINDOWING_X11
+#if defined(GDK_WINDOWING_X11)
#include "x11/gdkx.h" /* For workaround */
+#elif defined(GDK_WINDOWING_WIN32)
+#include "win32/gdkwin32.h"
#endif
#include "math.h"
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 8bdb933..8d9d526 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -36,6 +36,12 @@ _gdk_windowing_set_default_display (GdkDisplay *display)
g_assert (display == NULL || _gdk_display == display);
}
+gulong
+_gdk_windowing_window_get_next_serial (GdkDisplay *display)
+{
+ return 0;
+}
+
#ifdef HAVE_MONITOR_INFO
static BOOL CALLBACK
count_monitor (HMONITOR hmonitor,
@@ -200,7 +206,7 @@ gdk_display_open (const gchar *display_name)
_gdk_visual_init ();
gdk_screen_set_default_colormap (_gdk_screen,
gdk_screen_get_system_colormap (_gdk_screen));
- _gdk_windowing_window_init ();
+ _gdk_windowing_window_init (_gdk_screen);
_gdk_windowing_image_init ();
_gdk_events_init ();
_gdk_input_init (_gdk_display);
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index e762ae0..11c8b1f 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -50,75 +50,75 @@
(gcwin32->line_style == GDK_LINE_ON_OFF_DASH && gcwin32->pen_dash_offset))
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height);
+ GdkGC *gc,
+ gboolean filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
static void gdk_win32_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
+ GdkGC *gc,
+ gboolean filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint angle1,
+ gint angle2);
static void gdk_win32_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ gboolean filled,
+ GdkPoint *points,
+ gint npoints);
static void gdk_win32_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const gchar *text,
+ gint text_length);
static void gdk_win32_draw_text_wc (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const GdkWChar *text,
- gint text_length);
+ GdkFont *font,
+ GdkGC *gc,
+ gint x,
+ gint y,
+ const GdkWChar *text,
+ gint text_length);
static void gdk_win32_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static void gdk_win32_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
static void gdk_win32_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
+ GdkGC *gc,
+ GdkSegment *segs,
+ gint nsegs);
static void gdk_win32_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
+ GdkGC *gc,
+ GdkPoint *points,
+ gint npoints);
static void gdk_win32_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
+ GdkGC *gc,
+ GdkImage *image,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height);
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
static void gdk_win32_set_colormap (GdkDrawable *drawable,
- GdkColormap *colormap);
+ GdkColormap *colormap);
static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
@@ -367,7 +367,7 @@ render_line_horizontal (GdkGCWin32 *gcwin32,
static inline gboolean
render_line_vertical (GdkGCWin32 *gcwin32,
- int x,
+ int x,
int y1,
int y2)
{
@@ -423,16 +423,16 @@ render_line_vertical (GdkGCWin32 *gcwin32,
static void
draw_tiles_lowlevel (HDC dest,
- HDC tile,
- int rop3,
- gint dest_x,
- gint dest_y,
- gint tile_x_origin,
- gint tile_y_origin,
- gint width,
- gint height,
- gint tile_width,
- gint tile_height)
+ HDC tile,
+ int rop3,
+ gint dest_x,
+ gint dest_y,
+ gint tile_x_origin,
+ gint tile_y_origin,
+ gint width,
+ gint height,
+ gint tile_width,
+ gint tile_height)
{
gint x, y;
@@ -477,15 +477,15 @@ draw_tiles_lowlevel (HDC dest,
static void
draw_tiles (GdkDrawable *drawable,
- GdkGC *gc,
- int rop3,
- GdkPixmap *tile,
- gint dest_x,
- gint dest_y,
- gint tile_x_origin,
- gint tile_y_origin,
- gint width,
- gint height)
+ GdkGC *gc,
+ int rop3,
+ GdkPixmap *tile,
+ gint dest_x,
+ gint dest_y,
+ gint tile_x_origin,
+ gint tile_y_origin,
+ gint width,
+ gint height)
{
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
gint tile_width, tile_height;
@@ -510,11 +510,11 @@ draw_tiles (GdkDrawable *drawable,
static void
generic_draw (GdkDrawable *drawable,
- GdkGC *gc,
- GdkGCValuesMask mask,
- void (*function) (GdkGCWin32 *, HDC, gint, gint, va_list),
- const GdkRegion *region,
- ...)
+ GdkGC *gc,
+ GdkGCValuesMask mask,
+ void (*function) (GdkGCWin32 *, HDC, gint, gint, va_list),
+ const GdkRegion *region,
+ ...)
{
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
@@ -742,7 +742,7 @@ generic_draw (GdkDrawable *drawable,
static GdkRegion *
widen_bounds (GdkRectangle *bounds,
- gint pen_width)
+ gint pen_width)
{
if (pen_width == 0)
pen_width = 1;
@@ -757,10 +757,10 @@ widen_bounds (GdkRectangle *bounds,
static void
draw_rectangle (GdkGCWin32 *gcwin32,
- HDC hdc,
- gint x_offset,
- gint y_offset,
- va_list args)
+ HDC hdc,
+ gint x_offset,
+ gint y_offset,
+ va_list args)
{
HGDIOBJ old_pen_or_brush;
gboolean filled;
@@ -803,12 +803,12 @@ draw_rectangle (GdkGCWin32 *gcwin32,
static void
gdk_win32_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gboolean filled,
- gint x,
- gint y,
- gint width,
- gint height)
+ GdkGC *gc,
+ gboolean filled,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GdkRectangle bounds;
GdkRegion *region;
@@ -1141,20 +1141,20 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
static void
gdk_win32_draw_drawable (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
+ GdkGC *gc,
+ GdkPixmap *src,
+ gint xsrc,
+ gint ysrc,
+ gint xdest,
+ gint ydest,
+ gint width,
+ gint height)
{
g_assert (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable));
_gdk_win32_blit (FALSE, (GdkDrawableImplWin32 *) drawable,
- gc, src, xsrc, ysrc,
- xdest, ydest, width, height);
+ gc, src, xsrc, ysrc,
+ xdest, ydest, width, height);
}
static void
@@ -1844,6 +1844,20 @@ _gdk_win32_drawable_release_dc (GdkDrawable *drawable)
}
}
+cairo_surface_t *
+_gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
+ gint width,
+ gint height)
+{
+ GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
+
+ HDC hdc = _gdk_win32_drawable_acquire_dc (drawable);
+ if (!hdc)
+ return NULL;
+
+ return cairo_win32_surface_create (hdc);
+}
+
static void
gdk_win32_cairo_surface_destroy (void *data)
{
@@ -1864,14 +1878,11 @@ gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
if (!impl->cairo_surface)
{
- HDC hdc = _gdk_win32_drawable_acquire_dc (drawable);
- if (!hdc)
- return NULL;
-
- impl->cairo_surface = cairo_win32_surface_create (hdc);
+ // On Win32 cairo surface, width and height are determined from the DC
+ impl->cairo_surface = _gdk_windowing_create_cairo_surface (drawable, 0, 0);
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
- drawable, gdk_win32_cairo_surface_destroy);
+ drawable, gdk_win32_cairo_surface_destroy);
}
else
cairo_surface_reference (impl->cairo_surface);
@@ -1879,6 +1890,14 @@ gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
return impl->cairo_surface;
}
+void
+_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
+ gint width,
+ gint height)
+{
+ // Do nothing. The surface size is determined by the DC
+}
+
static gint
gdk_win32_get_depth (GdkDrawable *drawable)
{
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 3cdd66f..8664323 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -653,6 +653,7 @@ find_window_for_mouse_event (GdkWindow* reported_window,
return find_real_window_for_grabbed_mouse_event (reported_window, msg);
}
+#if 0
gboolean
gdk_display_pointer_is_grabbed (GdkDisplay *display)
{
@@ -661,7 +662,9 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
p_grab_window != NULL ? "TRUE" : "FALSE"));
return p_grab_window != NULL;
}
+#endif
+#if 0
gboolean
gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
GdkWindow **grab_window,
@@ -681,6 +684,7 @@ gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
else
return FALSE;
}
+#endif
GdkGrabStatus
gdk_keyboard_grab (GdkWindow *window,
@@ -778,26 +782,6 @@ gdk_display_keyboard_ungrab (GdkDisplay *display,
assign_object (&k_grab_window, NULL);
}
-gboolean
-gdk_keyboard_grab_info_libgtk_only (GdkDisplay *display,
- GdkWindow **grab_window,
- gboolean *owner_events)
-{
- g_return_val_if_fail (display == _gdk_display, FALSE);
-
- if (k_grab_window)
- {
- if (grab_window)
- *grab_window = k_grab_window;
- if (owner_events)
- *owner_events = k_grab_owner_events;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
void
gdk_display_add_client_message_filter (GdkDisplay *display,
GdkAtom message_type,
@@ -1399,7 +1383,7 @@ synthesize_enter_or_leave_event (GdkWindow *window,
event->crossing.window = window;
event->crossing.subwindow = NULL;
event->crossing.time = _gdk_win32_get_next_tick (msg->time);
- _gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
+ //_gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->crossing.x = x + xoffset;
event->crossing.y = y + yoffset;
event->crossing.x_root = msg->pt.x + _gdk_offset_x;
@@ -1855,6 +1839,7 @@ handle_configure_event (MSG *msg,
{
RECT client_rect;
POINT point;
+ GdkWindowObject *window_object;
GetClientRect (msg->hwnd, &client_rect);
point.x = client_rect.left; /* always 0 */
@@ -1867,13 +1852,15 @@ handle_configure_event (MSG *msg,
point.y += _gdk_offset_y;
}
- GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->width = client_rect.right - client_rect.left;
- GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->height = client_rect.bottom - client_rect.top;
+ window_object = GDK_WINDOW_OBJECT (window);
+
+ window_object->width = client_rect.right - client_rect.left;
+ window_object->height = client_rect.bottom - client_rect.top;
- ((GdkWindowObject *) window)->x = point.x;
- ((GdkWindowObject *) window)->y = point.y;
+ window_object->x = point.x;
+ window_object->y = point.y;
- if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
+ if (window_object->event_mask & GDK_STRUCTURE_MASK)
{
GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
@@ -2037,7 +2024,7 @@ handle_wm_paint (MSG *msg,
update_region = _gdk_win32_hrgn_to_region (hrgn);
- _gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
+ //_gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
gdk_region_offset (update_region, xoffset, yoffset);
_gdk_window_process_expose (window, update_region);
@@ -2105,7 +2092,7 @@ generate_button_event (GdkEventType type,
translate_mouse_coords (orig_window, window, msg);
event->button.x = current_x = (gint16) GET_X_LPARAM (msg->lParam);
event->button.y = current_y = (gint16) GET_Y_LPARAM (msg->lParam);
- _gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
+ //_gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->button.x += xoffset;
event->button.y += yoffset;
event->button.x_root = msg->pt.x + _gdk_offset_x;
@@ -2825,7 +2812,7 @@ gdk_event_translate (MSG *msg,
event->motion.time = _gdk_win32_get_next_tick (msg->time);
event->motion.x = current_x = (gint16) GET_X_LPARAM (msg->lParam);
event->motion.y = current_y = (gint16) GET_Y_LPARAM (msg->lParam);
- _gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
+// gdk_window_get_offsets (window, &xoffset, &yoffset);
event->motion.x += xoffset;
event->motion.y += yoffset;
event->motion.x_root = current_root_x;
@@ -2916,7 +2903,7 @@ gdk_event_translate (MSG *msg,
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
- _gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
+ //_gdk_win32_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->scroll.x = (gint16) point.x + xoffset;
event->scroll.y = (gint16) point.y + yoffset;
event->scroll.x_root = (gint16) GET_X_LPARAM (msg->lParam) + _gdk_offset_x;
diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c
index c255f4b..4baf898 100644
--- a/gdk/win32/gdkgc-win32.c
+++ b/gdk/win32/gdkgc-win32.c
@@ -572,7 +572,8 @@ gdk_win32_gc_set_dashes (GdkGC *gc,
void
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
- const GdkRegion *region)
+ const GdkRegion *region,
+ gboolean reset_origin)
{
GdkGCWin32 *win32_gc = GDK_GC_WIN32 (gc);
@@ -596,9 +597,12 @@ _gdk_windowing_gc_set_clip_region (GdkGC *gc,
win32_gc->values_mask &= ~GDK_GC_CLIP_MASK;
}
- gc->clip_x_origin = 0;
- gc->clip_y_origin = 0;
-
+ if (reset_origin)
+ {
+ gc->clip_x_origin = 0;
+ gc->clip_y_origin = 0;
+ }
+
win32_gc->values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
}
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index 61dbf76..9a2006f 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -42,197 +42,13 @@
#include "gdk.h" /* For gdk_rectangle_intersect */
#include "gdkregion.h"
#include "gdkregion-generic.h"
+#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#define SIZE_LIMIT 32767
typedef struct _GdkWindowParentPos GdkWindowParentPos;
-struct _GdkWindowParentPos
-{
- gint x;
- gint y;
- gint win32_x;
- gint win32_y;
- GdkRectangle clip_rect;
-};
-
-static void gdk_window_compute_position (GdkWindowImplWin32 *window,
- GdkWindowParentPos *parent_pos,
- GdkWin32PositionInfo *info);
-static void gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
- GdkWindowParentPos *parent_pos);
-
-static void gdk_window_postmove (GdkWindow *window,
- GdkWindowParentPos *parent_pos,
- gboolean anti_scroll);
-static void gdk_window_tmp_unset_bg (GdkWindow *window);
-static void gdk_window_tmp_reset_bg (GdkWindow *window);
-static GdkRegion *gdk_window_clip_changed (GdkWindow *window,
- GdkRectangle *old_clip,
- GdkRectangle *new_clip);
-static void gdk_window_post_scroll (GdkWindow *window,
- GdkRegion *new_clip_region);
-
-void
-_gdk_win32_windowing_window_get_offsets (GdkWindow *window,
- gint *x_offset,
- gint *y_offset)
-{
- GdkWindowImplWin32 *impl =
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
-
- *x_offset = impl->position_info.x_offset;
- *y_offset = impl->position_info.y_offset;
-}
-
-void
-_gdk_window_init_position (GdkWindow *window)
-{
- GdkWindowParentPos parent_pos;
- GdkWindowImplWin32 *impl;
-
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
-
- gdk_window_compute_parent_pos (impl, &parent_pos);
- gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
-}
-
-void
-_gdk_win32_window_scroll (GdkWindow *window,
- gint dx,
- gint dy)
-{
- GdkRegion *invalidate_region;
- GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
- GList *tmp_list;
- GdkWindowParentPos parent_pos;
- HRGN native_invalidate_region;
-
- GDK_NOTE (EVENTS, g_print ("gdk_window_scroll: %p %d,%d\n",
- GDK_WINDOW_HWND (window), dx, dy));
-
- obj = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
- /* Move the current invalid region */
- if (obj->update_area)
- gdk_region_offset (obj->update_area, dx, dy);
-
- gdk_window_compute_parent_pos (impl, &parent_pos);
-
- parent_pos.x += obj->x;
- parent_pos.y += obj->y;
- parent_pos.win32_x += impl->position_info.x;
- parent_pos.win32_y += impl->position_info.y;
- parent_pos.clip_rect = impl->position_info.clip_rect;
-
- gdk_window_tmp_unset_bg (window);
-
- native_invalidate_region = CreateRectRgn (0, 0, 0, 0);
- if (native_invalidate_region == NULL)
- WIN32_API_FAILED ("CreateRectRgn");
-
- API_CALL (ScrollWindowEx, (GDK_WINDOW_HWND (window),
- dx, dy, NULL, NULL,
- native_invalidate_region, NULL, SW_SCROLLCHILDREN));
-
- if (impl->position_info.no_bg)
- gdk_window_tmp_reset_bg (window);
-
- tmp_list = obj->children;
- while (tmp_list)
- {
- GDK_WINDOW_OBJECT(tmp_list->data)->x += dx;
- GDK_WINDOW_OBJECT(tmp_list->data)->y += dy;
- gdk_window_postmove (tmp_list->data, &parent_pos, FALSE);
- tmp_list = tmp_list->next;
- }
-
- if (native_invalidate_region != NULL)
- {
- invalidate_region = _gdk_win32_hrgn_to_region (native_invalidate_region);
- gdk_region_offset (invalidate_region, impl->position_info.x_offset,
- impl->position_info.y_offset);
- gdk_window_invalidate_region (window, invalidate_region, TRUE);
- gdk_region_destroy (invalidate_region);
- GDI_CALL (DeleteObject, (native_invalidate_region));
- }
-}
-
-void
-_gdk_win32_window_move_region (GdkWindow *window,
- const GdkRegion *region,
- gint dx,
- gint dy)
-{
- GdkRegion *invalidate_region;
- GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
- GdkRectangle src_rect, dest_rect;
- HRGN hrgn;
- RECT clipRect, destRect;
-
- obj = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
- /* Move the current invalid region */
- if (obj->update_area)
- gdk_region_offset (obj->update_area, dx, dy);
-
- /* impl->position_info.clip_rect isn't meaningful for toplevels */
- if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
- src_rect = impl->position_info.clip_rect;
- else
- {
- src_rect.x = 0;
- src_rect.y = 0;
- src_rect.width = impl->width;
- src_rect.height = impl->height;
- }
-
- invalidate_region = gdk_region_rectangle (&src_rect);
-
- dest_rect = src_rect;
- dest_rect.x += dx;
- dest_rect.y += dy;
- gdk_rectangle_intersect (&dest_rect, &src_rect, &dest_rect);
-
- if (dest_rect.width > 0 && dest_rect.height > 0)
- {
- GdkRegion *tmp_region;
-
- tmp_region = gdk_region_rectangle (&dest_rect);
- gdk_region_subtract (invalidate_region, tmp_region);
- gdk_region_destroy (tmp_region);
- }
-
- /* no guffaw scroll on win32 */
- hrgn = _gdk_win32_gdkregion_to_hrgn(invalidate_region, 0, 0);
- gdk_region_destroy (invalidate_region);
- destRect.left = dest_rect.y;
- destRect.top = dest_rect.x;
- destRect.right = dest_rect.x + dest_rect.width;
- destRect.bottom = dest_rect.y + dest_rect.height;
- clipRect.left = src_rect.y;
- clipRect.top = src_rect.x;
- clipRect.right = src_rect.x + src_rect.width;
- clipRect.bottom = src_rect.y + src_rect.height;
-
- g_print ("ScrollWindowEx(%d, %d, ...) - if you see this work, remove trace;)\n", dx, dy);
- API_CALL(ScrollWindowEx, (GDK_WINDOW_HWND (window),
- dx, dy, /* in: scroll offsets */
- NULL, /* in: scroll rect, NULL == entire client area */
- &clipRect, /* in: restrict to */
- hrgn, /* in: update region */
- NULL, /* out: update rect */
- SW_INVALIDATE));
- API_CALL(DeleteObject, (hrgn));
-}
-
void
_gdk_window_move_resize_child (GdkWindow *window,
gint x,
@@ -242,405 +58,56 @@ _gdk_window_move_resize_child (GdkWindow *window,
{
GdkWindowImplWin32 *impl;
GdkWindowObject *obj;
- GdkWin32PositionInfo new_info;
- GdkWindowParentPos parent_pos;
- GList *tmp_list;
- gint d_xoffset, d_yoffset;
- gint dx, dy;
gboolean is_move;
gboolean is_resize;
- GdkRegion *new_clip_region;
-
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ is_move = (x - obj->x != 0) && (y - obj->y != 0);
+ is_resize = obj->width != width && obj->height != height;
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s %+d%+d %dx%d %+d%+d\n",
- _gdk_win32_drawable_description (window),
- obj->x, obj->y,
- width, height, x, y));
-
- dx = x - obj->x;
- dy = y - obj->y;
+ _gdk_win32_drawable_description (window),
+ obj->x, obj->y, width, height, x, y));
- is_move = dx != 0 || dy != 0;
- is_resize = impl->width != width || impl->height != height;
+ if (width > 65535 || height > 65535)
+ {
+ g_warning ("Native children wider or taller than 65535 pixels are not supported.");
- if (!is_move && !is_resize)
- {
- GDK_NOTE (MISC, g_print ("... neither move or resize\n"));
- return;
- }
-
- GDK_NOTE (MISC, g_print ("... %s%s\n",
- is_move ? "is_move " : "",
- is_resize ? "is_resize" : ""));
+ if (width > 65535)
+ width = 65535;
+ if (height > 65535)
+ height = 65535;
+ }
obj->x = x;
obj->y = y;
- impl->width = width;
- impl->height = height;
-
- gdk_window_compute_parent_pos (impl, &parent_pos);
- gdk_window_compute_position (impl, &parent_pos, &new_info);
-
- new_clip_region =
- gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
-
- parent_pos.x += obj->x;
- parent_pos.y += obj->y;
- parent_pos.win32_x += new_info.x;
- parent_pos.win32_y += new_info.y;
- parent_pos.clip_rect = new_info.clip_rect;
-
- d_xoffset = new_info.x_offset - impl->position_info.x_offset;
- d_yoffset = new_info.y_offset - impl->position_info.y_offset;
-
- if (d_xoffset != 0 || d_yoffset != 0)
- {
- GDK_NOTE (MISC, g_print ("... d_offset=%+d%+d\n", d_xoffset, d_yoffset));
-
- if (!ScrollWindowEx (GDK_WINDOW_HWND (window),
- -d_xoffset, -d_yoffset, /* in: scroll offsets */
- NULL, /* in: scroll rect, NULL == entire client area */
- NULL, /* in: restrict to */
- NULL, /* in: update region */
- NULL, /* out: update rect */
- SW_SCROLLCHILDREN))
- WIN32_API_FAILED ("ScrollWindowEx");
-
- if (dx != d_xoffset || dy != d_yoffset || is_resize)
- {
- GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
- "NOACTIVATE|NOZORDER%s%s)\n",
- GDK_WINDOW_HWND (window),
- new_info.x, new_info.y,
- new_info.width, new_info.height,
- (is_move ? "" : "|NOMOVE"),
- (is_resize ? "" : "|NOSIZE")));
-
- API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
- new_info.x, new_info.y,
- new_info.width, new_info.height,
- SWP_NOACTIVATE | SWP_NOZORDER |
- (is_move ? 0 : SWP_NOMOVE) |
- (is_resize ? 0 : SWP_NOSIZE)));
- }
-
- if (impl->position_info.no_bg)
- gdk_window_tmp_reset_bg (window);
-
- if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
- {
- GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_SHOWNA)\n",
- GDK_WINDOW_HWND (window)));
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
- }
-
- impl->position_info = new_info;
-
- tmp_list = obj->children;
- while (tmp_list)
- {
- gdk_window_postmove (tmp_list->data, &parent_pos, FALSE);
- tmp_list = tmp_list->next;
- }
- }
- else
- {
- if (impl->position_info.mapped && !new_info.mapped)
- {
- GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_HIDE)\n",
- GDK_WINDOW_HWND (window)));
- ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
- }
-
- GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
- "NOACTIVATE|NOZORDER%s%s)\n",
- GDK_WINDOW_HWND (window),
- new_info.x, new_info.y,
- new_info.width, new_info.height,
- (is_move ? "" : "|NOMOVE"),
- (is_resize ? "" : "|NOSIZE")));
-
- API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
- new_info.x, new_info.y,
- new_info.width, new_info.height,
- SWP_NOACTIVATE | SWP_NOZORDER |
- (is_move ? 0 : SWP_NOMOVE) |
- (is_resize ? 0 : SWP_NOSIZE)));
-
- tmp_list = obj->children;
- while (tmp_list)
- {
- gdk_window_postmove (tmp_list->data, &parent_pos, FALSE);
- tmp_list = tmp_list->next;
- }
-
- if (impl->position_info.no_bg)
- gdk_window_tmp_reset_bg (window);
-
- if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
- {
- GDK_NOTE (MISC, g_print ("... ShowWindow(%p, SW_SHOWNA)\n",
- GDK_WINDOW_HWND (window)));
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
- }
-
- impl->position_info = new_info;
- }
- if (new_clip_region)
- gdk_window_post_scroll (window, new_clip_region);
-}
-
-static void
-gdk_window_compute_position (GdkWindowImplWin32 *window,
- GdkWindowParentPos *parent_pos,
- GdkWin32PositionInfo *info)
-{
- GdkWindowObject *wrapper;
- int parent_x_offset;
- int parent_y_offset;
-
- g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));
-
- wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);
-
- info->big = FALSE;
-
- if (window->width <= SIZE_LIMIT)
- {
- info->width = window->width;
- info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
- }
- else
- {
- info->big = TRUE;
- info->width = SIZE_LIMIT;
- if (parent_pos->x + wrapper->x < -(SIZE_LIMIT/2))
- {
- if (parent_pos->x + wrapper->x + window->width < (SIZE_LIMIT/2))
- info->x = parent_pos->x + wrapper->x + window->width - info->width - parent_pos->win32_x;
- else
- info->x = -(SIZE_LIMIT/2) - parent_pos->win32_x;
- }
- else
- info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
- }
-
- if (window->height <= SIZE_LIMIT)
- {
- info->height = window->height;
- info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;
- }
- else
- {
- info->big = TRUE;
- info->height = SIZE_LIMIT;
- if (parent_pos->y + wrapper->y < -(SIZE_LIMIT/2))
- {
- if (parent_pos->y + wrapper->y + window->height < (SIZE_LIMIT/2))
- info->y = parent_pos->y + wrapper->y + window->height - info->height - parent_pos->win32_y;
- else
- info->y = -(SIZE_LIMIT/2) - parent_pos->win32_y;
- }
- else
- info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;
- }
-
- parent_x_offset = parent_pos->win32_x - parent_pos->x;
- parent_y_offset = parent_pos->win32_y - parent_pos->y;
-
- info->x_offset = parent_x_offset + info->x - wrapper->x;
- info->y_offset = parent_y_offset + info->y - wrapper->y;
-
- /* We don't considering the clipping of toplevel windows and their immediate children
- * by their parents, and simply always map those windows.
- */
- if (parent_pos->clip_rect.width == G_MAXINT)
- info->mapped = TRUE;
- /* Check if the window would wrap around into the visible space in either direction */
- else if (info->x + parent_x_offset < parent_pos->clip_rect.x + parent_pos->clip_rect.width - 65536 ||
- info->x + info->width + parent_x_offset > parent_pos->clip_rect.x + 65536 ||
- info->y + parent_y_offset < parent_pos->clip_rect.y + parent_pos->clip_rect.height - 65536 ||
- info->y + info->height + parent_y_offset > parent_pos->clip_rect.y + 65536)
- info->mapped = FALSE;
- else
- info->mapped = TRUE;
-
- info->no_bg = FALSE;
-
- if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
- {
- info->clip_rect.x = wrapper->x;
- info->clip_rect.y = wrapper->y;
- info->clip_rect.width = window->width;
- info->clip_rect.height = window->height;
-
- gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);
-
- info->clip_rect.x -= wrapper->x;
- info->clip_rect.y -= wrapper->y;
- }
- else
- {
- info->clip_rect.x = 0;
- info->clip_rect.y = 0;
- info->clip_rect.width = G_MAXINT;
- info->clip_rect.height = G_MAXINT;
- }
-}
-
-static void
-gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
- GdkWindowParentPos *parent_pos)
-{
- GdkWindowObject *wrapper;
- GdkWindowObject *parent;
- GdkRectangle tmp_clip;
-
- int clip_xoffset = 0;
- int clip_yoffset = 0;
-
- g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (window));
-
- wrapper = GDK_WINDOW_OBJECT (GDK_DRAWABLE_IMPL_WIN32 (window)->wrapper);
-
- parent_pos->x = 0;
- parent_pos->y = 0;
- parent_pos->win32_x = 0;
- parent_pos->win32_y = 0;
-
- /* We take a simple approach here and simply consider toplevel
- * windows not to clip their children on the right/bottom, since the
- * size of toplevel windows is not directly under our
- * control. Clipping only really matters when scrolling and
- * generally we aren't going to be moving the immediate child of a
- * toplevel beyond the bounds of that toplevel.
- *
- * We could go ahead and recompute the clips of toplevel windows and
- * their descendents when we receive size notification, but it would
- * probably not be an improvement in most cases.
- */
- parent_pos->clip_rect.x = 0;
- parent_pos->clip_rect.y = 0;
- parent_pos->clip_rect.width = G_MAXINT;
- parent_pos->clip_rect.height = G_MAXINT;
-
- parent = (GdkWindowObject *)wrapper->parent;
- while (parent && parent->window_type == GDK_WINDOW_CHILD)
- {
- GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
-
- tmp_clip.x = - clip_xoffset;
- tmp_clip.y = - clip_yoffset;
- tmp_clip.width = impl->width;
- tmp_clip.height = impl->height;
-
- gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);
-
- parent_pos->x += parent->x;
- parent_pos->y += parent->y;
- parent_pos->win32_x += impl->position_info.x;
- parent_pos->win32_y += impl->position_info.y;
-
- clip_xoffset += parent->x;
- clip_yoffset += parent->y;
-
- parent = (GdkWindowObject *)parent->parent;
- }
-}
-
-static void
-gdk_window_postmove (GdkWindow *window,
- GdkWindowParentPos *parent_pos,
- gboolean anti_scroll)
-{
- GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
- GdkWin32PositionInfo new_info;
- GList *tmp_list;
- gint d_xoffset, d_yoffset;
- GdkWindowParentPos this_pos;
- GdkRegion *new_clip_region;
-
- obj = (GdkWindowObject *) window;
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
- gdk_window_compute_position (impl, parent_pos, &new_info);
-
- new_clip_region =
- gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
-
- this_pos.x = parent_pos->x + obj->x;
- this_pos.y = parent_pos->y + obj->y;
- this_pos.win32_x = parent_pos->win32_x + new_info.x;
- this_pos.win32_y = parent_pos->win32_y + new_info.y;
- this_pos.clip_rect = new_info.clip_rect;
-
- if (impl->position_info.mapped && !new_info.mapped)
- ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
-
- d_xoffset = new_info.x_offset - impl->position_info.x_offset;
- d_yoffset = new_info.y_offset - impl->position_info.y_offset;
-
- if (anti_scroll || (anti_scroll = d_xoffset != 0 || d_yoffset != 0))
- {
- GDK_NOTE (MISC, g_print ("gdk_window_postmove: %s %+d%+d\n"
- "... SetWindowPos(%p,NULL,%d,%d,0,0,"
- "NOREDRAW|NOZORDER|NOACTIVATE|NOSIZE)\n",
- _gdk_win32_drawable_description (window),
- obj->x, obj->y,
- GDK_WINDOW_HWND (window),
- new_info.x, new_info.y));
-
- API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
- new_info.x, new_info.y,
- 0, 0,
- SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
- }
-
- if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
-
- if (impl->position_info.no_bg)
- gdk_window_tmp_reset_bg (window);
-
- impl->position_info = new_info;
-
- if (new_clip_region)
- gdk_window_post_scroll (window, new_clip_region);
-
- tmp_list = obj->children;
- while (tmp_list)
- {
- gdk_window_postmove (tmp_list->data, &this_pos, anti_scroll);
- tmp_list = tmp_list->next;
- }
-}
-
-gboolean
-_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
- GdkRegion *area)
-{
- HRGN hrgn = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);
-
- GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose: ValidateRgn %p %s\n",
- GDK_WINDOW_HWND (window),
- _gdk_win32_gdkregion_to_string (area)));
-
- ValidateRgn (GDK_WINDOW_HWND (window), hrgn);
-
- DeleteObject (hrgn);
-
- return FALSE;
+ obj->width = width;
+ obj->height = height;
+
+ GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
+ "NOACTIVATE|NOZORDER%s%s)\n",
+ GDK_WINDOW_HWND (window),
+ obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
+ width, height,
+ (is_move ? "" : "|NOMOVE"),
+ (is_resize ? "" : "|NOSIZE")));
+
+ API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
+ obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
+ width, height,
+ SWP_NOACTIVATE | SWP_NOZORDER |
+ (is_move ? 0 : SWP_NOMOVE) |
+ (is_resize ? 0 : SWP_NOSIZE)));
}
void
_gdk_window_process_expose (GdkWindow *window,
- GdkRegion *invalidate_region)
+ GdkRegion *invalidate_region)
{
GdkWindowImplWin32 *impl;
GdkRegion *clip_region;
@@ -649,11 +116,9 @@ _gdk_window_process_expose (GdkWindow *window,
GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_gdkregion_to_string (invalidate_region)));
- clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
- gdk_region_intersect (invalidate_region, clip_region);
if (!gdk_region_empty (invalidate_region))
- gdk_window_invalidate_region (window, invalidate_region, FALSE);
+ _gdk_window_invalidate_for_expose (window, invalidate_region);
gdk_region_destroy (clip_region);
}
@@ -667,7 +132,7 @@ gdk_window_tmp_unset_bg (GdkWindow *window)
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
- impl->position_info.no_bg = TRUE;
+ impl->no_bg = TRUE;
/*
* The X version sets background = None to avoid updateing for a moment.
@@ -686,7 +151,7 @@ gdk_window_tmp_reset_bg (GdkWindow *window)
obj = (GdkWindowObject *) window;
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
- impl->position_info.no_bg = FALSE;
+ impl->no_bg = FALSE;
}
static GdkRegion *
diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c
index d844a58..0c22483 100644
--- a/gdk/win32/gdkinput-win32.c
+++ b/gdk/win32/gdkinput-win32.c
@@ -641,13 +641,14 @@ decode_tilt (gint *axis_data,
static void
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
- GdkInputWindow *input_window,
- gint *axis_data,
- gdouble *axis_out,
- gdouble *x_out,
- gdouble *y_out)
+ GdkInputWindow *input_window,
+ gint *axis_data,
+ gdouble *axis_out,
+ gdouble *x_out,
+ gdouble *y_out)
{
GdkWindowImplWin32 *impl, *root_impl;
+ GdkWindowObject *window_object;
int i;
int x_axis = 0;
@@ -656,33 +657,32 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
double device_width, device_height;
double x_offset, y_offset, x_scale, y_scale;
+ window_object = GDK_WINDOW_OBJECT (input_window);
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (input_window->window)->impl);
for (i=0; i<gdkdev->info.num_axes; i++)
{
switch (gdkdev->info.axes[i].use)
- {
- case GDK_AXIS_X:
- x_axis = i;
- break;
- case GDK_AXIS_Y:
- y_axis = i;
- break;
- default:
- break;
- }
+ {
+ case GDK_AXIS_X:
+ x_axis = i;
+ break;
+ case GDK_AXIS_Y:
+ y_axis = i;
+ break;
+ default:
+ break;
+ }
}
- device_width = gdkdev->axes[x_axis].max_value -
- gdkdev->axes[x_axis].min_value;
- device_height = gdkdev->axes[y_axis].max_value -
- gdkdev->axes[y_axis].min_value;
+ device_width = gdkdev->axes[x_axis].max_value - gdkdev->axes[x_axis].min_value;
+ device_height = gdkdev->axes[y_axis].max_value - gdkdev->axes[y_axis].min_value;
if (gdkdev->info.mode == GDK_MODE_SCREEN)
{
root_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl);
- x_scale = root_impl->width / device_width;
- y_scale = root_impl->height / device_height;
+ x_scale = GDK_WINDOW_OBJECT (_gdk_root)->width / device_width;
+ y_scale = GDK_WINDOW_OBJECT (_gdk_root)->height / device_height;
x_offset = - input_window->root_x;
y_offset = - input_window->root_y;
@@ -692,50 +692,48 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
(device_width*gdkdev->axes[x_axis].resolution);
- if (device_aspect * impl->width >= impl->height)
- {
- /* device taller than window */
- x_scale = impl->width / device_width;
- y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
- / gdkdev->axes[y_axis].resolution;
-
- x_offset = 0;
- y_offset = -(device_height * y_scale -
- impl->height)/2;
- }
+ if (device_aspect * window_object->width >= window_object->height)
+ {
+ /* device taller than window */
+ x_scale = window_object->width / device_width;
+ y_scale = (x_scale * gdkdev->axes[x_axis].resolution) / gdkdev->axes[y_axis].resolution;
+
+ x_offset = 0;
+ y_offset = -(device_height * y_scale - window_object->height) / 2;
+ }
else
- {
- /* window taller than device */
- y_scale = impl->height / device_height;
- x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
- / gdkdev->axes[x_axis].resolution;
+ {
+ /* window taller than device */
+ y_scale = window_object->height / device_height;
+ x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
+ / gdkdev->axes[x_axis].resolution;
- y_offset = 0;
- x_offset = - (device_width * x_scale - impl->width)/2;
- }
+ y_offset = 0;
+ x_offset = - (device_width * x_scale - window_object->width) / 2;
+ }
}
- for (i=0; i<gdkdev->info.num_axes; i++)
+ for (i = 0; i < gdkdev->info.num_axes; i++)
{
switch (gdkdev->info.axes[i].use)
- {
- case GDK_AXIS_X:
- axis_out[i] = x_offset + x_scale*axis_data[x_axis];
- if (x_out)
- *x_out = axis_out[i];
- break;
- case GDK_AXIS_Y:
- axis_out[i] = y_offset + y_scale*axis_data[y_axis];
- if (y_out)
- *y_out = axis_out[i];
- break;
- default:
- axis_out[i] =
- (gdkdev->info.axes[i].max * (axis_data[i] - gdkdev->axes[i].min_value) +
- gdkdev->info.axes[i].min * (gdkdev->axes[i].max_value - axis_data[i])) /
- (gdkdev->axes[i].max_value - gdkdev->axes[i].min_value);
- break;
- }
+ {
+ case GDK_AXIS_X:
+ axis_out[i] = x_offset + x_scale * axis_data[x_axis];
+ if (x_out)
+ *x_out = axis_out[i];
+ break;
+ case GDK_AXIS_Y:
+ axis_out[i] = y_offset + y_scale * axis_data[y_axis];
+ if (y_out)
+ *y_out = axis_out[i];
+ break;
+ default:
+ axis_out[i] =
+ (gdkdev->info.axes[i].max * (axis_data[i] - gdkdev->axes[i].min_value) +
+ gdkdev->info.axes[i].min * (gdkdev->axes[i].max_value - axis_data[i])) /
+ (gdkdev->axes[i].max_value - gdkdev->axes[i].min_value);
+ break;
+ }
}
}
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index 4d6e0de..59487dd 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -149,13 +149,15 @@ gdk_get_use_xshm (void)
gint
gdk_screen_get_width (GdkScreen *screen)
{
- return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->width;
+ //return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->width;
+ return GDK_WINDOW_OBJECT (_gdk_root)->width;
}
gint
gdk_screen_get_height (GdkScreen *screen)
{
- return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->height;
+ //return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_root)->impl)->height;
+ return GDK_WINDOW_OBJECT (_gdk_root)->height;
}
gint
gdk_screen_get_width_mm (GdkScreen *screen)
diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c
index 911fa9d..860bff2 100644
--- a/gdk/win32/gdkpixmap-win32.c
+++ b/gdk/win32/gdkpixmap-win32.c
@@ -130,7 +130,7 @@ gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable,
}
GdkPixmap*
-gdk_pixmap_new (GdkDrawable *drawable,
+_gdk_pixmap_new (GdkDrawable *drawable,
gint width,
gint height,
gint depth)
@@ -348,7 +348,7 @@ static const unsigned char mirror[256] = {
};
GdkPixmap *
-gdk_bitmap_create_from_data (GdkDrawable *drawable,
+_gdk_bitmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height)
@@ -388,7 +388,7 @@ gdk_bitmap_create_from_data (GdkDrawable *drawable,
}
GdkPixmap*
-gdk_pixmap_create_from_data (GdkDrawable *drawable,
+_gdk_pixmap_create_from_data (GdkDrawable *drawable,
const gchar *data,
gint width,
gint height,
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 810a28a..4327307 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -112,6 +112,9 @@
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
+//#define GDK_WINDOW_SCREEN(win) (_gdk_screen)
+GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
+
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
@@ -455,7 +458,7 @@ HICON _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
gboolean _gdk_win32_pixbuf_to_hicon_supports_alpha (void);
/* Initialization */
-void _gdk_windowing_window_init (void);
+void _gdk_windowing_window_init (GdkScreen *screen);
void _gdk_root_window_size_init (void);
void _gdk_monitor_init(void);
void _gdk_visual_init (void);
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 340cc2a..4b06640 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -39,10 +39,6 @@
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
GdkColormap *cmap);
-static void gdk_window_impl_win32_get_size (GdkDrawable *drawable,
- gint *width,
- gint *height);
-static GdkRegion* gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable);
static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window);
static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass);
static void gdk_window_impl_win32_finalize (GObject *object);
@@ -56,10 +52,17 @@ static gboolean _gdk_window_get_functions (GdkWindow *window,
#define WINDOW_IS_TOPLEVEL(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
- GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
+ GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
+ GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
+GdkScreen *
+GDK_WINDOW_SCREEN (GObject *win)
+{
+ return _gdk_screen;
+}
+
GType
_gdk_window_impl_win32_get_type (void)
{
@@ -107,8 +110,6 @@ _gdk_window_impl_get_type (void)
static void
gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
{
- impl->width = 1;
- impl->height = 1;
impl->toplevel_window_type = -1;
impl->hcursor = NULL;
impl->hicon_big = NULL;
@@ -134,11 +135,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
drawable_class->set_colormap = gdk_window_impl_win32_set_colormap;
drawable_class->get_colormap = gdk_window_impl_win32_get_colormap;
- drawable_class->get_size = gdk_window_impl_win32_get_size;
-
- /* Visible and clip regions are the same */
- drawable_class->get_clip_region = gdk_window_impl_win32_get_visible_region;
- drawable_class->get_visible_region = gdk_window_impl_win32_get_visible_region;
}
static void
@@ -236,6 +232,7 @@ gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
}
}
+/*
static void
gdk_window_impl_win32_get_size (GdkDrawable *drawable,
gint *width,
@@ -264,6 +261,7 @@ gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable)
return gdk_region_rectangle (&result_rect);
}
+*/
void
_gdk_root_window_size_init (void)
@@ -277,12 +275,12 @@ _gdk_root_window_size_init (void)
for (i = 1; i < _gdk_num_monitors; i++)
gdk_rectangle_union (&rect, &_gdk_monitors[i].rect, &rect);
- impl->width = rect.width;
- impl->height = rect.height;
+ //impl->width = rect.width;
+ //impl->height = rect.height;
}
void
-_gdk_windowing_window_init (void)
+_gdk_windowing_window_init (GdkScreen *screen)
{
GdkWindowObject *private;
GdkDrawableImplWin32 *draw_impl;
@@ -292,6 +290,7 @@ _gdk_windowing_window_init (void)
_gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *)_gdk_root;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
+ private->impl_window = private;
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
draw_impl->handle = GetDesktopWindow ();
@@ -303,8 +302,13 @@ _gdk_windowing_window_init (void)
private->depth = gdk_visual_get_system ()->depth;
_gdk_root_window_size_init ();
-
- _gdk_window_init_position (GDK_WINDOW (private));
+
+ private->x = 0;
+ private->y = 0;
+ private->abs_x = 0;
+ private->abs_y = 0;
+ // ### TODO: private->width = WidthOfScreen (screen-xscreen)
+ // private->height = HeightOfScreen (screen->xscreen) ????
gdk_win32_handle_table_insert ((HANDLE *) &draw_impl->handle, _gdk_root);
@@ -486,102 +490,63 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
return klass;
}
-static GdkWindow*
-gdk_window_new_internal (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask,
- gboolean from_set_skip_taskbar_hint)
+void
+_gdk_window_impl_new (GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkVisual *visual,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask)
{
HWND hwndNew;
HANDLE hparent;
ATOM klass = 0;
DWORD dwStyle = 0, dwExStyle;
RECT rect;
- GdkWindow *window;
GdkWindow *orig_parent;
GdkWindowObject *private;
GdkWindowImplWin32 *impl;
GdkDrawableImplWin32 *draw_impl;
- GdkVisual *visual;
const gchar *title;
wchar_t *wtitle;
gint window_width, window_height;
gint offset_x = 0, offset_y = 0;
- g_return_val_if_fail (attributes != NULL, NULL);
-
- if (!parent)
- parent = _gdk_root;
+ private = (GdkWindowObject *)window;
- g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
-
- orig_parent = parent;
+ orig_parent = real_parent;
GDK_NOTE (MISC,
g_print ("gdk_window_new_internal: %s\n",
- (attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
- (attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
- (attributes->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
+ (attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
+ (attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
+ (attributes->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
(attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" :
- "???"))))));
+ "???"))))));
- if (GDK_WINDOW_DESTROYED (parent))
- return NULL;
-
- hparent = GDK_WINDOW_HWND (parent);
+ hparent = GDK_WINDOW_HWND (real_parent);
- window = g_object_new (GDK_TYPE_WINDOW, NULL);
- private = (GdkWindowObject *)window;
- private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
- impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
- draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
+ impl = g_object_new (_gdk_window_impl_get_type (), NULL);
+ private->impl = (GdkDrawable *)impl;
draw_impl->wrapper = GDK_DRAWABLE (window);
- /* Windows with a foreign parent are treated as if they are children
- * of the root window, except for actual creation.
- */
- if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN)
- parent = _gdk_root;
-
- private->parent = (GdkWindowObject *)parent;
-
- private->accept_focus = TRUE;
- private->focus_on_map = TRUE;
+ // XXX: xattributes_mask = 0
- if (attributes_mask & GDK_WA_X)
- private->x = attributes->x;
- else
- private->x = 0;
-
- if (attributes_mask & GDK_WA_Y)
- private->y = attributes->y;
- else if (attributes_mask & GDK_WA_X)
- private->y = 100; /* ??? We must put it somewhere... */
- else
- private->y = 0;
-
+#if 0
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
visual = gdk_visual_get_system ();
+#endif
+#if 0
impl->width = (attributes->width > 1) ? (attributes->width) : (1);
impl->height = (attributes->height > 1) ? (attributes->height) : (1);
+#endif
impl->extension_events_selected = FALSE;
- if (attributes->wclass == GDK_INPUT_ONLY)
- {
- /* Backwards compatiblity - we've always ignored
- * attributes->window_type for input-only windows
- * before
- */
- if (parent == _gdk_root)
- private->window_type = GDK_WINDOW_TEMP;
- else
- private->window_type = GDK_WINDOW_CHILD;
- }
- else
- private->window_type = attributes->window_type;
+ // XXX ?
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
dwExStyle = 0;
@@ -590,15 +555,15 @@ gdk_window_new_internal (GdkWindow *parent,
private->depth = visual->depth;
if (attributes_mask & GDK_WA_COLORMAP)
- {
- draw_impl->colormap = attributes->colormap;
- g_object_ref (attributes->colormap);
- }
- else
- {
- draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
- g_object_ref (draw_impl->colormap);
- }
+ {
+ draw_impl->colormap = attributes->colormap;
+ g_object_ref (attributes->colormap);
+ }
+ else
+ {
+ draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
+ g_object_ref (draw_impl->colormap);
+ }
}
else
{
@@ -618,57 +583,54 @@ gdk_window_new_internal (GdkWindow *parent,
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_DIALOG:
- if (parent != _gdk_root)
- {
- g_warning (G_STRLOC ": Toplevel windows must be created as children\n"
- "of a window of type GDK_WINDOW_ROOT or GDK_WINDOW_FOREIGN");
- hparent = GetDesktopWindow ();
- }
+ if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
+ {
+ /* The common code warns for this case. */
+ hparent = GetDesktopWindow ();
+ }
/* Children of foreign windows aren't toplevel windows */
if (GDK_WINDOW_TYPE (orig_parent) == GDK_WINDOW_FOREIGN)
- {
- dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
- }
+ {
+ dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
+ }
else
- {
- if (private->window_type == GDK_WINDOW_TOPLEVEL)
- dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
- else
- dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
+ {
+ if (private->window_type == GDK_WINDOW_TOPLEVEL)
+ dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
+ else
+ dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
- offset_x = _gdk_offset_x;
- offset_y = _gdk_offset_y;
- }
+ offset_x = _gdk_offset_x;
+ offset_y = _gdk_offset_y;
+ }
break;
+ /*
case GDK_WINDOW_CHILD:
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
break;
+ */
case GDK_WINDOW_TEMP:
/* A temp window is not necessarily a top level window */
- dwStyle = (_gdk_root == parent ? WS_POPUP : WS_CHILDWINDOW);
+ dwStyle = (_gdk_root == real_parent ? WS_POPUP : WS_CHILDWINDOW);
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
dwExStyle |= WS_EX_TOOLWINDOW;
offset_x = _gdk_offset_x;
offset_y = _gdk_offset_y;
break;
- case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
-
default:
g_assert_not_reached ();
}
- _gdk_window_init_position (GDK_WINDOW (private));
+ //_gdk_window_init_position (GDK_WINDOW (private));
if (private->window_type != GDK_WINDOW_CHILD)
{
rect.left = rect.top = 0;
- rect.right = impl->position_info.width;
- rect.bottom = impl->position_info.height;
+ rect.right = private->width;
+ rect.bottom = private->height;
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
@@ -677,8 +639,8 @@ gdk_window_new_internal (GdkWindow *parent,
}
else
{
- window_width = impl->position_info.width;
- window_height = impl->position_info.height;
+ window_width = private->width;
+ window_height = private->height;
}
if (attributes_mask & GDK_WA_TITLE)
@@ -706,17 +668,17 @@ gdk_window_new_internal (GdkWindow *parent,
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
hwndNew = CreateWindowExW (dwExStyle,
- MAKEINTRESOURCEW (klass),
- wtitle,
- dwStyle,
- ((attributes_mask & GDK_WA_X) ?
- impl->position_info.x - offset_x : CW_USEDEFAULT),
- impl->position_info.y - offset_y,
- window_width, window_height,
- hparent,
- NULL,
- _gdk_app_hmodule,
- window);
+ MAKEINTRESOURCEW (klass),
+ wtitle,
+ dwStyle,
+ ((attributes_mask & GDK_WA_X) ?
+ private->x - offset_x : CW_USEDEFAULT),
+ private->y - offset_y,
+ window_width, window_height,
+ hparent,
+ NULL,
+ _gdk_app_hmodule,
+ window);
if (GDK_WINDOW_HWND (window) != hwndNew)
{
g_warning ("gdk_window_new: gdk_event_translate::WM_CREATE (%p, %p) HWND mismatch.",
@@ -746,8 +708,8 @@ gdk_window_new_internal (GdkWindow *parent,
title,
window_width, window_height,
((attributes_mask & GDK_WA_X) ?
- impl->position_info.x - offset_x: CW_USEDEFAULT),
- impl->position_info.y - offset_y,
+ private->x - offset_x: CW_USEDEFAULT),
+ private->y - offset_y,
hparent,
GDK_WINDOW_HWND (window)));
@@ -760,25 +722,15 @@ gdk_window_new_internal (GdkWindow *parent,
{
WIN32_API_FAILED ("CreateWindowExW");
g_object_unref (window);
- return NULL;
+ return;
}
- if (!from_set_skip_taskbar_hint && private->window_type == GDK_WINDOW_TEMP)
- gdk_window_set_skip_taskbar_hint (window, TRUE);
+// if (!from_set_skip_taskbar_hint && private->window_type == GDK_WINDOW_TEMP)
+// gdk_window_set_skip_taskbar_hint (window, TRUE);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
-
- return window;
-}
-
-GdkWindow*
-_gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask)
-{
- return gdk_window_new_internal (parent, attributes, attributes_mask, FALSE);
}
GdkWindow *
@@ -819,8 +771,8 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
ScreenToClient (parent, &point);
private->x = point.x;
private->y = point.y;
- impl->width = rect.right - rect.left;
- impl->height = rect.bottom - rect.top;
+ private->width = rect.right - rect.left;
+ private->height = rect.bottom - rect.top;
private->window_type = GDK_WINDOW_FOREIGN;
private->destroyed = FALSE;
private->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
@@ -836,7 +788,7 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
private->depth = gdk_visual_get_system ()->depth;
- _gdk_window_init_position (GDK_WINDOW (private));
+ //_gdk_window_init_position (GDK_WINDOW (private));
g_object_ref (window);
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
@@ -956,11 +908,17 @@ get_outer_rect (GdkWindow *window,
}
static void
-adjust_for_gravity_hints (GdkWindowImplWin32 *impl,
- RECT *outer_rect,
- gint *x,
- gint *y)
+adjust_for_gravity_hints (GdkWindow *window,
+ RECT *outer_rect,
+ gint *x,
+ gint *y)
{
+ GdkWindowObject *obj;
+ GdkWindowImplWin32 *impl;
+
+ obj = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
{
gint orig_x = *x, orig_y = *y;
@@ -971,14 +929,14 @@ adjust_for_gravity_hints (GdkWindowImplWin32 *impl,
case GDK_GRAVITY_CENTER:
case GDK_GRAVITY_SOUTH:
*x -= (outer_rect->right - outer_rect->left) / 2;
- *x += impl->width / 2;
+ *x += obj->width / 2;
break;
case GDK_GRAVITY_SOUTH_EAST:
case GDK_GRAVITY_EAST:
case GDK_GRAVITY_NORTH_EAST:
*x -= outer_rect->right - outer_rect->left;
- *x += impl->width;
+ *x += obj->width;
break;
case GDK_GRAVITY_STATIC:
@@ -995,14 +953,14 @@ adjust_for_gravity_hints (GdkWindowImplWin32 *impl,
case GDK_GRAVITY_CENTER:
case GDK_GRAVITY_EAST:
*y -= (outer_rect->bottom - outer_rect->top) / 2;
- *y += impl->height / 2;
+ *y += obj->height / 2;
break;
case GDK_GRAVITY_SOUTH_WEST:
case GDK_GRAVITY_SOUTH:
case GDK_GRAVITY_SOUTH_EAST:
*y -= outer_rect->bottom - outer_rect->top;
- *y += impl->height;
+ *y += obj->height;
break;
case GDK_GRAVITY_STATIC:
@@ -1039,7 +997,7 @@ show_window_internal (GdkWindow *window,
GDK_NOTE (MISC, g_print ("show_window_internal: %p: %s%s%s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (private->state),
- (raise ? " raise" : ""),
+ //(raise ? " raise" : ""),
(deiconify ? " deiconify" : "")));
/* If asked to show (not deiconify) an withdrawn and iconified
@@ -1100,10 +1058,10 @@ show_window_internal (GdkWindow *window,
{
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE;
- if (!raise)
- flags |= SWP_NOZORDER;
+ if (!raise)
+ flags |= SWP_NOZORDER;
if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
- flags |= SWP_NOACTIVATE;
+ flags |= SWP_NOACTIVATE;
SetWindowPos (GDK_WINDOW_HWND (window), top, 0, 0, 0, 0, flags);
@@ -1169,9 +1127,9 @@ show_window_internal (GdkWindow *window,
}
static void
-gdk_win32_window_show (GdkWindow *window, gboolean raise)
+gdk_win32_window_show (GdkWindow *window)
{
- show_window_internal (window, raise, FALSE);
+ show_window_internal (window, FALSE, FALSE);
}
static void
@@ -1251,15 +1209,15 @@ gdk_win32_window_move (GdkWindow *window,
*/
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
{
- _gdk_window_move_resize_child (window, x, y, impl->width, impl->height);
+ _gdk_window_move_resize_child (window, x, y, private->width, private->height);
}
else
{
RECT outer_rect;
- get_outer_rect (window, impl->width, impl->height, &outer_rect);
+ get_outer_rect (window, private->width, private->height, &outer_rect);
- adjust_for_gravity_hints (impl, &outer_rect, &x, &y);
+ adjust_for_gravity_hints (window, &outer_rect, &x, &y);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
"NOACTIVATE|NOSIZE|NOZORDER)\n",
@@ -1329,7 +1287,7 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowObject *private = (GdkWindowObject*) window;
+ GdkWindowObject *private;
GdkWindowImplWin32 *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1342,6 +1300,7 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
if (height < 1)
height = 1;
+ private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
@@ -1361,7 +1320,7 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
get_outer_rect (window, width, height, &outer_rect);
- adjust_for_gravity_hints (impl, &outer_rect, &x, &y);
+ adjust_for_gravity_hints (window, &outer_rect, &x, &y);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
"NOACTIVATE|NOZORDER)\n",
@@ -1452,7 +1411,7 @@ gdk_win32_window_reparent (GdkWindow *window,
GDK_WINDOW_HWND (new_parent)));
API_CALL (MoveWindow, (GDK_WINDOW_HWND (window),
- x, y, impl->width, impl->height, TRUE));
+ x, y, window_private->width, window_private->height, TRUE));
/* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
* the root window
@@ -1492,7 +1451,7 @@ gdk_win32_window_reparent (GdkWindow *window,
g_list_remove (old_parent_private->children, window);
parent_private->children = g_list_prepend (parent_private->children, window);
- _gdk_window_init_position (GDK_WINDOW (window_private));
+ //_gdk_window_init_position (GDK_WINDOW (window_private));
return FALSE;
}
@@ -1513,7 +1472,7 @@ erase_background (GdkWindow *window,
if (((GdkWindowObject *) window)->input_only ||
((GdkWindowObject *) window)->bg_pixmap == GDK_NO_BG ||
- GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
+ GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->no_bg)
{
return;
}
@@ -1549,7 +1508,7 @@ erase_background (GdkWindow *window,
window = GDK_WINDOW (((GdkWindowObject *) window)->parent);
}
- if (GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
+ if (GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->no_bg)
{
/* Improves scolling effect, e.g. main buttons of testgtk */
return;
@@ -1639,8 +1598,10 @@ gdk_win32_window_clear_area (GdkWindow *window,
gboolean send_expose)
{
GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
- impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ obj = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
if (!GDK_WINDOW_DESTROYED (window))
{
@@ -1652,9 +1613,9 @@ gdk_win32_window_clear_area (GdkWindow *window,
if (!send_expose)
{
if (width == 0)
- width = impl->width - x;
+ width = obj->width - x;
if (height == 0)
- height = impl->height - y;
+ height = obj->height - y;
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: %p: "
"%dx%d %+d%+d\n",
GDK_WINDOW_HWND (window),
@@ -2137,39 +2098,14 @@ gdk_win32_window_set_background (GdkWindow *window,
static void
gdk_win32_window_set_back_pixmap (GdkWindow *window,
- GdkPixmap *pixmap,
- gint parent_relative)
+ GdkPixmap *pixmap)
{
GdkWindowObject *private = (GdkWindowObject *)window;
- if (pixmap && !gdk_drawable_get_colormap (pixmap))
- {
- g_warning ("gdk_window_set_back_pixmap(): pixmap must have a colormap");
- return;
- }
-
- if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
- g_object_unref (private->bg_pixmap);
-
- if (parent_relative)
- {
- private->bg_pixmap = GDK_PARENT_RELATIVE_BG;
- GDK_NOTE (MISC, g_print (G_STRLOC ": setting background pixmap to parent_relative\n"));
- }
- else
- {
- if (pixmap)
- {
- g_object_ref (pixmap);
+ if (pixmap == GDK_PARENT_RELATIVE_BG || pixmap == GDK_NO_BG)
+ {
private->bg_pixmap = pixmap;
- }
- else
- {
- private->bg_pixmap = GDK_NO_BG;
- }
- }
+ }
}
static void
@@ -2376,14 +2312,21 @@ gdk_win32_window_get_origin (GdkWindow *window,
return return_val;
}
-gboolean
-gdk_window_get_deskrelative_origin (GdkWindow *window,
- gint *x,
- gint *y)
+static gboolean
+gdk_win32_window_get_deskrelative_origin (GdkWindow *window,
+ gint *x,
+ gint *y)
{
return gdk_window_get_origin (window, x, y);
}
+static void
+gdk_win32_window_restack_under (GdkWindow *window,
+ GList *native_siblings)
+{
+ // ### TODO
+}
+
void
gdk_window_get_root_origin (GdkWindow *window,
gint *x,
@@ -2544,8 +2487,9 @@ gdk_display_warp_pointer (GdkDisplay *display,
GdkWindow*
_gdk_windowing_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y)
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask)
{
GdkWindow *window;
POINT point, pointc;
@@ -2665,27 +2609,6 @@ gdk_win32_window_shape_combine_mask (GdkWindow *window,
}
}
-void
-gdk_window_input_shape_combine_mask (GdkWindow *window,
- GdkBitmap *mask,
- gint x,
- gint y)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* Not yet implemented
- *
- * I don't think there is anything in the Win32 API to directly
- * support this. And anyway, as we don't currently support RGBA
- * windows, it doesn't really matter.
- *
- * When we do support RGBA, input shape functionality could probably
- * be implemented by saving the input shape region in the per-window
- * private data, and then simply checking before generating an input
- * event whether the event's coordinates are inside the region.
- */
-}
-
void
gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect)
@@ -3195,6 +3118,7 @@ gdk_win32_window_merge_child_shapes (GdkWindow *window)
gdk_propagate_shapes (GDK_WINDOW_HWND (window), TRUE);
}
+#if 0
void
gdk_window_set_child_input_shapes (GdkWindow *window)
{
@@ -3204,7 +3128,9 @@ gdk_window_set_child_input_shapes (GdkWindow *window)
* gdk_window_input_shape_combine_mask().
*/
}
+#endif
+#if 0
void
gdk_window_merge_child_input_shapes (GdkWindow *window)
{
@@ -3214,6 +3140,7 @@ gdk_window_merge_child_input_shapes (GdkWindow *window)
* gdk_window_input_shape_combine_mask().
*/
}
+#endif
static gboolean
gdk_win32_window_set_static_gravities (GdkWindow *window,
@@ -3648,10 +3575,10 @@ gdk_window_set_modal_hint (GdkWindow *window,
void
gdk_window_set_skip_taskbar_hint (GdkWindow *window,
- gboolean skips_taskbar)
+ gboolean skips_taskbar)
{
static GdkWindow *owner = NULL;
- GdkWindowAttr wa;
+ //GdkWindowAttr wa;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -3664,14 +3591,16 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
if (skips_taskbar)
{
+#if 0
if (owner == NULL)
- {
- wa.window_type = GDK_WINDOW_TEMP;
- wa.wclass = GDK_INPUT_OUTPUT;
- wa.width = wa.height = 1;
- wa.event_mask = 0;
- owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
- }
+ {
+ wa.window_type = GDK_WINDOW_TEMP;
+ wa.wclass = GDK_INPUT_OUTPUT;
+ wa.width = wa.height = 1;
+ wa.event_mask = 0;
+ owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
+ }
+#endif
SetWindowLongPtr (GDK_WINDOW_HWND (window), GWLP_HWNDPARENT, (LONG_PTR) GDK_WINDOW_HWND (owner));
@@ -3692,7 +3621,7 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
void
gdk_window_set_skip_pager_hint (GdkWindow *window,
- gboolean skips_pager)
+ gboolean skips_pager)
{
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -3703,7 +3632,7 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
void
gdk_window_set_type_hint (GdkWindow *window,
- GdkWindowTypeHint hint)
+ GdkWindowTypeHint hint)
{
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -3738,9 +3667,9 @@ gdk_window_get_type_hint (GdkWindow *window)
static void
gdk_win32_window_shape_combine_region (GdkWindow *window,
- const GdkRegion *shape_region,
- gint offset_x,
- gint offset_y)
+ const GdkRegion *shape_region,
+ gint offset_x,
+ gint offset_y)
{
GdkWindowObject *private = (GdkWindowObject *)window;
@@ -3771,19 +3700,6 @@ gdk_win32_window_shape_combine_region (GdkWindow *window,
}
}
-void
-gdk_window_input_shape_combine_region (GdkWindow *window,
- const GdkRegion *shape_region,
- gint offset_x,
- gint offset_y)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* Not yet implemented. See comment in
- * gdk_window_input_shape_combine_mask().
- */
-}
-
GdkWindow *
gdk_window_lookup_for_display (GdkDisplay *display,
GdkNativeWindow anid)
@@ -3849,11 +3765,78 @@ gdk_window_set_opacity (GdkWindow *window,
}
}
+GdkRegion *
+_gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
+{
+ // XXX: TODO
+ return NULL;
+}
+
void
_gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
{
}
+GdkRegion *
+_gdk_windowing_window_get_shape (GdkWindow *window)
+{
+ return NULL;
+}
+
+GdkRegion *
+_gdk_windowing_window_get_input_shape (GdkWindow *window)
+{
+ return NULL;
+}
+
+static void
+_gdk_win32_window_destroy (GdkWindow *window,
+ gboolean recursing,
+ gboolean foreign_destroy)
+{
+}
+
+static gboolean
+_gdk_win32_window_queue_antiexpose (GdkWindow *window,
+ GdkRegion *area)
+{
+ HRGN hrgn = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);
+
+ GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose: ValidateRgn %p %s\n",
+ GDK_WINDOW_HWND (window),
+ _gdk_win32_gdkregion_to_string (area)));
+
+ ValidateRgn (GDK_WINDOW_HWND (window), hrgn);
+
+ DeleteObject (hrgn);
+
+ return FALSE;
+}
+
+static void
+gdk_win32_input_shape_combine_region (GdkWindow *window,
+ const GdkRegion *shape_region,
+ gint offset_x,
+ gint offset_y)
+{
+}
+
+void
+_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
+ GdkRegion *region)
+{
+}
+
+void
+_gdk_windowing_before_process_all_updates (void)
+{
+}
+
+void
+_gdk_windowing_after_process_all_updates (void)
+{
+}
+
static void
gdk_window_impl_iface_init (GdkWindowImplIface *iface)
{
@@ -3862,22 +3845,21 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->withdraw = gdk_win32_window_withdraw;
iface->set_events = gdk_win32_window_set_events;
iface->get_events = gdk_win32_window_get_events;
- iface->clear_area = gdk_win32_window_clear_area;
iface->raise = gdk_win32_window_raise;
iface->lower = gdk_win32_window_lower;
+ iface->restack_under = gdk_win32_window_restack_under;
iface->move_resize = gdk_win32_window_move_resize;
- iface->scroll = _gdk_win32_window_scroll;
- iface->move_region = _gdk_win32_window_move_region;
iface->set_background = gdk_win32_window_set_background;
iface->set_back_pixmap = gdk_win32_window_set_back_pixmap;
iface->reparent = gdk_win32_window_reparent;
iface->set_cursor = gdk_win32_window_set_cursor;
iface->get_geometry = gdk_win32_window_get_geometry;
iface->get_origin = gdk_win32_window_get_origin;
- iface->shape_combine_mask = gdk_win32_window_shape_combine_mask;
iface->shape_combine_region = gdk_win32_window_shape_combine_region;
- iface->set_child_shapes = gdk_win32_window_set_child_shapes;
- iface->merge_child_shapes = gdk_win32_window_merge_child_shapes;
+ iface->input_shape_combine_region = gdk_win32_input_shape_combine_region;
+ iface->get_deskrelative_origin = gdk_win32_window_get_deskrelative_origin;
iface->set_static_gravities = gdk_win32_window_set_static_gravities;
- iface->get_offsets = _gdk_win32_windowing_window_get_offsets;
+ iface->queue_antiexpose = _gdk_win32_window_queue_antiexpose;
+ iface->queue_translation = NULL; //_gdk_win32_window_queue_translation;
+ iface->destroy = _gdk_win32_window_destroy;
}
diff --git a/gdk/win32/gdkwindow-win32.h b/gdk/win32/gdkwindow-win32.h
index fbc461c..3ce4e9d 100644
--- a/gdk/win32/gdkwindow-win32.h
+++ b/gdk/win32/gdkwindow-win32.h
@@ -33,6 +33,7 @@ G_BEGIN_DECLS
typedef struct _GdkWin32PositionInfo GdkWin32PositionInfo;
+#if 0
struct _GdkWin32PositionInfo
{
gint x;
@@ -49,6 +50,7 @@ struct _GdkWin32PositionInfo
*/
GdkRectangle clip_rect; /* visible rectangle of window */
};
+#endif
/* Window implementation for Win32
@@ -68,11 +70,6 @@ struct _GdkWindowImplWin32
{
GdkDrawableImplWin32 parent_instance;
- gint width;
- gint height;
-
- GdkWin32PositionInfo position_info;
-
gint8 toplevel_window_type;
HCURSOR hcursor;
@@ -91,6 +88,8 @@ struct _GdkWindowImplWin32
GSList *transient_children;
gint num_transients;
gboolean changing_state;
+
+ guint no_bg : 1;
};
struct _GdkWindowImplWin32Class
diff --git a/tests/testclientmessage.c b/tests/testclientmessage.c
index 436e9e8..bd1a097 100644
--- a/tests/testclientmessage.c
+++ b/tests/testclientmessage.c
@@ -1,122 +1,122 @@
-/* testclientmessage.c
- * Copyright (C) 2008 Novell, 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.
- */
-
-#include <gtk/gtk.h>
-
-static GdkAtom my_type;
-static GdkAtom random_type;
-
-static void
-send_known (void)
-{
- GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
- static int counter = 42;
- int i;
-
- event->client.window = NULL;
- event->client.message_type = my_type;
- event->client.data_format = 32;
- event->client.data.l[0] = counter++;
- for (i = 1; i < 5; i++)
- event->client.data.l[i] = 0;
-
- gdk_screen_broadcast_client_message (gdk_display_get_default_screen (gdk_display_get_default ()), event);
-
- gdk_event_free (event);
-}
-
-void
-send_random (void)
-{
- GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
- static int counter = 1;
- int i;
-
- event->client.window = NULL;
- event->client.message_type = random_type;
- event->client.data_format = 32;
- event->client.data.l[0] = counter++;
- for (i = 1; i < 5; i++)
- event->client.data.l[i] = 0;
-
- gdk_screen_broadcast_client_message (gdk_display_get_default_screen (gdk_display_get_default ()), event);
-
- gdk_event_free (event);
-}
-
-static GdkFilterReturn
-filter_func (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data)
-{
- g_print ("Got matching client message!\n");
- return GDK_FILTER_REMOVE;
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window;
- GtkWidget *vbox;
- GtkWidget *button;
-
- gtk_init (&argc, &argv);
-
- my_type = gdk_atom_intern ("GtkTestClientMessage", FALSE);
- random_type = gdk_atom_intern (g_strdup_printf ("GtkTestClientMessage-%d",
- g_rand_int_range (g_rand_new (), 1, 99)),
- FALSE);
-
- g_print ("using random client message type %s\n", gdk_atom_name (random_type));
-
- window = g_object_connect (g_object_new (gtk_window_get_type (),
- "type", GTK_WINDOW_TOPLEVEL,
- "title", "testclientmessage",
- "border_width", 10,
- NULL),
- "signal::destroy", gtk_main_quit, NULL,
- NULL);
- vbox = g_object_new (gtk_vbox_get_type (),
- "GtkWidget::parent", window,
- "GtkWidget::visible", TRUE,
- NULL);
- button = g_object_connect (g_object_new (gtk_button_get_type (),
- "GtkButton::label", "send known client message",
- "GtkWidget::parent", vbox,
- "GtkWidget::visible", TRUE,
- NULL),
- "signal::clicked", send_known, NULL,
- NULL);
- button = g_object_connect (g_object_new (gtk_button_get_type (),
- "GtkButton::label", "send random client message",
- "GtkWidget::parent", vbox,
- "GtkWidget::visible", TRUE,
- NULL),
- "signal::clicked", send_random, NULL,
- NULL);
- gdk_display_add_client_message_filter (gdk_display_get_default (),
- my_type,
- filter_func,
- NULL);
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
+/* testclientmessage.c
+ * Copyright (C) 2008 Novell, 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.
+ */
+
+#include <gtk/gtk.h>
+
+static GdkAtom my_type;
+static GdkAtom random_type;
+
+static void
+send_known (void)
+{
+ GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
+ static int counter = 42;
+ int i;
+
+ event->client.window = NULL;
+ event->client.message_type = my_type;
+ event->client.data_format = 32;
+ event->client.data.l[0] = counter++;
+ for (i = 1; i < 5; i++)
+ event->client.data.l[i] = 0;
+
+ gdk_screen_broadcast_client_message (gdk_display_get_default_screen (gdk_display_get_default ()), event);
+
+ gdk_event_free (event);
+}
+
+void
+send_random (void)
+{
+ GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
+ static int counter = 1;
+ int i;
+
+ event->client.window = NULL;
+ event->client.message_type = random_type;
+ event->client.data_format = 32;
+ event->client.data.l[0] = counter++;
+ for (i = 1; i < 5; i++)
+ event->client.data.l[i] = 0;
+
+ gdk_screen_broadcast_client_message (gdk_display_get_default_screen (gdk_display_get_default ()), event);
+
+ gdk_event_free (event);
+}
+
+static GdkFilterReturn
+filter_func (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ g_print ("Got matching client message!\n");
+ return GDK_FILTER_REMOVE;
+}
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *vbox;
+ GtkWidget *button;
+
+ gtk_init (&argc, &argv);
+
+ my_type = gdk_atom_intern ("GtkTestClientMessage", FALSE);
+ random_type = gdk_atom_intern (g_strdup_printf ("GtkTestClientMessage-%d",
+ g_rand_int_range (g_rand_new (), 1, 99)),
+ FALSE);
+
+ g_print ("using random client message type %s\n", gdk_atom_name (random_type));
+
+ window = g_object_connect (g_object_new (gtk_window_get_type (),
+ "type", GTK_WINDOW_TOPLEVEL,
+ "title", "testclientmessage",
+ "border_width", 10,
+ NULL),
+ "signal::destroy", gtk_main_quit, NULL,
+ NULL);
+ vbox = g_object_new (gtk_vbox_get_type (),
+ "GtkWidget::parent", window,
+ "GtkWidget::visible", TRUE,
+ NULL);
+ button = g_object_connect (g_object_new (gtk_button_get_type (),
+ "GtkButton::label", "send known client message",
+ "GtkWidget::parent", vbox,
+ "GtkWidget::visible", TRUE,
+ NULL),
+ "signal::clicked", send_known, NULL,
+ NULL);
+ button = g_object_connect (g_object_new (gtk_button_get_type (),
+ "GtkButton::label", "send random client message",
+ "GtkWidget::parent", vbox,
+ "GtkWidget::visible", TRUE,
+ NULL),
+ "signal::clicked", send_random, NULL,
+ NULL);
+ gdk_display_add_client_message_filter (gdk_display_get_default (),
+ my_type,
+ filter_func,
+ NULL);
+ gtk_widget_show (window);
+
+ gtk_main ();
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]