diff options
author | Hans Breuer <hans@breuer.org> | 2005-07-03 15:47:42 +0000 |
---|---|---|
committer | Hans Breuer <hans@src.gnome.org> | 2005-07-03 15:47:42 +0000 |
commit | 19e9165d64e954a64edd2cd9b29f0073c888c802 (patch) | |
tree | 543c0f66cf4b64be65f8b83f7484af745d89066d /gdk | |
parent | 1d1b9c7abec5a5b505f2009e969c018b0906a467 (diff) | |
download | gdk-pixbuf-19e9165d64e954a64edd2cd9b29f0073c888c802.tar.gz |
updated <io.h> for open() use G_PI instead of M_PI
2005-07-03 Hans Breuer <hans@breuer.org>
* **/makefile.msc[.in] : updated
* gtk/gtkiconcache.c : <io.h> for open()
* gtk/gtkstyle.c : use G_PI instead of M_PI
* gdk/win32/gdkcursor-win32.c : implement gdk_cursor_new_from_name()
by mapping the lower case win32 api name to the respective cursor.
E.g. pass "wait" to get the IDC_WAIT cursor. Also allows to load
cursors from named resources in the executable.
(gdk_cursor_get_image) : just return NULL for now.
* gdk/win32/gdkgeometry-win32.c : implement gdk_window_move_region()
by delegation to ScollWindowEx(), untested.
* gdk/win32/gdkwindow-win32.c : stub for gdk_window_set_urgency_hint()
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/makefile.msc | 1 | ||||
-rw-r--r-- | gdk/win32/gdkcursor-win32.c | 50 | ||||
-rw-r--r-- | gdk/win32/gdkgeometry-win32.c | 78 | ||||
-rw-r--r-- | gdk/win32/gdkwindow-win32.c | 13 |
4 files changed, 142 insertions, 0 deletions
diff --git a/gdk/makefile.msc b/gdk/makefile.msc index ab34dded6..66bb791d2 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -73,6 +73,7 @@ all: \ gdk_OBJECTS = \ gdk.obj \ + gdkcairo.obj \ gdkcolor.obj \ gdkcursor.obj \ gdkdisplay.obj \ diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c index 5aea41780..c76290731 100644 --- a/gdk/win32/gdkcursor-win32.c +++ b/gdk/win32/gdkcursor-win32.c @@ -322,6 +322,49 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source, return _gdk_win32_cursor_new_from_hcursor (hcursor, GDK_CURSOR_IS_PIXMAP); } +static struct { + char *name; + char *id; +} _default_cursors[] = { + { "appstarting", IDC_APPSTARTING }, + { "arrow", IDC_ARROW }, + { "cross", IDC_CROSS }, +#if 0 /* in the SDK docs but not the headers ? */ + { "hand", IDC_HAND }, +#endif + { "help", IDC_HELP }, + { "ibeam", IDC_IBEAM }, + { "sizeall", IDC_SIZEALL }, + { "sizenesw", IDC_SIZENESW }, + { "sizens", IDC_SIZENS }, + { "sizenwse", IDC_SIZENWSE }, + { "sizewe", IDC_SIZEWE }, + { "uparrow", IDC_UPARROW }, + { "wait", IDC_WAIT } +}; + +GdkCursor* +gdk_cursor_new_from_name (GdkDisplay *display, + const gchar *name) +{ + HCURSOR hcursor = NULL; + int i; + + for (i = 0; i < G_N_ELEMENTS(_default_cursors); i++) + { + if (0 == strcmp(_default_cursors[i].name, name)) + hcursor = LoadCursor (NULL, _default_cursors[i].id); + } + /* allow to load named cursor resources linked into the executable */ + if (!hcursor) + hcursor = LoadCursor (_gdk_app_hmodule, name); + + if (hcursor) + return _gdk_win32_cursor_new_from_hcursor (hcursor, GDK_X_CURSOR); + + return NULL; +} + void _gdk_cursor_destroy (GdkCursor *cursor) { @@ -348,6 +391,13 @@ gdk_cursor_get_display (GdkCursor *cursor) return gdk_display_get_default (); } +GdkPixbuf* +gdk_cursor_get_image (GdkCursor *cursor) +{ + /* could certainly be implmented but from docs may also */ + return NULL; +} + GdkCursor * gdk_cursor_new_from_pixbuf (GdkDisplay *display, GdkPixbuf *pixbuf, diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c index 8308a197d..5c5b51be8 100644 --- a/gdk/win32/gdkgeometry-win32.c +++ b/gdk/win32/gdkgeometry-win32.c @@ -178,6 +178,84 @@ gdk_window_scroll (GdkWindow *window, } void +gdk_window_move_region (GdkWindow *window, + GdkRegion *region, + gint dx, + gint dy) +{ + GdkRegion *invalidate_region; + GdkWindowImplWin32 *impl; + GdkWindowObject *obj; + GdkRectangle src_rect, dest_rect; + HRGN hrgn; + RECT clipRect, destRect; + + g_return_if_fail (GDK_IS_WINDOW (window)); + + if (GDK_WINDOW_DESTROYED (window)) + return; + + obj = GDK_WINDOW_OBJECT (window); + impl = GDK_WINDOW_IMPL_WIN32 (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); + + /* 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, gint y, diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 150f7beed..e80b4dda4 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -1567,6 +1567,19 @@ gdk_window_set_hints (GdkWindow *window, } } +void +gdk_window_set_urgency_hint (GdkWindow *window, + gboolean urgent) +{ + g_return_if_fail (GDK_IS_WINDOW (window)); + g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD); + + if (GDK_WINDOW_DESTROYED (window)) + return; + + g_warning ("gdk_window_set_urgency_hint() not implemented yet."); +} + void gdk_window_set_geometry_hints (GdkWindow *window, GdkGeometry *geometry, |