summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2000-07-25 17:31:05 +0000
committerTor Lillqvist <tml@src.gnome.org>2000-07-25 17:31:05 +0000
commit5ac61d3eeebe1947c4a3c5fbab3a89bb4d124a59 (patch)
tree752f2e7fc56b5ec78bac30d5dd1792cf0b3fd9f5
parent37e809867ef943dbfd407875f6c182b9a4ce2d9b (diff)
downloadgdk-pixbuf-5ac61d3eeebe1947c4a3c5fbab3a89bb4d124a59.tar.gz
Include the build directory.
2000-07-25 Tor Lillqvist <tml@iki.fi> * Makefile.am: Include the build directory. * configure.in: Generate build/Makefile and build/win32/Makefile. * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf. * gdk/gdk.def * gtk/gtk.def: Updates. * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with PANGOWIN32_LIBS and gdk_pixbuf. * gdk/win32: Compiles, but no doubt doesn't work at all. * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION. * gdk/win32/gdkinput.c: New file, temporarily. * gdk/win32/gdkinput-win32.h: New file * gdk/win32/gdkinputprivate.h: Remove. * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and made externally visible.
-rw-r--r--ChangeLog32
-rw-r--r--ChangeLog.pre-2-032
-rw-r--r--ChangeLog.pre-2-1032
-rw-r--r--ChangeLog.pre-2-232
-rw-r--r--ChangeLog.pre-2-432
-rw-r--r--ChangeLog.pre-2-632
-rw-r--r--ChangeLog.pre-2-832
-rw-r--r--Makefile.am2
-rwxr-xr-xconfig.h.win325
-rw-r--r--configure.in2
-rw-r--r--gdk/gdk.def22
-rw-r--r--gdk/makefile.mingw.in4
-rw-r--r--gdk/win32/gdkcolor-win32.c2
-rw-r--r--gdk/win32/gdkdnd-win32.c8
-rw-r--r--gdk/win32/gdkdrawable-win32.c52
-rw-r--r--gdk/win32/gdkevents-win32.c250
-rw-r--r--gdk/win32/gdkgc-win32.c159
-rw-r--r--gdk/win32/gdkgeometry-win32.c438
-rw-r--r--gdk/win32/gdkglobals-win32.c1
-rw-r--r--gdk/win32/gdkimage-win32.c149
-rw-r--r--gdk/win32/gdkinput-win32.c1099
-rw-r--r--gdk/win32/gdkinput-win32.h177
-rw-r--r--gdk/win32/gdkinput.c368
-rw-r--r--gdk/win32/gdkinputprivate.h119
-rw-r--r--gdk/win32/gdkmain-win32.c14
-rw-r--r--gdk/win32/gdkpixmap-win32.c847
-rw-r--r--gdk/win32/gdkprivate-win32.h21
-rw-r--r--gdk/win32/gdkproperty-win32.c14
-rw-r--r--gdk/win32/gdkselection-win32.c41
-rw-r--r--gdk/win32/gdkwin32.h10
-rw-r--r--gdk/win32/gdkwin32id.c65
-rw-r--r--gdk/win32/gdkwindow-win32.c1183
-rw-r--r--gdk/win32/gdkwindow-win32.h12
-rw-r--r--gdk/win32/makefile.mingw.in3
-rwxr-xr-xgtk/gtk.def17
-rw-r--r--gtk/gtkrc.c18
-rw-r--r--gtk/gtkrc.h5
37 files changed, 2529 insertions, 2802 deletions
diff --git a/ChangeLog b/ChangeLog
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index f914cf3f6..a53804ab4 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,30 @@
+2000-07-25 Tor Lillqvist <tml@iki.fi>
+
+ * Makefile.am: Include the build directory.
+
+ * configure.in: Generate build/Makefile and build/win32/Makefile.
+
+ * config.h.win32: Add USE_GMODULE and USE_MMX for gdk-pixbuf.
+
+ * gdk/gdk.def
+ * gtk/gtk.def: Updates.
+
+ * gdk/makefile.mingw.in: Define GDK_COMPILATION. Link with
+ PANGOWIN32_LIBS and gdk_pixbuf.
+
+ * gdk/win32: Compiles, but no doubt doesn't work at all.
+
+ * gdk/win32/makefile.mingw.in: Define GDK_COMPILATION.
+
+ * gdk/win32/gdkinput.c: New file, temporarily.
+
+ * gdk/win32/gdkinput-win32.h: New file
+
+ * gdk/win32/gdkinputprivate.h: Remove.
+
+ * gtk/gtkrc.[ch] (gtk_win32_get_installation_directory): Renamed and
+ made externally visible.
+
2000-07-24 Elliot Lee <sopwith@redhat.com>
* gdk/gdkprivate.h: Remove gdk_*_lookup() defines, since they are defined by the
individual backends already.
@@ -33,12 +60,13 @@
* gdk/win32/gdkcolor-win32.c
* gdk/win32/gdkcursor-win32.c
+ * gdk/win32/gdkdrawable-win32.c
* gdk/win32/gdkgc-win32.c
* gdk/win32/gdkimage-win32.c
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Update data structures. Cosmetics:
- don't use fields and variables called xcursor, xid, etc (leftovers
- from the X11 backend).
+ Rename fields and variables called xcursor, xid, etc (these names
+ were leftovers from the X11 backend) to hcursor, hwnd, hbitmap etc.
Sat Jul 22 17:41:26 2000 Owen Taylor <otaylor@redhat.com>
diff --git a/Makefile.am b/Makefile.am
index d5ae251f4..812c5b0f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am for GTK+
SRC_SUBDIRS = gdk-pixbuf gdk modules gtk demos
-SUBDIRS = po $(SRC_SUBDIRS) docs
+SUBDIRS = po $(SRC_SUBDIRS) docs build
bin_SCRIPTS = gtk-config-2.0
diff --git a/config.h.win32 b/config.h.win32
index 486dbb616..2c7a0a230 100755
--- a/config.h.win32
+++ b/config.h.win32
@@ -190,3 +190,8 @@
* (available in the Platform SDK)
*/
/* #define HAVE_DIMM_H 1 */
+
+#define USE_GMODULE 1
+#define USE_MMX 1
+
+/* #undef HAVE_SIGSETJMP */
diff --git a/configure.in b/configure.in
index b8541f737..0b6df0acb 100644
--- a/configure.in
+++ b/configure.in
@@ -993,6 +993,8 @@ docs/gtk-config.1
Makefile
gtk-config-2.0
po/Makefile.in
+build/Makefile
+build/win32/Makefile
demos/Makefile
docs/Makefile
docs/reference/Makefile
diff --git a/gdk/gdk.def b/gdk/gdk.def
index da3f80315..832da2883 100644
--- a/gdk/gdk.def
+++ b/gdk/gdk.def
@@ -46,6 +46,11 @@ EXPORTS
gdk_cursor_new_from_pixmap
gdk_cursor_ref
gdk_cursor_unref
+ gdk_device_set_axis_use
+ gdk_device_set_key
+ gdk_device_set_mode
+ gdk_device_set_source
+ gdk_devices_list
gdk_dnd_init
gdk_drag_abort
gdk_drag_begin
@@ -70,13 +75,13 @@ EXPORTS
gdk_draw_polygon
gdk_draw_rectangle
gdk_draw_rgb_32_image
+ gdk_draw_rgb_32_image_dithalign
gdk_draw_rgb_image
gdk_draw_rgb_image_dithalign
gdk_draw_segments
gdk_draw_string
gdk_draw_text
gdk_draw_text_wc
- gdk_drawable_alloc
gdk_drawable_get_colormap
gdk_drawable_get_size
gdk_drawable_get_type
@@ -124,7 +129,6 @@ EXPORTS
gdk_fontset_load
gdk_free_compound_text
gdk_free_text_list
- gdk_gc_alloc
gdk_gc_copy
gdk_gc_get_values
gdk_gc_new
@@ -163,7 +167,6 @@ EXPORTS
gdk_im_end
gdk_im_ready
gdk_im_set_best_style
- gdk_image_bitmap_new
gdk_image_get
gdk_image_get_pixel
gdk_image_new
@@ -177,15 +180,9 @@ EXPORTS
gdk_input_add_full
gdk_input_exit
gdk_input_init
- gdk_input_list_devices
gdk_input_motion_events
gdk_input_remove
- gdk_input_set_axes
gdk_input_set_extension_events
- gdk_input_set_key
- gdk_input_set_mode
- gdk_input_set_source
- gdk_input_window_get_pointer
gdk_key_repeat_disable
gdk_key_repeat_restore
gdk_keyboard_grab
@@ -205,7 +202,6 @@ EXPORTS
gdk_pixmap_create_from_data
gdk_pixmap_create_from_xpm
gdk_pixmap_create_from_xpm_d
- gdk_pixmap_create_on_shared_image
gdk_pixmap_foreign_new
gdk_pixmap_new
gdk_pointer_grab
@@ -236,10 +232,11 @@ EXPORTS
gdk_region_xor
gdk_rgb_cmap_free
gdk_rgb_cmap_new
+ gdk_rgb_colormap_ditherable
gdk_rgb_ditherable
gdk_rgb_gc_set_background
gdk_rgb_gc_set_foreground
- gdk_rgb_get_cmap
+ gdk_rgb_get_colormap
gdk_rgb_get_visual
gdk_rgb_init
gdk_rgb_set_install
@@ -285,6 +282,7 @@ EXPORTS
gdk_visual_ref
gdk_visual_unref
gdk_wcstombs
+ gdk_win32_handle_table_lookup
gdk_win32_hdc_get
gdk_win32_hdc_release
gdk_window_add_filter
@@ -345,5 +343,3 @@ EXPORTS
gdk_window_shape_combine_mask
gdk_window_show
gdk_window_withdraw
- gdk_xid_table_insert
- gdk_xid_table_lookup
diff --git a/gdk/makefile.mingw.in b/gdk/makefile.mingw.in
index 8c35a8eef..b089d0912 100644
--- a/gdk/makefile.mingw.in
+++ b/gdk/makefile.mingw.in
@@ -15,7 +15,7 @@ OPTIMIZE = -g
INCLUDES = -I . -I .. -I ../gdk-pixbuf
DEPCFLAGS = $(GLIB_CFLAGS) $(PANGO_CFLAGS)
-DEFINES = -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\"
+DEFINES = -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DGDK_COMPILATION
all: \
../config.h \
@@ -58,7 +58,7 @@ win32/gdk-win32res.o : FRC
cd win32 && $(MAKE) -f makefile.mingw gdk-win32res.o
gdk-win32-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a win32/gdk-win32res.o win32/libwntab32x.a
- $(GLIB)/build-dll gdk-win32 $(GTK_VER) gdk.def $(gdk_OBJECTS) win32/gdk-win32.a win32/wntab32x.a $(GLIB_LIBS) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
+ $(GLIB)/build-dll gdk-win32 $(GTK_VER) gdk.def $(gdk_OBJECTS) win32/libgdk-win32.a win32/libwntab32x.a -L ../gdk-pixbuf -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS) $(PANGOWIN32_LIBS) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
win32/libwntab32x.a : FRC
cd win32 && $(MAKE) -f makefile.mingw libwntab32x.a
diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c
index 21c07bd9e..2c168bf54 100644
--- a/gdk/win32/gdkcolor-win32.c
+++ b/gdk/win32/gdkcolor-win32.c
@@ -34,8 +34,6 @@
#include "gdkcolor.h"
#include "gdkprivate-win32.h"
-#define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data)
-
static void free_colormap (Colormap colormap);
static gint gdk_colormap_match_color (GdkColormap *cmap,
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index 285fc0e2d..fc82e53eb 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -1113,7 +1113,7 @@ gdk_drag_find_window (GdkDragContext *context,
POINT pt;
GDK_NOTE (DND, g_print ("gdk_drag_find_window: %#x +%d+%d\n",
- (drag_window ? GDK_DRAWABLE_XID (drag_window) : 0),
+ (drag_window ? GDK_WINDOW_HWND (drag_window) : 0),
x_root, y_root));
pt.x = x_root;
@@ -1123,7 +1123,7 @@ gdk_drag_find_window (GdkDragContext *context,
*dest_window = NULL;
else
{
- *dest_window = gdk_window_lookup (recipient);
+ *dest_window = gdk_win32_handle_table_lookup (recipient);
if (*dest_window)
gdk_drawable_ref (*dest_window);
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
@@ -1225,7 +1225,7 @@ gdk_window_register_dnd (GdkWindow *window)
g_return_if_fail (window != NULL);
GDK_NOTE (DND, g_print ("gdk_window_register_dnd: %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
/* We always claim to accept dropped files, but in fact we might not,
* of course. This function is called in such a way that it cannot know
@@ -1244,7 +1244,7 @@ gdk_window_register_dnd (GdkWindow *window)
OTHER_API_FAILED ("CoLockObjectExternal");
else
{
- hres = RegisterDragDrop (GDK_DRAWABLE_XID (window), &ctx->idt);
+ hres = RegisterDragDrop (GDK_WINDOW_HWND (window), &ctx->idt);
if (hres == DRAGDROP_E_ALREADYREGISTERED)
{
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 8a7466d41..5c5e586bd 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -229,7 +229,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
(filled ? "fill " : ""),
width, height, x, y));
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
#if 0
{
@@ -307,7 +307,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
SelectObject (hdc, oldbrush);
}
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -336,7 +336,7 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
if (width <= 2 || height <= 2 || angle2 == 0)
return;
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
if (angle2 >= 360*64)
{
@@ -380,7 +380,7 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
nXStartArc, nYStartArc, nXEndArc, nYEndArc))
WIN32_GDI_FAILED ("Arc");
}
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -405,7 +405,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
if (npoints < 2)
return;
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
pts = g_new (POINT, npoints+1);
for (i = 0; i < npoints; i++)
@@ -467,7 +467,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
}
}
g_free (pts);
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
typedef struct
@@ -525,7 +525,7 @@ gdk_win32_draw_text (GdkDrawable *drawable,
arg.x = x;
arg.y = y;
- arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %#x (%d,%d) \"%.*s\" (len %d)\n",
GDK_DRAWABLE_HANDLE (drawable),
@@ -550,7 +550,7 @@ gdk_win32_draw_text (GdkDrawable *drawable,
}
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -575,7 +575,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
arg.x = x;
arg.y = y;
- arg.hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %#x (%d,%d) len: %d\n",
GDK_DRAWABLE_HANDLE (drawable),
@@ -596,7 +596,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
if (sizeof (wchar_t) != sizeof (GdkWChar))
g_free (wcstr);
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -626,13 +626,13 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
GDK_PIXMAP_HBITMAP (src),
width, height, xsrc, ysrc));
- hdc = gdk_gc_predraw (drawable, gc_private, 0);
+ hdc = gdk_win32_hdc_get (drawable, gc, 0);
gdk_drawable_get_size (src, &src_width, &src_height);
src_rgn = CreateRectRgn (0, 0, src_width + 1, src_height + 1);
draw_rgn = CreateRectRgn (xsrc, ysrc, xsrc + width + 1, ysrc + height + 1);
- if (!GDK_IS_PIXMAP (drawable))
+ if (GDK_IS_WINDOW (drawable))
{
/* If we are drawing on a window, calculate the region that is
* outside the source pixmap, and invalidate that, causing it to
@@ -738,7 +738,7 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
WIN32_GDI_FAILED ("BitBlt");
ReleaseDC (GDK_WINDOW_HWND (src), srcdc);
}
- gdk_gc_postdraw (drawable, gc_private, 0);
+ gdk_win32_hdc_release (drawable, gc, 0);
}
static void
@@ -751,21 +751,19 @@ gdk_win32_draw_points (GdkDrawable *drawable,
COLORREF fg;
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
- GdkColormapPrivateWin32 *colormap_private =
- (GdkColormapPrivateWin32 *) impl->colormap;
int i;
- hdc = gdk_gc_predraw (drawable, gc_private, 0);
+ hdc = gdk_win32_hdc_get (drawable, gc, 0);
- fg = gdk_colormap_color (colormap_private, gc_private->foreground);
+ fg = gdk_colormap_color (impl->colormap, gc_private->foreground);
GDK_NOTE (MISC, g_print ("gdk_draw_points: %#x %dx%.06x\n",
- GDK_DRAWABLE_XID (drawable), npoints, fg));
+ GDK_DRAWABLE_HANDLE (drawable), npoints, fg));
for (i = 0; i < npoints; i++)
SetPixel (hdc, points[i].x, points[i].y, fg);
- gdk_gc_postdraw (drawable, gc_private, 0);
+ gdk_win32_hdc_release (drawable, gc, 0);
}
static void
@@ -784,7 +782,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %#x nsegs: %d\n",
GDK_DRAWABLE_HANDLE (drawable), nsegs));
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
{
@@ -832,7 +830,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
}
}
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -851,7 +849,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
if (npoints < 2)
return;
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
pts = g_new (POINT, npoints);
@@ -873,7 +871,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
WIN32_GDI_FAILED ("LineTo");
}
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -889,11 +887,11 @@ gdk_win32_draw_glyphs (GdkDrawable *drawable,
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
HDC hdc;
- hdc = gdk_gc_predraw (drawable, gc_private, mask);
+ hdc = gdk_win32_hdc_get (drawable, gc, mask);
pango_win32_render (hdc, font, glyphs, x, y);
- gdk_gc_postdraw (drawable, gc_private, mask);
+ gdk_win32_hdc_release (drawable, gc, mask);
}
static void
@@ -922,7 +920,7 @@ gdk_win32_draw_image (GdkDrawable *drawable,
gboolean ok = TRUE;
int i;
- hdc = gdk_gc_predraw (drawable, gc_private, 0);
+ hdc = gdk_win32_hdc_get (drawable, gc, 0);
if (colormap_private && colormap_private->xcolormap->rc_palette)
{
@@ -978,7 +976,7 @@ gdk_win32_draw_image (GdkDrawable *drawable,
if (memdc != NULL && !DeleteDC (memdc))
WIN32_GDI_FAILED ("DeleteDC");
}
- gdk_gc_postdraw (drawable, gc_private, 0);
+ gdk_win32_hdc_release (drawable, gc, 0);
}
static gint
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 7a8a6e449..6ab1bb274 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -38,16 +38,7 @@
#include <stdio.h>
-#include "gdk.h"
-#include "gdkinternals.h"
#include "gdkprivate-win32.h"
-#include "gdkdrawable-win32.h"
-#include "gdkwindow-win32.h"
-#include "gdkpixmap-win32.h"
-
-#include "gdkkeysyms.h"
-
-#include "gdkinputprivate.h"
#include <objbase.h>
#include <imm.h>
@@ -58,9 +49,14 @@
#include "surrogate-dimm.h"
#endif
-#ifdef HAVE_WINTAB
-#include <wintab.h>
-#endif
+#include "gdk.h"
+#include "gdkinternals.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
+#include "gdkpixmap-win32.h"
+#include "gdkinput-win32.h"
+
+#include "gdkkeysyms.h"
#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
@@ -330,7 +326,7 @@ gdk_events_init (void)
if (track_mouse_event != NULL)
GDK_NOTE (EVENTS, g_print ("Using TrackMouseEvent to detect leave events\n"));
#endif
- if (IS_WIN_NT (windows_version) && (windows_version & 0xFF) == 5)
+ if (IS_WIN_NT () && (windows_version & 0xFF) == 5)
{
/* On Win2k (Beta 3, at least) WM_IME_CHAR doesn't seem to work
* correctly for non-Unicode applications. Handle
@@ -488,7 +484,7 @@ gdk_pointer_grab (GdkWindow *window,
cursor_private = (GdkCursorPrivate*) cursor;
- if (!confine_to || GDK_DRAWABLE_DESTROYED (confine_to))
+ if (!confine_to || GDK_WINDOW_DESTROYED (confine_to))
hwnd_confined_to = NULL;
else
hwnd_confined_to = GDK_WINDOW_HWND (confine_to);
@@ -498,35 +494,32 @@ gdk_pointer_grab (GdkWindow *window,
else
hcursor = cursor_private->hcursor;
- if (gdk_input_vtable.grab_pointer)
- return_val = gdk_input_vtable.grab_pointer (window,
- owner_events,
- event_mask,
- confine_to,
- time);
- else
- return_val = GDK_GRAB_SUCCESS;
-
+ return_val = _gdk_input_grab_pointer (window,
+ owner_events,
+ event_mask,
+ confine_to,
+ time);
+
if (return_val == GDK_GRAB_SUCCESS)
{
- if (!GDK_DRAWABLE_DESTROYED (window))
- {
- GDK_NOTE (EVENTS, g_print ("gdk_pointer_grab: %#x %s %#x %s\n",
- GDK_WINDOW_HWND (window),
- (owner_events ? "TRUE" : "FALSE"),
- hcursor,
- event_mask_string (event_mask)));
- p_grab_mask = event_mask;
- p_grab_owner_events = (owner_events != 0);
- p_grab_automatic = FALSE;
-
+ if (!GDK_WINDOW_DESTROYED (window))
+ {
+ GDK_NOTE (EVENTS, g_print ("gdk_pointer_grab: %#x %s %#x %s\n",
+ GDK_WINDOW_HWND (window),
+ (owner_events ? "TRUE" : "FALSE"),
+ hcursor,
+ event_mask_string (event_mask)));
+ p_grab_mask = event_mask;
+ p_grab_owner_events = (owner_events != 0);
+ p_grab_automatic = FALSE;
+
#if 1 /* Menus don't work if we use mouse capture. Pity, because many other
* things work better with mouse capture.
*/
- SetCapture (GDK_WINDOW_HWND (window));
+ SetCapture (GDK_WINDOW_HWND (window));
#endif
- return_val = GDK_GRAB_SUCCESS;
- }
+ return_val = GDK_GRAB_SUCCESS;
+ }
else
return_val = GDK_GRAB_ALREADY_GRABBED;
}
@@ -558,13 +551,14 @@ gdk_pointer_grab (GdkWindow *window,
void
gdk_pointer_ungrab (guint32 time)
{
- if (gdk_input_vtable.ungrab_pointer)
- gdk_input_vtable.ungrab_pointer (time);
+ GDK_NOTE (EVENTS, g_print ("gdk_pointer_ungrab\n"));
+
+ _gdk_input_ungrab_pointer (time);
+
#if 1
if (GetCapture () != NULL)
ReleaseCapture ();
#endif
- GDK_NOTE (EVENTS, g_print ("gdk_pointer_ungrab\n"));
p_grab_window = NULL;
}
@@ -623,7 +617,7 @@ gdk_keyboard_grab (GdkWindow *window,
GDK_NOTE (EVENTS, g_print ("gdk_keyboard_grab %#x\n",
GDK_WINDOW_HWND (window)));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
k_grab_owner_events = owner_events != 0;
return_val = GDK_GRAB_SUCCESS;
@@ -1151,10 +1145,8 @@ synthesize_crossing_events (GdkWindow *window,
GDK_NOTE (EVENTS, print_event (event));
- if (GDK_WINDOW_OBJECT (window)->extension_events != 0
- && gdk_input_vtable.enter_event)
- gdk_input_vtable.enter_event (&event->crossing, window);
-
+ if (GDK_WINDOW_OBJECT (window)->extension_events != 0)
+ _gdk_input_enter_event (&event->crossing, window);
}
if (current_window)
@@ -1366,13 +1358,25 @@ gdk_event_translate (GdkEvent *event,
MINMAXINFO *mmi;
HWND hwnd;
HCURSOR hcursor;
- GdkWindow *window, *orig_window, *newwindow;
+
+ /* Invariant:
+ * window_impl == GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)
+ */
+ GdkWindow *window;
+ GdkWindowImplWin32 *window_impl;
+#define ASSIGN_WINDOW(rhs) \
+ (window = rhs, \
+ window_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl))
+
+ GdkWindow *orig_window, *new_window;
GdkColormapPrivateWin32 *colormap_private;
GdkEventMask mask;
GdkPixmap *pixmap;
GdkPixmapImplWin32 *pixmap_impl;
+
int button;
int i, j, n, k;
+
gchar buf[256];
gchar *msgname;
gboolean return_val;
@@ -1383,7 +1387,7 @@ gdk_event_translate (GdkEvent *event,
if (ret_val_flagp)
*ret_val_flagp = FALSE;
- window = gdk_window_lookup (msg->hwnd);
+ ASSIGN_WINDOW (gdk_win32_handle_table_lookup (msg->hwnd));
orig_window = window;
event->any.window = window;
@@ -1419,7 +1423,7 @@ gdk_event_translate (GdkEvent *event,
return FALSE;
}
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
/* Check for filters for this window */
GdkFilterReturn result;
@@ -1446,7 +1450,7 @@ gdk_event_translate (GdkEvent *event,
event->selection.property = gdk_selection_property;
event->selection.time = msg->time;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
/* Will pass through switch below without match */
}
@@ -1463,7 +1467,7 @@ gdk_event_translate (GdkEvent *event,
event->selection.requestor = (guint32) msg->hwnd;
event->selection.time = msg->time;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
/* Again, will pass through switch below without match */
}
@@ -1477,7 +1481,7 @@ gdk_event_translate (GdkEvent *event,
event->selection.selection = msg->wParam;
event->selection.time = msg->time;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
/* Once again, we will pass through switch below without match */
}
@@ -1527,9 +1531,9 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS,
g_print ("WM_INPUTLANGCHANGE: %#x charset %d locale %x\n",
msg->hwnd, msg->wParam, msg->lParam));
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->input_locale = (HKL) msg->lParam;
+ window_impl->input_locale = (HKL) msg->lParam;
TranslateCharsetInfo ((DWORD FAR *) msg->wParam,
- &GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->charset_info,
+ &window_impl->charset_info,
TCI_SRCCHARSET);
break;
@@ -1788,6 +1792,7 @@ gdk_event_translate (GdkEvent *event,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_key))
break;
+ ASSIGN_WINDOW (window);
is_altgr_key = FALSE;
event->key.type = ((msg->message == WM_KEYDOWN
@@ -1805,7 +1810,7 @@ gdk_event_translate (GdkEvent *event,
event->key.state |= GDK_MOD1_MASK;
event->key.string = NULL;
event->key.length = 0;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
case WM_IME_COMPOSITION:
@@ -1844,33 +1849,36 @@ gdk_event_translate (GdkEvent *event,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_char))
break;
+ ASSIGN_WINDOW (window);
+
event->key.window = window;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
+
if (return_val && (event->key.window == k_grab_window
- || (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_KEY_RELEASE_MASK)))
+ || (window_impl->event_mask & GDK_KEY_RELEASE_MASK)))
{
if (window == k_grab_window
- || (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_KEY_PRESS_MASK))
+ || (window_impl->event_mask & GDK_KEY_PRESS_MASK))
{
/* Append a GDK_KEY_PRESS event to the pushback list
* (from which it will be fetched before the release
* event).
*/
GdkEvent *event2 = gdk_event_new ();
- build_keypress_event (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl), event2, msg);
+ build_keypress_event (window_impl, event2, msg);
event2->key.window = window;
gdk_drawable_ref (window);
gdk_event_queue_append (event2);
GDK_NOTE (EVENTS, print_event (event2));
}
/* Return the key release event. */
- build_keyrelease_event (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl), event, msg);
+ build_keyrelease_event (window_impl, event, msg);
}
else if (return_val
- && (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_KEY_PRESS_MASK))
+ && (window_impl->event_mask & GDK_KEY_PRESS_MASK))
{
/* Return just the key press event. */
- build_keypress_event (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl), event, msg);
+ build_keypress_event (window_impl, event, msg);
}
else
return_val = FALSE;
@@ -1914,19 +1922,21 @@ gdk_event_translate (GdkEvent *event,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_press))
break;
+ ASSIGN_WINDOW (window);
+
event->button.window = window;
+
/* Emulate X11's automatic active grab */
if (!p_grab_window)
{
/* No explicit active grab, let's start one automatically */
- gint owner_events =
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask
+ gint owner_events = window_impl->event_mask
& (GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);
GDK_NOTE (EVENTS, g_print ("...automatic grab started\n"));
gdk_pointer_grab (window,
owner_events,
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask,
+ window_impl->event_mask,
NULL, NULL, 0);
p_grab_automatic = TRUE;
}
@@ -1945,7 +1955,7 @@ gdk_event_translate (GdkEvent *event,
gdk_event_button_generate (event);
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
case WM_LBUTTONUP:
@@ -1979,6 +1989,8 @@ gdk_event_translate (GdkEvent *event,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_release))
goto maybe_ungrab;
+ ASSIGN_WINDOW (window);
+
event->button.window = window;
event->button.time = msg->time;
if (window != orig_window)
@@ -1992,7 +2004,7 @@ gdk_event_translate (GdkEvent *event,
event->button.button = button;
event->button.device = gdk_core_pointer;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
maybe_ungrab:
if (p_grab_window != NULL
@@ -2037,6 +2049,8 @@ gdk_event_translate (GdkEvent *event,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_motion))
break;
+ ASSIGN_WINDOW (window);
+
event->motion.window = window;
event->motion.time = msg->time;
if (window != orig_window)
@@ -2050,7 +2064,7 @@ gdk_event_translate (GdkEvent *event,
event->motion.is_hint = FALSE;
event->motion.device = gdk_core_pointer;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
case WM_NCMOUSEMOVE:
@@ -2110,12 +2124,12 @@ gdk_event_translate (GdkEvent *event,
if ((hwnd = WindowFromPoint (pt)) == NULL)
break;
msg->hwnd = hwnd;
- if ((newwindow = gdk_window_lookup (msg->hwnd)) == NULL)
+ if ((new_window = gdk_win32_handle_table_lookup (msg->hwnd)) == NULL)
break;
- if (newwindow != window)
+ if (new_window != window)
{
gdk_drawable_unref (window);
- window = newwindow;
+ ASSIGN_WINDOW (new_window);
gdk_drawable_ref (window);
}
ScreenToClient (msg->hwnd, &pt);
@@ -2123,6 +2137,8 @@ gdk_event_translate (GdkEvent *event,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_scroll))
break;
+ ASSIGN_WINDOW (window);
+
event->button.window = window;
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
@@ -2134,7 +2150,7 @@ gdk_event_translate (GdkEvent *event,
event->scroll.y_root = (gint16) LOWORD (msg->lParam);
event->scroll.state = build_pointer_event_state (msg);
event->scroll.device = gdk_core_pointer;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
@@ -2142,7 +2158,7 @@ gdk_event_translate (GdkEvent *event,
case WM_MOUSELEAVE:
GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %#x\n", msg->hwnd));
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_LEAVE_NOTIFY_MASK))
+ if (!(window_impl->event_mask & GDK_LEAVE_NOTIFY_MASK))
break;
event->crossing.type = GDK_LEAVE_NOTIFY;
@@ -2172,7 +2188,7 @@ gdk_event_translate (GdkEvent *event,
current_window = NULL;
}
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
#endif
@@ -2183,20 +2199,20 @@ gdk_event_translate (GdkEvent *event,
"SET" : "KILL"),
msg->hwnd));
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_FOCUS_CHANGE_MASK))
+ if (!(window_impl->event_mask & GDK_FOCUS_CHANGE_MASK))
break;
event->focus_change.type = GDK_FOCUS_CHANGE;
event->focus_change.window = window;
event->focus_change.in = (msg->message == WM_SETFOCUS);
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
case WM_ERASEBKGND:
GDK_NOTE (EVENTS, g_print ("WM_ERASEBKGND: %#x dc %#x\n",
msg->hwnd, msg->wParam));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
break;
colormap_private = (GdkColormapPrivateWin32 *) GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap;
@@ -2218,27 +2234,27 @@ gdk_event_translate (GdkEvent *event,
*ret_val_flagp = TRUE;
*ret_valp = 1;
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_type == GDK_WIN32_BG_TRANSPARENT)
+ if (GDK_WINDOW_OBJECT (window)->input_only)
break;
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_type == GDK_WIN32_BG_PARENT_RELATIVE)
+ if (GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
{
/* If this window should have the same background as the
* parent, fetch the parent. (And if the same goes for
* the parent, fetch the grandparent, etc.)
*/
- while (window && GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_type == GDK_WIN32_BG_PARENT_RELATIVE)
+ while (window && GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
{
gdk_drawable_unref (window);
- window = GDK_WINDOW (GDK_WINDOW_OBJECT (window)->parent);
+ ASSIGN_WINDOW (GDK_WINDOW (GDK_WINDOW_OBJECT (window)->parent));
gdk_drawable_ref (window);
}
}
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_type == GDK_WIN32_BG_PIXEL)
+ if (GDK_WINDOW_OBJECT (window)->bg_pixmap == NULL)
{
- bg = gdk_colormap_color (colormap_private,
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_pixel);
+ bg = gdk_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap,
+ GDK_WINDOW_OBJECT (window)->bg_color.pixel);
GetClipBox (hdc, &rect);
GDK_NOTE (EVENTS,
@@ -2255,9 +2271,10 @@ gdk_event_translate (GdkEvent *event,
WIN32_GDI_FAILED ("FillRect");
DeleteObject (hbr);
}
- else if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_type == GDK_WIN32_BG_PIXMAP)
+ else if (GDK_WINDOW_OBJECT (window)->bg_pixmap != NULL &&
+ GDK_WINDOW_OBJECT (window)->bg_pixmap != GDK_NO_BG)
{
- pixmap = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->bg_pixmap;
+ pixmap = GDK_WINDOW_OBJECT (window)->bg_pixmap;
pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (pixmap);
GetClipBox (hdc, &rect);
@@ -2348,7 +2365,7 @@ gdk_event_translate (GdkEvent *event,
EndPaint (msg->hwnd, &paintstruct);
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_EXPOSURE_MASK))
+ if (!(window_impl->event_mask & GDK_EXPOSURE_MASK))
break;
if ((paintstruct.rcPaint.right == paintstruct.rcPaint.left)
@@ -2363,7 +2380,7 @@ gdk_event_translate (GdkEvent *event,
event->expose.area.height = paintstruct.rcPaint.bottom - paintstruct.rcPaint.top;
event->expose.count = 0;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val)
{
GList *list = gdk_queued_events;
@@ -2389,8 +2406,8 @@ gdk_event_translate (GdkEvent *event,
if (p_grab_window != NULL && p_grab_cursor != NULL)
hcursor = p_grab_cursor;
- else if (!GDK_DRAWABLE_DESTROYED (window))
- hcursor = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hcursor;
+ else if (!GDK_WINDOW_DESTROYED (window))
+ hcursor = window_impl->hcursor;
else
hcursor = NULL;
@@ -2408,7 +2425,7 @@ gdk_event_translate (GdkEvent *event,
msg->hwnd,
msg->wParam));
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_STRUCTURE_MASK))
+ if (!(window_impl->event_mask & GDK_STRUCTURE_MASK))
break;
event->any.type = (msg->wParam ? GDK_MAP : GDK_UNMAP);
@@ -2422,7 +2439,7 @@ gdk_event_translate (GdkEvent *event,
&& k_grab_window == window)
gdk_keyboard_ungrab (msg->time);
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
case WM_SIZE:
@@ -2436,7 +2453,7 @@ gdk_event_translate (GdkEvent *event,
(msg->wParam == SIZE_RESTORED ? "RESTORED" : "?"))))),
LOWORD (msg->lParam), HIWORD (msg->lParam)));
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_STRUCTURE_MASK))
+ if (!(window_impl->event_mask & GDK_STRUCTURE_MASK))
break;
if (msg->wParam == SIZE_MINIMIZED)
@@ -2450,12 +2467,12 @@ gdk_event_translate (GdkEvent *event,
if (k_grab_window == window)
gdk_keyboard_ungrab (msg->time);
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
}
else if ((msg->wParam == SIZE_RESTORED
|| msg->wParam == SIZE_MAXIMIZED)
#if 1
- && GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_CHILD
+ && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD
#endif
)
{
@@ -2473,17 +2490,16 @@ gdk_event_translate (GdkEvent *event,
event->configure.height = HIWORD (msg->lParam);
GDK_WINDOW_OBJECT (window)->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y;
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->width = event->configure.width;
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->height = event->configure.height;
+ window_impl->width = event->configure.width;
+ window_impl->height = event->configure.height;
if (GDK_WINDOW_OBJECT (window)->resize_count > 1)
GDK_WINDOW_OBJECT (window)->resize_count -= 1;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val
- && GDK_WINDOW_OBJECT (window)->extension_events != 0
- && gdk_input_vtable.configure_event)
- gdk_input_vtable.configure_event (&event->configure, window);
+ && GDK_WINDOW_OBJECT (window)->extension_events != 0)
+ _gdk_input_configure_event (&event->configure, window);
}
break;
@@ -2491,18 +2507,18 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %#x\n", msg->hwnd));
mmi = (MINMAXINFO*) msg->lParam;
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_flags & GDK_HINT_MIN_SIZE)
+ if (window_impl->hint_flags & GDK_HINT_MIN_SIZE)
{
- mmi->ptMinTrackSize.x = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_min_width;
- mmi->ptMinTrackSize.y = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_min_height;
+ mmi->ptMinTrackSize.x = window_impl->hint_min_width;
+ mmi->ptMinTrackSize.y = window_impl->hint_min_height;
}
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_flags & GDK_HINT_MAX_SIZE)
+ if (window_impl->hint_flags & GDK_HINT_MAX_SIZE)
{
- mmi->ptMaxTrackSize.x = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_max_width;
- mmi->ptMaxTrackSize.y = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_max_height;
+ mmi->ptMaxTrackSize.x = window_impl->hint_max_width;
+ mmi->ptMaxTrackSize.y = window_impl->hint_max_height;
- mmi->ptMaxSize.x = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_max_width;
- mmi->ptMaxSize.y = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->hint_max_height;
+ mmi->ptMaxSize.x = window_impl->hint_max_width;
+ mmi->ptMaxSize.y = window_impl->hint_max_height;
}
break;
@@ -2511,10 +2527,10 @@ gdk_event_translate (GdkEvent *event,
msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
- if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_STRUCTURE_MASK))
+ if (!(window_impl->event_mask & GDK_STRUCTURE_MASK))
break;
- if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_CHILD
+ if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD
&& !IsIconic(msg->hwnd)
&& IsWindowVisible(msg->hwnd))
{
@@ -2527,10 +2543,10 @@ gdk_event_translate (GdkEvent *event,
event->configure.height = rect.bottom;
GDK_WINDOW_OBJECT (window)->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y;
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->width = event->configure.width;
- GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->height = event->configure.height;
+ window_impl->width = event->configure.width;
+ window_impl->height = event->configure.height;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
}
break;
@@ -2540,7 +2556,7 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DELETE;
event->any.window = window;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
break;
#if 0
@@ -2582,7 +2598,7 @@ gdk_event_translate (GdkEvent *event,
event->selection.property = gdk_selection_property;
event->selection.requestor = (guint32) msg->hwnd;
event->selection.time = msg->time;
- return_val = !GDK_DRAWABLE_DESTROYED (window);
+ return_val = !GDK_WINDOW_DESTROYED (window);
#else
/* Test code, to see if SetClipboardData works when called from
* the window procedure.
@@ -2619,7 +2635,7 @@ gdk_event_translate (GdkEvent *event,
if (k_grab_window == window)
gdk_keyboard_ungrab (msg->time);
- return_val = window != NULL && !GDK_DRAWABLE_DESTROYED (window);
+ return_val = window != NULL && !GDK_WINDOW_DESTROYED (window);
if (window != NULL)
gdk_window_destroy_notify (window);
@@ -2651,7 +2667,7 @@ gdk_event_translate (GdkEvent *event,
/* Fall through */
wintab:
event->any.window = window;
- return_val = gdk_input_vtable.other_event(event, msg);
+ return_val = _gdk_input_other_event(event, msg, window);
break;
#endif
diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c
index 065d4ebb6..791f5f378 100644
--- a/gdk/win32/gdkgc-win32.c
+++ b/gdk/win32/gdkgc-win32.c
@@ -34,6 +34,9 @@
#include "gdkregion-generic.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
+#include "gdkpixmap-win32.h"
static void gdk_win32_gc_destroy (GdkGC *gc);
static void gdk_win32_gc_get_values (GdkGC *gc,
@@ -257,7 +260,7 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
gdk_drawable_ref (win32_gc->tile);
win32_gc->values_mask |= GDK_GC_TILE;
GDK_NOTE (MISC, (g_print ("%stile=%#x", s,
- GDK_DRAWABLE_XID (win32_gc->tile)),
+ GDK_PIXMAP_HBITMAP (win32_gc->tile)),
s = ","));
}
else
@@ -307,7 +310,7 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
gdk_drawable_ref (win32_gc->stipple);
win32_gc->values_mask |= GDK_GC_STIPPLE;
GDK_NOTE (MISC, (g_print ("%sstipple=%#x", s,
- GDK_DRAWABLE_XID (win32_gc->stipple)),
+ GDK_PIXMAP_HBITMAP (win32_gc->stipple)),
s = ","));
}
else
@@ -331,7 +334,7 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
if (values->clip_mask != NULL)
{
win32_gc->hcliprgn =
- BitmapToRegion ((HBITMAP) GDK_DRAWABLE_XID (values->clip_mask));
+ BitmapToRegion ((HBITMAP) GDK_PIXMAP_HBITMAP (values->clip_mask));
win32_gc->values_mask |= GDK_GC_CLIP_MASK;
OffsetRgn (win32_gc->hcliprgn,
win32_gc->parent_instance.clip_x_origin,
@@ -636,7 +639,7 @@ gdk_win32_gc_set_dashes (GdkGC *gc,
* More workarounds for Win9x descibed at:
* http://www.codeguru.com/gdi/dashed.shtml
*/
- if (!IS_WIN_NT (windows_version) && win32_gc->pen_width > 1)
+ if (!IS_WIN_NT () && win32_gc->pen_width > 1)
{
GDK_NOTE (MISC, g_print ("gdk_win32_gc_set_dashes: not fully supported\n"));
win32_gc->pen_style |= PS_SOLID;
@@ -755,8 +758,8 @@ void
gdk_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc)
{
- GdkGCWin32 *dst_data;
- GdkGCWin32 *src_data;
+ GdkGCWin32 *dst_win32_gc;
+ GdkGCWin32 *src_win32_gc;
DWORD nbytes;
LPRGNDATA rgn;
@@ -790,39 +793,45 @@ gdk_gc_copy (GdkGC *dst_gc,
static guint bitmask[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
COLORREF
-gdk_colormap_color (GdkColormapPrivateWin32 *colormap_private,
- gulong pixel)
+gdk_colormap_color (GdkColormap *colormap,
+ gulong pixel)
{
- GdkVisual *visual;
+ const GdkVisual *visual;
+ GdkColormapPrivateWin32 *colormap_private;
guchar r, g, b;
- if (colormap_private == NULL || colormap_private->xcolormap->rc_palette)
+ if (colormap == NULL)
return PALETTEINDEX (pixel);
- else
- {
- visual = colormap_private->base.visual;
- r = (pixel & visual->red_mask) >> visual->red_shift;
- r = (r * 255) / bitmask[visual->red_prec];
- g = (pixel & visual->green_mask) >> visual->green_shift;
- g = (g * 255) / bitmask[visual->green_prec];
- b = (pixel & visual->blue_mask) >> visual->blue_shift;
- b = (b * 255) / bitmask[visual->blue_prec];
-
- return RGB (r, g, b);
- }
+
+ colormap_private = GDK_COLORMAP_PRIVATE_DATA (colormap);
+
+ if (colormap_private->xcolormap->rc_palette)
+ return PALETTEINDEX (pixel);
+
+ visual = colormap->visual;
+ r = (pixel & visual->red_mask) >> visual->red_shift;
+ r = (r * 255) / bitmask[visual->red_prec];
+ g = (pixel & visual->green_mask) >> visual->green_shift;
+ g = (g * 255) / bitmask[visual->green_prec];
+ b = (pixel & visual->blue_mask) >> visual->blue_shift;
+ b = (b * 255) / bitmask[visual->blue_prec];
+
+ return RGB (r, g, b);
}
static void
-predraw_set_foreground (GdkGCWin32 *gc_win32,
- GdkColormapPrivateWin32 *colormap_private,
- gboolean *ok)
+predraw_set_foreground (GdkGC *gc,
+ GdkColormap *colormap,
+ gboolean *ok)
{
+ GdkGCWin32 *win32_gc = (GdkGCWin32 *) gc;
+ GdkColormapPrivateWin32 *colormap_private;
COLORREF fg;
LOGBRUSH logbrush;
HPEN hpen;
HBRUSH hbr;
- if (colormap_private == NULL)
+ if (colormap == NULL)
{
/* A 1 bit deep bitmap */
struct
@@ -853,25 +862,29 @@ predraw_set_foreground (GdkGCWin32 *gc_win32,
RealizePalette (win32_gc->hdc);
fg = PALETTEINDEX (win32_gc->foreground);
}
- else if (colormap_private->xcolormap->rc_palette)
+ else
{
- int k;
- if (SelectPalette (win32_gc->hdc, colormap_private->xcolormap->palette,
- FALSE) == NULL)
- WIN32_GDI_FAILED ("SelectPalette"), *ok = FALSE;
- if (TRUE || colormap_private->xcolormap->stale)
+ colormap_private = GDK_COLORMAP_PRIVATE_DATA (colormap);
+ if (colormap_private->xcolormap->rc_palette)
{
- if ((k = RealizePalette (win32_gc->hdc)) == GDI_ERROR)
- WIN32_GDI_FAILED ("RealizePalette"), *ok = FALSE;
- colormap_private->xcolormap->stale = FALSE;
- }
+ int k;
+ if (SelectPalette (win32_gc->hdc, colormap_private->xcolormap->palette,
+ FALSE) == NULL)
+ WIN32_GDI_FAILED ("SelectPalette"), *ok = FALSE;
+ if (TRUE || colormap_private->xcolormap->stale)
+ {
+ if ((k = RealizePalette (win32_gc->hdc)) == GDI_ERROR)
+ WIN32_GDI_FAILED ("RealizePalette"), *ok = FALSE;
+ colormap_private->xcolormap->stale = FALSE;
+ }
#if 0
- g_print ("Selected palette %#x for gc %#x, realized %d colors\n",
- colormap_private->xcolormap->palette, win32_gc->hdc, k);
+ g_print ("Selected palette %#x for gc %#x, realized %d colors\n",
+ colormap_private->xcolormap->palette, win32_gc->hdc, k);
#endif
+ }
}
- fg = gdk_colormap_color (colormap_private, win32_gc->foreground);
+ fg = gdk_colormap_color (colormap, win32_gc->foreground);
if (SetTextColor (win32_gc->hdc, fg) == CLR_INVALID)
WIN32_GDI_FAILED ("SetTextColor"), *ok = FALSE;
@@ -892,11 +905,11 @@ predraw_set_foreground (GdkGCWin32 *gc_win32,
switch (win32_gc->fill_style)
{
case GDK_OPAQUE_STIPPLED:
- if (*ok && (hbr = CreatePatternBrush (GDK_DRAWABLE_XID (win32_gc->stipple))) == NULL)
+ if (*ok && (hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (win32_gc->stipple))) == NULL)
WIN32_GDI_FAILED ("CreatePatternBrush"), *ok = FALSE;
- if (*ok && !SetBrushOrgEx(win32_gc->hdc, gc_private->ts_x_origin,
- gc_private->ts_y_origin, NULL))
+ if (*ok && !SetBrushOrgEx(win32_gc->hdc, gc->ts_x_origin,
+ gc->ts_y_origin, NULL))
WIN32_GDI_FAILED ("SetBrushOrgEx"), *ok = FALSE;
break;
@@ -911,21 +924,23 @@ predraw_set_foreground (GdkGCWin32 *gc_win32,
}
void
-predraw_set_background (GdkGCWin32 *win32_gc,
- GdkColormapPrivateWin32 *colormap_private,
- gboolean *ok)
+predraw_set_background (GdkGC *gc,
+ GdkColormap *colormap,
+ gboolean *ok)
{
- COLORREF bg = gdk_colormap_color (colormap_private, win32_gc->background);
+ GdkGCWin32 *win32_gc = (GdkGCWin32 *) gc;
+ COLORREF bg = gdk_colormap_color (colormap, win32_gc->background);
if (SetBkColor (win32_gc->hdc, bg) == CLR_INVALID)
WIN32_GDI_FAILED ("SetBkColor"), *ok = FALSE;
}
HDC
-gdk_gc_predraw (GdkDrawable *drawable,
- GdkGCWin32 *win32_gc,
- GdkGCValuesMask usage)
+gdk_win32_hdc_get (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkGCValuesMask usage)
{
+ GdkGCWin32 *win32_gc = (GdkGCWin32 *) gc;
GdkColormapPrivateWin32 *colormap_private =
(GdkColormapPrivateWin32 *) GDK_DRAWABLE_IMPL_WIN32 (drawable)->colormap;
gboolean ok = TRUE;
@@ -933,9 +948,9 @@ gdk_gc_predraw (GdkDrawable *drawable,
g_assert (win32_gc->hdc == NULL);
- win32_gc->hwnd = GDK_DRAWABLE_XID (drawable);
+ win32_gc->hwnd = GDK_DRAWABLE_HANDLE (drawable);
- if (GDK_DRAWABLE_TYPE (drawable) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (drawable))
{
if ((win32_gc->hdc = CreateCompatibleDC (NULL)) == NULL)
WIN32_GDI_FAILED ("CreateCompatibleDC"), ok = FALSE;
@@ -956,12 +971,12 @@ gdk_gc_predraw (GdkDrawable *drawable,
}
if (ok && (usage & GDK_GC_FOREGROUND))
- predraw_set_foreground (gc_private, colormap_private, &ok);
+ predraw_set_foreground (gc, GDK_DRAWABLE_IMPL_WIN32 (drawable)->colormap, &ok);
if (ok
&& (usage & GDK_GC_BACKGROUND)
&& (win32_gc->values_mask & GDK_GC_BACKGROUND))
- predraw_set_background (win32_gc, colormap_private, &ok);
+ predraw_set_background (gc, GDK_DRAWABLE_IMPL_WIN32 (drawable)->colormap, &ok);
if (ok && (usage & GDK_GC_FONT))
{
@@ -1002,13 +1017,13 @@ gdk_gc_predraw (GdkDrawable *drawable,
{
rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++;
- rect->left = CLAMP (boxes[i].x1 + gc_private->clip_x_origin,
+ rect->left = CLAMP (boxes[i].x1 + gc->clip_x_origin,
G_MINSHORT, G_MAXSHORT);
- rect->right = CLAMP (boxes[i].x2 + gc_private->clip_x_origin,
+ rect->right = CLAMP (boxes[i].x2 + gc->clip_x_origin,
G_MINSHORT, G_MAXSHORT);
- rect->top = CLAMP (boxes[i].y1 + gc_private->clip_y_origin,
+ rect->top = CLAMP (boxes[i].y1 + gc->clip_y_origin,
G_MINSHORT, G_MAXSHORT);
- rect->bottom = CLAMP (boxes[i].y2 + gc_private->clip_y_origin,
+ rect->bottom = CLAMP (boxes[i].y2 + gc->clip_y_origin,
G_MINSHORT, G_MAXSHORT);
GDK_NOTE (MISC, g_print ("clip rgn box %d: %dx%d@+%d+%d\n",
@@ -1051,7 +1066,7 @@ gdk_gc_predraw (GdkDrawable *drawable,
HRGN hrgn;
RECT rect;
- g_print ("gdk_gc_predraw: %d: %#x\n", win32_gc, win32_gc->hdc);
+ g_print ("gdk_win32_hdc_get: %d: %#x\n", win32_gc, win32_gc->hdc);
obj = GetCurrentObject (win32_gc->hdc, OBJ_BRUSH);
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
g_print ("brush: style: %s color: %.06x hatch: %#x\n",
@@ -1110,13 +1125,11 @@ gdk_gc_predraw (GdkDrawable *drawable,
}
void
-gdk_gc_postdraw (GdkDrawable *drawable,
- GdkGCWin32 *win32_gc,
- GdkGCValuesMask usage)
+gdk_win32_hdc_release (GdkDrawable *drawable,
+ GdkGC *gc,
+ GdkGCValuesMask usage)
{
- GdkDrawablePrivate *drawable_private = (GdkDrawablePrivate *) drawable;
- GdkColormapPrivateWin32 *colormap_private =
- (GdkColormapPrivateWin32 *) drawable_private->colormap;
+ GdkGCWin32 *win32_gc = (GdkGCWin32 *) gc;
HGDIOBJ hpen = NULL;
HGDIOBJ hbr = NULL;
@@ -1141,7 +1154,7 @@ gdk_gc_postdraw (GdkDrawable *drawable,
WIN32_GDI_FAILED ("UnrealizeObject");
}
#endif
- if (GDK_DRAWABLE_TYPE (drawable) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (drawable))
{
if (!DeleteDC (win32_gc->hdc))
WIN32_GDI_FAILED ("DeleteDC");
@@ -1162,22 +1175,6 @@ gdk_gc_postdraw (GdkDrawable *drawable,
win32_gc->hdc = NULL;
}
-HDC
-gdk_win32_hdc_get (GdkDrawable *drawable,
- GdkGC *gc,
- GdkGCValuesMask usage)
-{
- return gdk_gc_predraw (drawable, GDK_GC_WIN32 (gc), usage);
-}
-
-void
-gdk_win32_hdc_release (GdkDrawable *drawable,
- GdkGC *gc,
- GdkGCValuesMask usage)
-{
- gdk_gc_postdraw (drawable, GDK_GC_WIN32 (gc), usage);
-}
-
/* This function originally from Jean-Edouard Lachand-Robert, and
* available at www.codeguru.com. Simplified for our needs, now
* handles just one-bit deep bitmaps (in Window parlance, ie those
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index fc7df85fb..0940e1a01 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -33,6 +33,8 @@
#include "gdkregion-generic.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
typedef struct _GdkWindowQueueItem GdkWindowQueueItem;
typedef struct _GdkWindowParentPos GdkWindowParentPos;
@@ -67,10 +69,10 @@ struct _GdkWindowParentPos
GdkRectangle clip_rect;
};
-static void gdk_window_compute_position (GdkWindow *window,
+static void gdk_window_compute_position (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos,
GdkWin32PositionInfo *info);
-static void gdk_window_compute_parent_pos (GdkWindow *window,
+static void gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos);
@@ -92,25 +94,122 @@ _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset)
{
- GdkWindowWin32Data *data = GDK_WINDOW_WIN32DATA (window);
+ GdkWindowImplWin32 *impl =
+ GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
- *x_offset = data->position_info.x_offset;
- *y_offset = data->position_info.y_offset;
+ *x_offset = impl->position_info.x_offset;
+ *y_offset = impl->position_info.y_offset;
}
void
_gdk_window_init_position (GdkWindow *window)
{
- GdkWindowWin32Data *data;
GdkWindowParentPos parent_pos;
+ GdkWindowImplWin32 *impl;
- g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- data = GDK_WINDOW_WIN32DATA (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
- gdk_window_compute_parent_pos (window, &parent_pos);
- gdk_window_compute_position (window, &parent_pos, &data->position_info);
+ gdk_window_compute_parent_pos (impl, &parent_pos);
+ gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
+}
+
+/**
+ * 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 its window, both pixels and children, by
+ * the given amount. 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)
+{
+ gboolean can_guffaw_scroll = FALSE;
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
+
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ obj = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ /* We can guffaw scroll if we are a child window, and the parent
+ * does not extend beyond our edges.
+ */
+
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
+ {
+ GdkWindowImplWin32 *parent_impl = GDK_WINDOW_IMPL_WIN32 (obj->parent->impl);
+ can_guffaw_scroll = (obj->x <= 0 &&
+ obj->y <= 0 &&
+ obj->x + impl->width >= parent_impl->width &&
+ obj->y + impl->height >= parent_impl->height);
+ }
+
+ if (!obj->children || !can_guffaw_scroll)
+ {
+ /* Use ScrollWindowEx, then move any children later
+ */
+ GList *tmp_list;
+ GdkRegion *invalidate_region;
+ GdkRectangle dest_rect;
+
+ invalidate_region = gdk_region_rectangle (&impl->position_info.clip_rect);
+
+ dest_rect = impl->position_info.clip_rect;
+ dest_rect.x += dx;
+ dest_rect.y += dy;
+ gdk_rectangle_intersect (&dest_rect, &impl->position_info.clip_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);
+
+ gdk_window_queue_translation (window, dx, dy);
+
+ if (ScrollWindowEx (GDK_WINDOW_HWND (window), dx, dy,
+ NULL, NULL, NULL, NULL, 0) == ERROR)
+ WIN32_API_FAILED ("ScrollWindowEx");
+ }
+
+ gdk_window_invalidate_region (window, invalidate_region, TRUE);
+ gdk_region_destroy (invalidate_region);
+
+ tmp_list = obj->children;
+ while (tmp_list)
+ {
+ GdkWindow * child = GDK_WINDOW (tmp_list->data);
+
+ gdk_window_move (child, obj->x + dx, obj->y + dy);
+
+ tmp_list = tmp_list->next;
+ }
+ }
+ else
+ {
+ /* Guffaw scroll
+ */
+ g_warning ("gdk_window_scroll(): guffaw scrolling not yet implemented");
+ }
}
void
@@ -120,10 +219,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
GdkWin32PositionInfo new_info;
GdkWindowParentPos parent_pos;
- GdkWindowWin32Data *data;
RECT rect;
GList *tmp_list;
gint d_xoffset, d_yoffset;
@@ -134,35 +233,36 @@ _gdk_window_move_resize_child (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- data = GDK_WINDOW_WIN32DATA (window);
+ obj = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
- dx = x - private->x;
- dy = y - private->y;
+ dx = x - obj->x;
+ dy = y - obj->y;
is_move = dx != 0 || dy != 0;
- is_resize = private->drawable.width != width || private->drawable.height != height;
+ is_resize = impl->width != width || impl->height != height;
if (!is_move && !is_resize)
return;
- private->x = x;
- private->y = y;
- private->drawable.width = width;
- private->drawable.height = height;
+ obj->x = x;
+ obj->y = y;
+ impl->width = width;
+ impl->height = height;
- gdk_window_compute_parent_pos (window, &parent_pos);
- gdk_window_compute_position (window, &parent_pos, &new_info);
+ gdk_window_compute_parent_pos (impl, &parent_pos);
+ gdk_window_compute_position (impl, &parent_pos, &new_info);
- gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+ gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
- parent_pos.x += private->x;
- parent_pos.y += private->y;
+ 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 - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ 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)
{
@@ -175,41 +275,41 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (d_xoffset < 0)
{
- new_x0 = data->position_info.x + d_xoffset;
- new_x1 = data->position_info.x + data->position_info.width;
+ new_x0 = impl->position_info.x + d_xoffset;
+ new_x1 = impl->position_info.x + impl->position_info.width;
}
else
{
- new_x0 = data->position_info.x;
- new_x1 = data->position_info.x + new_info.width + d_xoffset;
+ new_x0 = impl->position_info.x;
+ new_x1 = impl->position_info.x + new_info.width + d_xoffset;
}
if (d_yoffset < 0)
{
- new_y0 = data->position_info.y + d_yoffset;
- new_y1 = data->position_info.y + data->position_info.height;
+ new_y0 = impl->position_info.y + d_yoffset;
+ new_y1 = impl->position_info.y + impl->position_info.height;
}
else
{
- new_y0 = data->position_info.y;
- new_y1 = data->position_info.y + new_info.height + d_yoffset;
+ new_y0 = impl->position_info.y;
+ new_y1 = impl->position_info.y + new_info.height + d_yoffset;
}
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0,
FALSE))
WIN32_API_FAILED ("MoveWindow");
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &parent_pos);
tmp_list = tmp_list->next;
}
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_x0 + dx, new_y0 + dy,
rect.right - rect.left, rect.bottom - rect.top,
FALSE))
@@ -218,20 +318,20 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y, new_info.width, new_info.height,
FALSE))
WIN32_API_FAILED ("MoveWindow");
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
- ShowWindow (GDK_DRAWABLE_XID (window), SW_SHOWNA);
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
- data->position_info = new_info;
+ impl->position_info = new_info;
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &parent_pos);
@@ -243,10 +343,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (is_move && is_resize)
gdk_window_set_static_gravities (window, FALSE);
- if (data->position_info.mapped && !new_info.mapped)
- ShowWindow (GDK_DRAWABLE_XID (window), SW_HIDE);
+ if (impl->position_info.mapped && !new_info.mapped)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &parent_pos);
@@ -255,94 +355,98 @@ _gdk_window_move_resize_child (GdkWindow *window,
if (is_resize)
{
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y, new_info.width, new_info.height,
FALSE))
WIN32_API_FAILED ("MoveWindow");
}
else
{
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y,
rect.right - rect.left, rect.bottom - rect.top,
FALSE))
WIN32_API_FAILED ("MoveWindow");
}
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &parent_pos);
tmp_list = tmp_list->next;
}
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
- ShowWindow (GDK_DRAWABLE_XID (window), SW_SHOWNA);
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
- data->position_info = new_info;
+ impl->position_info = new_info;
}
}
static void
-gdk_window_compute_position (GdkWindow *window,
+gdk_window_compute_position (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos,
GdkWin32PositionInfo *info)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ 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 (private->drawable.width <= 32768)
+ if (window->width <= 32768)
{
- info->width = private->drawable.width;
- info->x = parent_pos->x + private->x - parent_pos->win32_x;
+ info->width = window->width;
+ info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
}
else
{
info->big = TRUE;
info->width = 32768;
- if (parent_pos->x + private->x < -16384)
+ if (parent_pos->x + wrapper->x < -16384)
{
- if (parent_pos->x + private->x + private->drawable.width < 16384)
- info->x = parent_pos->x + private->x + private->drawable.width - 32768 - parent_pos->win32_x;
+ if (parent_pos->x + wrapper->x + window->width < 16384)
+ info->x = parent_pos->x + wrapper->x + window->width - 32768 - parent_pos->win32_x;
else
info->x = -16384 - parent_pos->win32_y;
}
else
- info->x = parent_pos->x + private->x - parent_pos->win32_x;
+ info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
}
- if (private->drawable.height <= 32768)
+ if (window->height <= 32768)
{
- info->height = private->drawable.height;
- info->y = parent_pos->y + private->y - parent_pos->win32_y;
+ info->height = window->height;
+ info->y = parent_pos->y + wrapper->y - parent_pos->win32_y;
}
else
{
info->big = TRUE;
info->height = 32768;
- if (parent_pos->y + private->y < -16384)
+ if (parent_pos->y + wrapper->y < -16384)
{
- if (parent_pos->y + private->y + private->drawable.height < 16384)
- info->y = parent_pos->y + private->y + private->drawable.height - 32768 - parent_pos->win32_y;
+ if (parent_pos->y + wrapper->y + window->height < 16384)
+ info->y = parent_pos->y + wrapper->y + window->height - 32768 - parent_pos->win32_y;
else
info->y = -16384 - parent_pos->win32_y;
}
else
- info->y = parent_pos->y + private->y - parent_pos->win32_y;
+ 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 - private->x;
- info->y_offset = parent_y_offset + info->y - private->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.
@@ -353,24 +457,24 @@ gdk_window_compute_position (GdkWindow *window,
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->width + parent_y_offset > parent_pos->clip_rect.y + 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_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
{
- info->clip_rect.x = private->x;
- info->clip_rect.y = private->y;
- info->clip_rect.width = private->drawable.width;
- info->clip_rect.height = private->drawable.height;
+ 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 -= private->x;
- info->clip_rect.y -= private->y;
+ info->clip_rect.x -= wrapper->x;
+ info->clip_rect.y -= wrapper->y;
}
else
{
@@ -382,16 +486,20 @@ gdk_window_compute_position (GdkWindow *window,
}
static void
-gdk_window_compute_parent_pos (GdkWindow *window,
+gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowWin32Data *data;
+ 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;
@@ -413,27 +521,27 @@ gdk_window_compute_parent_pos (GdkWindow *window,
parent_pos->clip_rect.width = G_MAXINT;
parent_pos->clip_rect.height = G_MAXINT;
- private = (GdkWindowPrivate *)private->parent;
- while (private && private->drawable.window_type == GDK_WINDOW_CHILD)
+ parent = (GdkWindowObject *)wrapper->parent;
+ while (parent && parent->window_type == GDK_WINDOW_CHILD)
{
- data = (GdkWindowWin32Data *)private->drawable.klass_data;
-
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
+
tmp_clip.x = - clip_xoffset;
tmp_clip.y = - clip_yoffset;
- tmp_clip.width = private->drawable.width;
- tmp_clip.height = private->drawable.height;
+ 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 += private->x;
- parent_pos->y += private->y;
- parent_pos->win32_x += data->position_info.x;
- parent_pos->win32_y += data->position_info.y;
+ 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 += private->x;
- clip_yoffset += private->y;
+ clip_xoffset += parent->x;
+ clip_yoffset += parent->y;
- private = (GdkWindowPrivate *)private->parent;
+ parent = (GdkWindowObject *)parent->parent;
}
}
@@ -441,28 +549,31 @@ static void
gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowWin32Data *data = GDK_WINDOW_WIN32DATA (window);
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
GdkWin32PositionInfo new_info;
GList *tmp_list;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
- gdk_window_compute_position (window, parent_pos, &new_info);
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ gdk_window_compute_position (impl, parent_pos, &new_info);
- gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+ gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
- this_pos.x = parent_pos->x + private->x;
- this_pos.y = parent_pos->y + private->y;
+ 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 (data->position_info.mapped && !new_info.mapped)
- ShowWindow (GDK_DRAWABLE_XID (window), SW_HIDE);
+ if (impl->position_info.mapped && !new_info.mapped)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
- d_xoffset = new_info.x_offset - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ 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)
{
@@ -473,33 +584,33 @@ gdk_window_premove (GdkWindow *window,
if (d_xoffset < 0)
{
- new_x0 = data->position_info.x + d_xoffset;
- new_x1 = data->position_info.x + data->position_info.width;
+ new_x0 = impl->position_info.x + d_xoffset;
+ new_x1 = impl->position_info.x + impl->position_info.width;
}
else
{
- new_x0 = data->position_info.x;
- new_x1 = data->position_info.x + new_info.width + d_xoffset;
+ new_x0 = impl->position_info.x;
+ new_x1 = impl->position_info.x + new_info.width + d_xoffset;
}
if (d_yoffset < 0)
{
- new_y0 = data->position_info.y + d_yoffset;
- new_y1 = data->position_info.y + data->position_info.height;
+ new_y0 = impl->position_info.y + d_yoffset;
+ new_y1 = impl->position_info.y + impl->position_info.height;
}
else
{
- new_y0 = data->position_info.y;
- new_y1 = data->position_info.y + new_info.height + d_yoffset;
+ new_y0 = impl->position_info.y;
+ new_y1 = impl->position_info.y + new_info.height + d_yoffset;
}
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0,
FALSE))
WIN32_API_FAILED ("MoveWindow");
}
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_premove (tmp_list->data, &this_pos);
@@ -511,44 +622,47 @@ static void
gdk_window_postmove (GdkWindow *window,
GdkWindowParentPos *parent_pos)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- GdkWindowWin32Data *data = (GdkWindowWin32Data *)private->drawable.klass_data;
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
GdkWin32PositionInfo new_info;
GList *tmp_list;
gint d_xoffset, d_yoffset;
GdkWindowParentPos this_pos;
- gdk_window_compute_position (window, parent_pos, &new_info);
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ gdk_window_compute_position (impl, parent_pos, &new_info);
- this_pos.x = parent_pos->x + private->x;
- this_pos.y = parent_pos->y + private->y;
+ 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;
- d_xoffset = new_info.x_offset - data->position_info.x_offset;
- d_yoffset = new_info.y_offset - data->position_info.y_offset;
+ 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)
{
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
new_info.x, new_info.y, new_info.width, new_info.height,
FALSE))
WIN32_API_FAILED ("MoveWindow");
}
- if (!data->position_info.mapped && new_info.mapped && private->mapped)
- ShowWindow (GDK_DRAWABLE_XID (window), SW_SHOWNA);
+ if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNA);
- if (data->position_info.no_bg)
+ if (impl->position_info.no_bg)
gdk_window_tmp_reset_bg (window);
- data->position_info = new_info;
+ impl->position_info = new_info;
- tmp_list = private->children;
+ tmp_list = obj->children;
while (tmp_list)
{
gdk_window_postmove (tmp_list->data, &this_pos);
@@ -569,7 +683,7 @@ gdk_window_queue_translation (GdkWindow *window,
item->u.translate.dy = dy;
GDK_NOTE (EVENTS, g_print ("gdk_window_queue_translation %#x %d %d,%d\n",
- GDK_DRAWABLE_XID (window),
+ GDK_WINDOW_HWND (window),
item->serial,
dx, dy));
@@ -589,7 +703,7 @@ _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
item->u.antiexpose.area = area;
GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose %#x %d %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window),
+ GDK_WINDOW_HWND (window),
item->serial,
area->extents.x2 - area->extents.x1,
area->extents.y2 - area->extents.y1,
@@ -606,14 +720,15 @@ _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area)
{
- GdkWindowWin32Data *data = GDK_WINDOW_WIN32DATA (window);
+ GdkWindowImplWin32 *impl;
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *clip_region;
-
GSList *tmp_list = translate_queue;
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+
GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose %#x %d %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window), serial,
+ GDK_WINDOW_HWND (window), serial,
area->width, area->height, area->x, area->y));
while (tmp_list)
@@ -646,7 +761,7 @@ _gdk_window_process_expose (GdkWindow *window,
}
}
- clip_region = gdk_region_rectangle (&data->position_info.clip_rect);
+ clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
gdk_region_intersect (invalidate_region, clip_region);
if (!gdk_region_empty (invalidate_region))
@@ -659,33 +774,64 @@ _gdk_window_process_expose (GdkWindow *window,
static void
gdk_window_tmp_unset_bg (GdkWindow *window)
{
- /* ??? */
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ impl->position_info.no_bg = TRUE;
+
+ if (obj->bg_pixmap != GDK_NO_BG)
+ /* ??? */;
}
static void
gdk_window_tmp_reset_bg (GdkWindow *window)
{
- /* ??? */
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
+
+ obj = (GdkWindowObject *) window;
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ impl->position_info.no_bg = FALSE;
+
+ if (obj->bg_pixmap == GDK_NO_BG)
+ return;
+
+ if (obj->bg_pixmap)
+ {
+ HBITMAP hbitmap;
+
+ /* ??? */
+ }
+ else
+ {
+ /* ??? */
+ }
}
static void
-gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle *new_clip)
+gdk_window_clip_changed (GdkWindow *window,
+ GdkRectangle *old_clip,
+ GdkRectangle *new_clip)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+ GdkWindowImplWin32 *impl;
+ GdkWindowObject *obj;
GdkRegion *old_clip_region;
GdkRegion *new_clip_region;
- if (private->input_only)
+ if (((GdkWindowObject *)window)->input_only)
return;
-
+
old_clip_region = gdk_region_rectangle (old_clip);
new_clip_region = gdk_region_rectangle (new_clip);
/* Trim invalid region of window to new clip rectangle
*/
- if (private->update_area)
- gdk_region_intersect (private->update_area, new_clip_region);
+ if (obj->update_area)
+ gdk_region_intersect (obj->update_area, new_clip_region);
/* Invalidate newly exposed portion of window
*/
diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c
index b7734dc9d..7a1cdd127 100644
--- a/gdk/win32/gdkglobals-win32.c
+++ b/gdk/win32/gdkglobals-win32.c
@@ -41,3 +41,4 @@ GdkAtom gdk_ole2_dnd_atom;
ATOM gdk_selection_property;
gint gdk_null_window_warnings = TRUE;
DWORD windows_version = 0;
+gint gdk_input_ignore_wintab = FALSE;
diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c
index 1c8c3b549..df5fd3eae 100644
--- a/gdk/win32/gdkimage-win32.c
+++ b/gdk/win32/gdkimage-win32.c
@@ -27,8 +27,12 @@
#include "config.h"
#include "gdkimage.h"
+#include "gdkpixmap.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
+#include "gdkpixmap-win32.h"
static GList *image_list = NULL;
static gpointer parent_class = NULL;
@@ -129,10 +133,8 @@ gdk_image_new_bitmap (GdkVisual *visual,
int bpl = (w-1)/8 + 1;
int bpl32 = ((w-1)/32 + 1)*4;
- private = g_new (GdkImagePrivateWin32, 1);
- image = (GdkImage *) private;
- private->base.ref_count = 1;
- private->base.klass = &image_class;
+ image = g_object_new (gdk_image_get_type (), NULL);
+ private = PRIVATE_DATA (image);
image->type = GDK_IMAGE_SHARED;
image->visual = visual;
@@ -165,8 +167,8 @@ gdk_image_new_bitmap (GdkVisual *visual,
bmi.u.bmiColors[1].rgbRed = 0xFF;
bmi.u.bmiColors[1].rgbReserved = 0x00;
- private->ximage = CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi,
- DIB_RGB_COLORS, &bits, NULL, 0);
+ private->hbitmap = CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi,
+ DIB_RGB_COLORS, &bits, NULL, 0);
if (bpl != bpl32)
{
/* Win32 expects scanlines in DIBs to be 32 bit aligned */
@@ -190,12 +192,11 @@ _gdk_windowing_image_init (void)
/* Nothing needed AFAIK */
}
-static GdkImage*
-gdk_image_new_with_depth (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
+GdkImage*
+gdk_image_new (GdkImageType type,
+ GdkVisual *visual,
+ gint width,
+ gint height)
{
GdkImage *image;
GdkImagePrivateWin32 *private;
@@ -214,23 +215,20 @@ gdk_image_new_with_depth (GdkImageType type,
if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL)
type = GDK_IMAGE_SHARED;
- GDK_NOTE (MISC, g_print ("gdk_image_new_with_depth: %dx%dx%d %s\n",
- width, height, depth,
+ GDK_NOTE (MISC, g_print ("gdk_image_new: %dx%d %s\n",
+ width, height,
(type == GDK_IMAGE_SHARED ? "shared" :
(type == GDK_IMAGE_SHARED_PIXMAP ? "shared_pixmap" :
"???"))));
- private = g_new (GdkImagePrivateWin32, 1);
- image = (GdkImage *) private;
-
- private->base.ref_count = 1;
- private->base.klass = &image_class;
+ image = g_object_new (gdk_image_get_type (), NULL);
+ private = PRIVATE_DATA (image);
image->type = type;
image->visual = visual;
image->width = width;
image->height = height;
- image->depth = depth;
+ image->depth = visual->depth;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
@@ -238,15 +236,13 @@ gdk_image_new_with_depth (GdkImageType type,
bmi.bmiHeader.biWidth = width;
bmi.bmiHeader.biHeight = -height;
bmi.bmiHeader.biPlanes = 1;
- if (depth == 15)
+ if (image->depth == 15)
bmi.bmiHeader.biBitCount = 16;
else
- bmi.bmiHeader.biBitCount = depth;
-#if 1
- if (depth == 16)
+ bmi.bmiHeader.biBitCount = image->depth;
+ if (image->depth == 16)
bmi.bmiHeader.biCompression = BI_BITFIELDS;
else
-#endif
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter =
@@ -262,7 +258,8 @@ gdk_image_new_with_depth (GdkImageType type,
}
else
{
- if (depth == 1)
+ iUsage = DIB_RGB_COLORS;
+ if (image->depth == 1)
{
bmi.u.bmiColors[0].rgbBlue =
bmi.u.bmiColors[0].rgbGreen =
@@ -275,29 +272,25 @@ gdk_image_new_with_depth (GdkImageType type,
bmi.u.bmiColors[1].rgbReserved = 0x00;
}
-#if 1
- else if (depth == 16)
+ else if (image->depth == 16)
{
bmi.u.bmiMasks[0] = visual->red_mask;
bmi.u.bmiMasks[1] = visual->green_mask;
bmi.u.bmiMasks[2] = visual->blue_mask;
}
-#endif
- iUsage = DIB_RGB_COLORS;
}
- private->ximage =
- CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi, iUsage,
- &image->mem, NULL, 0);
+ private->hbitmap = CreateDIBSection (gdk_display_hdc, (BITMAPINFO *) &bmi,
+ iUsage, &image->mem, NULL, 0);
- if (private->ximage == NULL)
+ if (private->hbitmap == NULL)
{
WIN32_GDI_FAILED ("CreateDIBSection");
g_free (image);
return NULL;
}
- switch (depth)
+ switch (image->depth)
{
case 1:
case 8:
@@ -314,41 +307,22 @@ gdk_image_new_with_depth (GdkImageType type,
image->bpp = 4;
break;
default:
- g_warning ("gdk_image_new_with_depth: depth = %d", depth);
+ g_warning ("gdk_image_new: depth = %d", image->depth);
g_assert_not_reached ();
}
image->byte_order = GDK_LSB_FIRST;
- if (depth == 1)
+ if (image->depth == 1)
image->bpl = ((width-1)/32 + 1)*4;
else
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
- private->ximage, image->mem, image->bpl));
+ private->hbitmap, image->mem, image->bpl));
return image;
}
GdkImage*
-gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height)
-{
- return gdk_image_new_with_depth (type, visual, width, height,
- visual->depth);
-}
-
-GdkImage*
-gdk_image_bitmap_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height)
-{
- return gdk_image_new_with_depth (type, visual, width, height, 1);
-}
-
-GdkImage*
gdk_image_get (GdkWindow *window,
gint x,
gint y,
@@ -373,11 +347,11 @@ gdk_image_get (GdkWindow *window,
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
GDK_NOTE (MISC, g_print ("gdk_image_get: %#x %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window), width, height, x, y));
+ GDK_DRAWABLE_HANDLE (window), width, height, x, y));
image = g_object_new (gdk_image_get_type (), NULL);
private = PRIVATE_DATA (image);
@@ -390,7 +364,7 @@ gdk_image_get (GdkWindow *window,
/* This function is called both to blit from a window and from
* a pixmap.
*/
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
if ((hdc = CreateCompatibleDC (NULL)) == NULL)
{
@@ -398,14 +372,14 @@ gdk_image_get (GdkWindow *window,
g_free (image);
return NULL;
}
- if ((oldbitmap1 = SelectObject (hdc, GDK_DRAWABLE_XID (window))) == NULL)
+ if ((oldbitmap1 = SelectObject (hdc, GDK_PIXMAP_HBITMAP (window))) == NULL)
{
WIN32_GDI_FAILED ("SelectObject");
DeleteDC (hdc);
g_free (image);
return NULL;
}
- GetObject (GDK_DRAWABLE_XID (window), sizeof (BITMAP), &bm);
+ GetObject (GDK_PIXMAP_HBITMAP (window), sizeof (BITMAP), &bm);
GDK_NOTE (MISC,
g_print ("gdk_image_get: bmWidth = %d, bmHeight = %d, bmWidthBytes = %d, bmBitsPixel = %d\n",
bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, bm.bmBitsPixel));
@@ -421,7 +395,7 @@ gdk_image_get (GdkWindow *window,
}
else
{
- if ((hdc = GetDC (GDK_DRAWABLE_XID (window))) == NULL)
+ if ((hdc = GetDC (GDK_WINDOW_HWND (window))) == NULL)
{
WIN32_GDI_FAILED ("GetDC");
g_free (image);
@@ -441,14 +415,14 @@ gdk_image_get (GdkWindow *window,
if ((memdc = CreateCompatibleDC (hdc)) == NULL)
{
WIN32_GDI_FAILED ("CreateCompatibleDC");
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
SelectObject (hdc, oldbitmap1);
DeleteDC (hdc);
}
else
{
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
g_free (image);
return NULL;
@@ -484,38 +458,37 @@ gdk_image_get (GdkWindow *window,
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
- if ((private->ximage =
- CreateDIBSection (hdc, (BITMAPINFO *) &bmi, iUsage,
- &image->mem, NULL, 0)) == NULL)
+ if ((private->hbitmap = CreateDIBSection (hdc, (BITMAPINFO *) &bmi, iUsage,
+ &image->mem, NULL, 0)) == NULL)
{
WIN32_GDI_FAILED ("CreateDIBSection");
DeleteDC (memdc);
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
SelectObject (hdc, oldbitmap1);
DeleteDC (hdc);
}
else
{
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
g_free (image);
return NULL;
}
- if ((oldbitmap2 = SelectObject (memdc, private->ximage)) == NULL)
+ if ((oldbitmap2 = SelectObject (memdc, private->hbitmap)) == NULL)
{
WIN32_GDI_FAILED ("SelectObject");
- DeleteObject (private->ximage);
+ DeleteObject (private->hbitmap);
DeleteDC (memdc);
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
SelectObject (hdc, oldbitmap1);
DeleteDC (hdc);
}
else
{
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
g_free (image);
return NULL;
@@ -525,16 +498,16 @@ gdk_image_get (GdkWindow *window,
{
WIN32_GDI_FAILED ("BitBlt");
SelectObject (memdc, oldbitmap2);
- DeleteObject (private->ximage);
+ DeleteObject (private->hbitmap);
DeleteDC (memdc);
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
SelectObject (hdc, oldbitmap1);
DeleteDC (hdc);
}
else
{
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
g_free (image);
return NULL;
@@ -546,14 +519,14 @@ gdk_image_get (GdkWindow *window,
if (!DeleteDC (memdc))
WIN32_GDI_FAILED ("DeleteDC");
- if (GDK_DRAWABLE_TYPE (window) == GDK_DRAWABLE_PIXMAP)
+ if (GDK_IS_PIXMAP (window))
{
SelectObject (hdc, oldbitmap1);
DeleteDC (hdc);
}
else
{
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
switch (image->depth)
@@ -583,7 +556,7 @@ gdk_image_get (GdkWindow *window,
image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
GDK_NOTE (MISC, g_print ("... = %#x mem = %#x, bpl = %d\n",
- private->ximage, image->mem, image->bpl));
+ private->hbitmap, image->mem, image->bpl));
return image;
}
@@ -595,10 +568,10 @@ gdk_image_get_pixel (GdkImage *image,
{
guint32 pixel;
- g_return_val_if_fail (image != NULL, 0);
+ g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
- g_return_val_if_fail (x >= 0 && x < image->width
- && y >= 0 && y < image->height, 0);
+ if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
+ return 0;
if (image->depth == 1)
pixel = (((char *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
@@ -638,7 +611,8 @@ gdk_image_put_pixel (GdkImage *image,
{
g_return_if_fail (image != NULL);
- g_return_if_fail (x >= 0 && x < image->width && y >= 0 && y < image->height);
+ if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
+ return;
if (image->depth == 1)
if (pixel & 1)
@@ -669,7 +643,7 @@ gdk_win32_image_destroy (GdkImage *image)
{
GdkImagePrivateWin32 *private;
- g_return_if_fail (image != NULL);
+ g_return_if_fail (GDK_IS_IMAGE (image));
private = PRIVATE_DATA (image);
@@ -680,7 +654,7 @@ gdk_win32_image_destroy (GdkImage *image)
return;
GDK_NOTE (MISC, g_print ("gdk_win32_image_destroy: %#x%s\n",
- private->ximage,
+ private->hbitmap,
(image->type == GDK_IMAGE_SHARED_PIXMAP ?
" (shared pixmap)" : "")));
@@ -693,7 +667,7 @@ gdk_win32_image_destroy (GdkImage *image)
*/
case GDK_IMAGE_SHARED:
- if (!DeleteObject (private->ximage))
+ if (!DeleteObject (private->hbitmap))
WIN32_GDI_FAILED ("DeleteObject");
break;
@@ -702,5 +676,6 @@ gdk_win32_image_destroy (GdkImage *image)
}
g_free (private);
+ image->windowing_data = NULL;
}
diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c
index 005845d42..d243f79e6 100644
--- a/gdk/win32/gdkinput-win32.c
+++ b/gdk/win32/gdkinput-win32.c
@@ -33,54 +33,15 @@
#include "gdkinput.h"
#include "gdkinternals.h"
-#include "gdkprivate.h"
-#include "gdkwin32.h"
+#include "gdkprivate-win32.h"
+#include "gdkwindow-win32.h"
+#include "gdkinput-win32.h"
#ifdef HAVE_WINTAB
-#include <wintab.h>
+
#define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_ORIENTATION)
#define PACKETMODE (PK_BUTTONS)
#include <pktdef.h>
-#endif
-
-#include "gdkinputprivate.h"
-
-struct _GdkDevicePrivate {
- GdkDeviceInfo info;
-
- /* information about the axes */
- GdkAxisInfo *axes;
-
- /* reverse lookup on axis use type */
- gint axis_for_use[GDK_AXIS_LAST];
-
- /* true if we need to select a different set of events, but
- * can't because this is the core pointer
- */
- gint needs_update;
-
- /* State of buttons */
- gint button_state;
-
- gint *last_axis_data;
- gint last_buttons;
-#ifdef HAVE_WINTAB
- /* WINTAB stuff: */
- HCTX hctx;
- /* Cursor number */
- UINT cursor;
- /* The cursor's CSR_PKTDATA */
- WTPKT pktdata;
- /* CSR_NPBTNMARKS */
- UINT npbtnmarks[2];
- /* Azimuth and altitude axis */
- AXIS orientation_axes[2];
-#endif
-};
-
-#ifndef G_PI
-#define G_PI 3.14159265358979323846
-#endif
/* If USE_SYSCONTEXT is on, we open the Wintab device (hmm, what if
* there are several?) as a system pointing device, i.e. it controls
@@ -90,97 +51,78 @@ struct _GdkDevicePrivate {
* good at all.
*/
-#ifdef HAVE_WINTAB
-#define DEBUG_WINTAB 1
+#define DEBUG_WINTAB 1 /* Verbose debug messages enabled */
+
+#endif
+
+#if defined(HAVE_WINTAB) || defined(HAVE_WHATEVER_OTHER)
+#define HAVE_SOME_XINPUT
#endif
#define TWOPI (2.*G_PI)
/* Forward declarations */
-static gint gdk_input_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static void gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-static GdkDevicePrivate *gdk_input_find_device (guint32 deviceid);
-
-#ifdef HAVE_WINTAB
-
-static gint gdk_input_win32_set_mode (guint32 deviceid,
- GdkInputMode mode);
-static void gdk_input_win32_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-static gint gdk_input_win32_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- guint32 time);
-static void gdk_input_win32_ungrab_pointer (guint32 time);
-static void gdk_input_win32_configure_event (GdkEventConfigure *event,
- GdkWindow *window);
-static void gdk_input_win32_enter_event (GdkEventCrossing *xevent,
- GdkWindow *window);
-static gint gdk_input_win32_other_event (GdkEvent *event,
- MSG *xevent);
-static gint gdk_input_win32_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_win32_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-
-static GdkInputWindow *gdk_input_window_find (GdkWindow *window);
#if !USE_SYSCONTEXT
static GdkInputWindow *gdk_input_window_find_within (GdkWindow *window);
#endif
+
+#ifdef HAVE_WINTAB
+
static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx,
UINT id);
-#endif /* HAVE_WINTAB */
+static GList *wintab_contexts;
-/* Local variables */
+static GdkWindow *wintab_window;
-static GList *gdk_input_devices;
-static GList *gdk_input_windows;
-static GList *wintab_contexts;
+#endif /* HAVE_WINTAB */
-static gint gdk_input_root_width;
-static gint gdk_input_root_height;
+gboolean
+gdk_device_get_history (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events)
+{
+ GdkTimeCoord **coords;
+ int i;
-static GdkWindow *wintab_window;
+ g_return_val_if_fail (window != NULL, FALSE);
+ g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
+ g_return_val_if_fail (events != NULL, FALSE);
+ g_return_val_if_fail (n_events != NULL, FALSE);
-static guint32 last_moved_cursor_id;
+ *n_events = 0;
+ *events = NULL;
-static GdkAxisUse gdk_input_core_axes[] = { GDK_AXIS_X, GDK_AXIS_Y };
+ if (GDK_WINDOW_DESTROYED (window))
+ return FALSE;
+
+ if (GDK_IS_CORE (device))
+ return FALSE;
+ else
+ return _gdk_device_get_history (device, window, start, stop, events, n_events);
+}
-static GdkDeviceInfo gdk_input_core_info =
-{
- GDK_CORE_POINTER,
- "Core Pointer",
- GDK_SOURCE_MOUSE,
- GDK_MODE_SCREEN,
- TRUE,
- 2,
- gdk_input_core_axes
-};
+#ifdef HAVE_WINTAB
-/* Global variables */
+static GdkDevicePrivate *
+gdk_input_find_dev_from_ctx (HCTX hctx,
+ UINT cursor)
+{
+ GList *tmp_list = gdk_input_devices;
+ GdkDevicePrivate *gdkdev;
-GdkInputVTable gdk_input_vtable;
-gint gdk_input_ignore_core;
-gint gdk_input_ignore_wintab = FALSE;
+ while (tmp_list)
+ {
+ gdkdev = (GdkDevicePrivate *) (tmp_list->data);
+ if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
+ return gdkdev;
+ tmp_list = tmp_list->next;
+ }
+ return NULL;
+}
#if DEBUG_WINTAB
@@ -281,11 +223,9 @@ print_lc(LOGCONTEXT *lc)
#endif
-void
-gdk_input_init (void)
+static void
+gdk_input_wintab_init (void)
{
- guint32 deviceid_counter = 0;
-#ifdef HAVE_WINTAB
GdkDevicePrivate *gdkdev;
GdkWindowAttr wa;
WORD specversion;
@@ -416,7 +356,7 @@ gdk_input_init (void)
print_lc(&lc)));
#endif
hctx = g_new (HCTX, 1);
- if ((*hctx = WTOpen (GDK_DRAWABLE_XID (wintab_window), &lc, TRUE)) == NULL)
+ if ((*hctx = WTOpen (GDK_WINDOW_HWND (wintab_window), &lc, TRUE)) == NULL)
{
g_warning ("gdk_input_init: WTOpen failed");
return;
@@ -443,7 +383,6 @@ gdk_input_init (void)
gdkdev = g_new (GdkDevicePrivate, 1);
WTInfo (WTI_CURSORS + cursorix, CSR_NAME, csrname);
gdkdev->info.name = g_strconcat (devname, " ", csrname, NULL);
- gdkdev->info.deviceid = deviceid_counter++;
gdkdev->info.source = GDK_SOURCE_PEN;
gdkdev->info.mode = GDK_MODE_SCREEN;
#if USE_SYSCONTEXT
@@ -473,13 +412,10 @@ gdk_input_init (void)
if (gdkdev->pktdata & PK_ORIENTATION)
gdkdev->info.num_axes += 2; /* x and y tilt */
WTInfo (WTI_CURSORS + cursorix, CSR_NPBTNMARKS, &gdkdev->npbtnmarks);
+ gdkdev->info.axes = g_new (GdkDeviceAxis, gdkdev->info.num_axes);
gdkdev->axes = g_new (GdkAxisInfo, gdkdev->info.num_axes);
- gdkdev->info.axes = g_new (GdkAxisUse, gdkdev->info.num_axes);
gdkdev->last_axis_data = g_new (gint, gdkdev->info.num_axes);
- for (k = 0; k < GDK_AXIS_LAST; k++)
- gdkdev->axis_for_use[k] = -1;
-
k = 0;
if (gdkdev->pktdata & PK_X)
{
@@ -489,8 +425,9 @@ gdk_input_init (void)
gdkdev->axes[k].min_value = axis_x.axMin;
gdkdev->axes[k].xmax_value =
gdkdev->axes[k].max_value = axis_x.axMax;
- gdkdev->info.axes[k] = GDK_AXIS_X;
- gdkdev->axis_for_use[GDK_AXIS_X] = k;
+ gdkdev->info.axes[k].use = GDK_AXIS_X;
+ gdkdev->info.axes[k].min = axis_x.axMin;
+ gdkdev->info.axes[k].min = axis_x.axMax;
k++;
}
if (gdkdev->pktdata & PK_Y)
@@ -501,8 +438,9 @@ gdk_input_init (void)
gdkdev->axes[k].min_value = axis_y.axMin;
gdkdev->axes[k].xmax_value =
gdkdev->axes[k].max_value = axis_y.axMax;
- gdkdev->info.axes[k] = GDK_AXIS_Y;
- gdkdev->axis_for_use[GDK_AXIS_Y] = k;
+ gdkdev->info.axes[k].use = GDK_AXIS_Y;
+ gdkdev->info.axes[k].min = axis_y.axMin;
+ gdkdev->info.axes[k].min = axis_y.axMax;
k++;
}
if (gdkdev->pktdata & PK_NORMAL_PRESSURE)
@@ -513,8 +451,9 @@ gdk_input_init (void)
gdkdev->axes[k].min_value = axis_npressure.axMin;
gdkdev->axes[k].xmax_value =
gdkdev->axes[k].max_value = axis_npressure.axMax;
- gdkdev->info.axes[k] = GDK_AXIS_PRESSURE;
- gdkdev->axis_for_use[GDK_AXIS_PRESSURE] = k;
+ gdkdev->info.axes[k].use = GDK_AXIS_PRESSURE;
+ gdkdev->info.axes[k].min = axis_npressure.axMin;
+ gdkdev->info.axes[k].min = axis_npressure.axMax;
k++;
}
if (gdkdev->pktdata & PK_ORIENTATION)
@@ -534,25 +473,19 @@ gdk_input_init (void)
gdkdev->axes[k].min_value = -1000;
gdkdev->axes[k].xmax_value =
gdkdev->axes[k].max_value = 1000;
- gdkdev->info.axes[k] = axis;
- gdkdev->axis_for_use[axis] = k;
+ gdkdev->info.axes[k].use = axis;
+ gdkdev->info.axes[k].min = -1000;
+ gdkdev->info.axes[k].min = 1000;
k++;
}
}
gdkdev->info.num_keys = 0;
gdkdev->info.keys = NULL;
GDK_NOTE (EVENTS,
- (g_print ("device: %d (%d) %s axes: %d\n",
- gdkdev->info.deviceid, cursorix,
- gdkdev->info.name,
- gdkdev->info.num_axes),
- g_print ("axes: X:%d, Y:%d, PRESSURE:%d, "
- "XTILT:%d, YTILT:%d\n",
- gdkdev->axis_for_use[GDK_AXIS_X],
- gdkdev->axis_for_use[GDK_AXIS_Y],
- gdkdev->axis_for_use[GDK_AXIS_PRESSURE],
- gdkdev->axis_for_use[GDK_AXIS_XTILT],
- gdkdev->axis_for_use[GDK_AXIS_YTILT])));
+ g_print ("device: (%d) %s axes: %d\n",
+ cursorix,
+ gdkdev->info.name,
+ gdkdev->info.num_axes));
for (i = 0; i < gdkdev->info.num_axes; i++)
GDK_NOTE (EVENTS,
g_print ("...axis %d: %d--%d@%d (%d--%d@%d)\n",
@@ -568,138 +501,92 @@ gdk_input_init (void)
}
}
}
-#endif /* HAVE_WINTAB */
-
- if (deviceid_counter > 0)
- {
-#ifdef HAVE_WINTAB
- gdk_input_vtable.set_mode = gdk_input_win32_set_mode;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_win32_get_pointer;
- gdk_input_vtable.grab_pointer = gdk_input_win32_grab_pointer;
- gdk_input_vtable.ungrab_pointer = gdk_input_win32_ungrab_pointer;
- gdk_input_vtable.configure_event = gdk_input_win32_configure_event;
- gdk_input_vtable.enter_event = gdk_input_win32_enter_event;
- gdk_input_vtable.other_event = gdk_input_win32_other_event;
- gdk_input_vtable.enable_window = gdk_input_win32_enable_window;
- gdk_input_vtable.disable_window = gdk_input_win32_disable_window;
-
- gdk_input_root_width = gdk_screen_width ();
- gdk_input_root_height = gdk_screen_height ();
- gdk_input_ignore_core = FALSE;
-#else
- g_assert_not_reached ();
-#endif
- }
- else
- {
- gdk_input_vtable.set_mode = NULL;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
- gdk_input_vtable.grab_pointer = NULL;
- gdk_input_vtable.ungrab_pointer = NULL;
- gdk_input_vtable.configure_event = NULL;
- gdk_input_vtable.enter_event = NULL;
- gdk_input_vtable.other_event = NULL;
- gdk_input_vtable.enable_window = NULL;
- gdk_input_vtable.disable_window = NULL;
- gdk_input_ignore_core = FALSE;
- }
-
- gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
}
-gint
-gdk_input_set_mode (guint32 deviceid,
- GdkInputMode mode)
+static void
+decode_tilt (gint *axis_data,
+ AXIS *axes,
+ PACKET *packet)
{
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
+ /* As I don't have a tilt-sensing tablet,
+ * I cannot test this code.
+ */
+
+ double az, el;
- if (gdk_input_vtable.set_mode)
- return gdk_input_vtable.set_mode (deviceid, mode);
- else
- return FALSE;
+ az = TWOPI * packet->pkOrientation.orAzimuth /
+ (axes[0].axResolution / 65536.);
+ el = TWOPI * packet->pkOrientation.orAltitude /
+ (axes[1].axResolution / 65536.);
+
+ /* X tilt */
+ axis_data[0] = cos (az) * cos (el) * 1000;
+ /* Y tilt */
+ axis_data[1] = sin (az) * cos (el) * 1000;
}
-void
-gdk_input_set_axes (guint32 deviceid,
- GdkAxisUse *axes)
-{
- int i;
- GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
+#if !USE_SYSCONTEXT
- if (deviceid == GDK_CORE_POINTER)
- return;
+static GdkInputWindow *
+gdk_input_window_find_within (GdkWindow *window)
+{
+ GList *list;
+ GdkWindow *tmpw;
+ GdkInputWindow *candidate = NULL;
- for (i = GDK_AXIS_IGNORE; i < GDK_AXIS_LAST; i++)
+ for (list = gdk_input_windows; list != NULL; list = list->next)
{
- gdkdev->axis_for_use[i] = -1;
+ tmpw = ((GdkInputWindow *) (tmp_list->data))->window;
+ if (tmpw == window
+ || IsChild (GDK_WINDOW_HWND (window), GDK_WINDOW_HWND (tmpw)))
+ {
+ if (candidate)
+ return NULL; /* Multiple hits */
+ candidate = (GdkInputWindow *) (list->data);
+ }
}
- for (i = 0; i < gdkdev->info.num_axes; i++)
- {
- gdkdev->info.axes[i] = axes[i];
- gdkdev->axis_for_use[axes[i]] = i;
- }
+ return candidate;
}
-static void
-gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (x)
- *x = x_int;
- if (y)
- *y = y_int;
- if (pressure)
- *pressure = 0.5;
- if (xtilt)
- *xtilt = 0;
- if (ytilt)
- *ytilt = 0;
-}
+#endif /* USE_SYSCONTEXT */
-#ifdef HAVE_WINTAB
+#endif /* HAVE_WINTAB */
static void
gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
GdkInputWindow *input_window,
gint *axis_data,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt)
+ gdouble *axis_out,
+ gdouble *x_out,
+ gdouble *y_out)
{
- GdkDrawablePrivate *window_private;
- gint x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
- gdouble device_width, device_height;
- gdouble x_offset, y_offset, x_scale, y_scale;
+ GdkWindowImplWin32 *impl;
- window_private = (GdkDrawablePrivate *) input_window->window;
+ int i;
+ int x_axis = 0;
+ int y_axis = 0;
+
+ double device_width, device_height;
+ double x_offset, y_offset, x_scale, y_scale;
- x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
- y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
- pressure_axis = gdkdev->axis_for_use[GDK_AXIS_PRESSURE];
- xtilt_axis = gdkdev->axis_for_use[GDK_AXIS_XTILT];
- ytilt_axis = gdkdev->axis_for_use[GDK_AXIS_YTILT];
+ 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;
+ }
+ }
+
device_width = gdkdev->axes[x_axis].max_value -
gdkdev->axes[x_axis].min_value;
device_height = gdkdev->axes[y_axis].max_value -
@@ -707,133 +594,60 @@ gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
if (gdkdev->info.mode == GDK_MODE_SCREEN)
{
- x_scale = gdk_input_root_width / device_width;
- y_scale = gdk_input_root_height / device_height;
+ x_scale = gdk_screen_width() / device_width;
+ y_scale = gdk_screen_height() / device_height;
- x_offset = -input_window->root_x;
- y_offset = -input_window->root_y;
+ x_offset = - input_window->root_x;
+ y_offset = - input_window->root_y;
}
else /* GDK_MODE_WINDOW */
{
double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
(device_width*gdkdev->axes[x_axis].resolution);
- if (device_aspect * window_private->width >= window_private->height)
+ if (device_aspect * impl->width >= impl->height)
{
/* device taller than window */
- x_scale = window_private->width / device_width;
+ 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 -
- window_private->height)/2;
+ impl->height)/2;
}
else
{
/* window taller than device */
- y_scale = window_private->height / device_height;
+ y_scale = impl->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 - window_private->width)/2;
- }
- }
-
- if (x)
- *x = x_offset + x_scale*axis_data[x_axis];
- if (y)
- *y = y_offset + y_scale*axis_data[y_axis];
-
- if (pressure)
- {
- if (pressure_axis != -1)
- *pressure = ((double)axis_data[pressure_axis]
- - gdkdev->axes[pressure_axis].min_value)
- / (gdkdev->axes[pressure_axis].max_value
- - gdkdev->axes[pressure_axis].min_value);
- else
- *pressure = 0.5;
- }
-
- if (xtilt)
- {
- if (xtilt_axis != -1)
- {
- *xtilt = 2. * (double)(axis_data[xtilt_axis] -
- (gdkdev->axes[xtilt_axis].min_value +
- gdkdev->axes[xtilt_axis].max_value)/2) /
- (gdkdev->axes[xtilt_axis].max_value -
- gdkdev->axes[xtilt_axis].min_value);
- }
- else
- *xtilt = 0;
- }
-
- if (ytilt)
- {
- if (ytilt_axis != -1)
- {
- *ytilt = 2. * (double)(axis_data[ytilt_axis] -
- (gdkdev->axes[ytilt_axis].min_value +
- gdkdev->axes[ytilt_axis].max_value)/2) /
- (gdkdev->axes[ytilt_axis].max_value -
- gdkdev->axes[ytilt_axis].min_value);
+ x_offset = - (device_width * x_scale - impl->width)/2;
}
- else
- *ytilt = 0;
}
-}
-
-static void
-gdk_input_win32_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- GdkDevicePrivate *gdkdev;
- GdkInputWindow *input_window;
- gint x_int, y_int;
- gint i;
- if (deviceid == GDK_CORE_POINTER)
- {
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
- if (x)
- *x = x_int;
- if (y)
- *y = y_int;
- if (pressure)
- *pressure = 0.5;
- if (xtilt)
- *xtilt = 0;
- if (ytilt)
- *ytilt = 0;
- }
- else
+ for (i=0; i<gdkdev->info.num_axes; i++)
{
- if (mask)
- gdk_window_get_pointer (window, NULL, NULL, mask);
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- input_window = gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_translate_coordinates (gdkdev, input_window,
- gdkdev->last_axis_data,
- x, y, pressure,
- xtilt, ytilt);
- if (mask)
+ switch (gdkdev->info.axes[i].use)
{
- *mask &= 0xFF;
- *mask |= ((gdkdev->last_buttons & 0x1F) << 8);
+ 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;
}
}
}
@@ -853,143 +667,68 @@ gdk_input_get_root_relative_geometry (HWND w,
*y_ret = rect.top;
}
-static gint
-gdk_input_win32_set_mode (guint32 deviceid,
- GdkInputMode mode)
+GdkTimeCoord *
+gdk_input_motion_events (GdkWindow *window,
+ guint32 deviceid,
+ guint32 start,
+ guint32 stop,
+ gint *nevents_return)
{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
- GdkInputMode old_mode;
- GdkInputWindow *input_window;
-
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_val_if_fail (gdkdev != NULL, FALSE);
- old_mode = gdkdev->info.mode;
-
- if (old_mode == mode)
- return TRUE;
-
- gdkdev->info.mode = mode;
-
- if (mode == GDK_MODE_WINDOW)
- {
- gdkdev->info.has_cursor = FALSE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_win32_enable_window (input_window->window, gdkdev);
- else
- if (old_mode != GDK_MODE_DISABLED)
- gdk_input_win32_disable_window (input_window->window, gdkdev);
- }
- }
- else if (mode == GDK_MODE_SCREEN)
- {
- gdkdev->info.has_cursor = TRUE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- gdk_input_win32_enable_window (((GdkInputWindow *)tmp_list->data)->window,
- gdkdev);
- }
- else /* mode == GDK_MODE_DISABLED */
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (old_mode != GDK_MODE_WINDOW ||
- input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_win32_disable_window (input_window->window, gdkdev);
- }
- }
+ g_return_val_if_fail (window != NULL, NULL);
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
- return TRUE;
+ *nevents_return = 0;
+ return NULL; /* ??? */
}
-static void
-gdk_input_win32_configure_event (GdkEventConfigure *event,
- GdkWindow *window)
+void
+_gdk_input_configure_event (GdkEventConfigure *event,
+ GdkWindow *window)
{
GdkInputWindow *input_window;
- gint root_x, root_y;
+ int root_x, root_y;
input_window = gdk_input_window_find (window);
g_return_if_fail (window != NULL);
- gdk_input_get_root_relative_geometry
- (GDK_DRAWABLE_XID (window), &root_x, &root_y);
+ gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window),
+ &root_x, &root_y);
input_window->root_x = root_x;
input_window->root_y = root_y;
}
-static void
-gdk_input_win32_enter_event (GdkEventCrossing *event,
- GdkWindow *window)
+void
+_gdk_input_enter_event (GdkEventCrossing *event,
+ GdkWindow *window)
{
GdkInputWindow *input_window;
- gint root_x, root_y;
+ int root_x, root_y;
input_window = gdk_input_window_find (window);
g_return_if_fail (window != NULL);
- gdk_input_get_root_relative_geometry
- (GDK_DRAWABLE_XID (window), &root_x, &root_y);
+ gdk_input_get_root_relative_geometry (GDK_WINDOW_HWND (window), &root_x, &root_y);
input_window->root_x = root_x;
input_window->root_y = root_y;
}
-static void
-decode_tilt (gint *axis_data,
- AXIS *axes,
- PACKET *packet)
-{
- /* As I don't have a tilt-sensing tablet,
- * I cannot test this code.
- */
-
- double az, el;
-
- az = TWOPI * packet->pkOrientation.orAzimuth /
- (axes[0].axResolution / 65536.);
- el = TWOPI * packet->pkOrientation.orAltitude /
- (axes[1].axResolution / 65536.);
-
- /* X tilt */
- axis_data[0] = cos (az) * cos (el) * 1000;
- /* Y tilt */
- axis_data[1] = sin (az) * cos (el) * 1000;
-}
-
-static GdkDevicePrivate *
-gdk_input_find_dev_from_ctx (HCTX hctx,
- UINT cursor)
-{
- GList *tmp_list = gdk_input_devices;
- GdkDevicePrivate *gdkdev;
-
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *) (tmp_list->data);
- if (gdkdev->hctx == hctx && gdkdev->cursor == cursor)
- return gdkdev;
- tmp_list = tmp_list->next;
- }
- return NULL;
-}
-static gint
-gdk_input_win32_other_event (GdkEvent *event,
- MSG *xevent)
+gint
+_gdk_input_other_event (GdkEvent *event,
+ MSG *msg,
+ GdkWindow *window)
{
+#ifdef HAVE_WINTAB
GdkWindow *current_window;
+ GdkWindowObject *obj;
+ GdkWindowImplWin32 *impl;
GdkInputWindow *input_window;
- GdkWindow *window;
GdkDevicePrivate *gdkdev;
GdkEventMask masktest;
POINT pt;
+
PACKET packet;
gint return_val;
gint k;
@@ -997,7 +736,7 @@ gdk_input_win32_other_event (GdkEvent *event,
if (event->any.window != wintab_window)
{
- g_warning ("gdk_input_win32_other_event: not wintab_window?");
+ g_warning ("_gdk_input_other_event: not wintab_window?");
return FALSE;
}
@@ -1010,11 +749,11 @@ gdk_input_win32_other_event (GdkEvent *event,
GDK_NOTE (EVENTS,
g_print ("gdk_input_win32_other_event: window=%#x (%d,%d)\n",
- GDK_DRAWABLE_XID (window), x, y));
+ GDK_WINDOW_HWND (window), x, y));
#else
/* ??? This code is pretty bogus */
- current_window = gdk_window_lookup (GetActiveWindow ());
+ current_window = gdk_win32_handle_table_lookup (GetActiveWindow ());
if (current_window == NULL)
return FALSE;
@@ -1023,13 +762,16 @@ gdk_input_win32_other_event (GdkEvent *event,
return FALSE;
#endif
- if (xevent->message == WT_PACKET)
+ if (msg->message == WT_PACKET)
{
- if (!WTPacket ((HCTX) xevent->lParam, xevent->wParam, &packet))
+ if (!WTPacket ((HCTX) msg->lParam, msg->wParam, &packet))
return FALSE;
}
- switch (xevent->message)
+ obj = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+
+ switch (msg->message)
{
case WT_PACKET:
if (window == gdk_parent_root)
@@ -1038,7 +780,7 @@ gdk_input_win32_other_event (GdkEvent *event,
return FALSE;
}
- if ((gdkdev = gdk_input_find_dev_from_ctx ((HCTX) xevent->lParam,
+ if ((gdkdev = gdk_input_find_dev_from_ctx ((HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
@@ -1095,25 +837,26 @@ gdk_input_win32_other_event (GdkEvent *event,
* propagate if necessary.
*/
dijkstra:
- if (!GDK_WINDOW_WIN32DATA (window)->extension_events_selected
- || !(((GdkWindowPrivate *) window)->extension_events & masktest))
+ if (!impl->extension_events_selected
+ || !(obj->extension_events & masktest))
{
GDK_NOTE (EVENTS, g_print ("...not selected\n"));
- if (((GdkWindowPrivate *) window)->parent == gdk_parent_root)
+ if (obj->parent == GDK_WINDOW_OBJECT (gdk_parent_root))
return FALSE;
pt.x = x;
pt.y = y;
- ClientToScreen (GDK_DRAWABLE_XID (window), &pt);
+ ClientToScreen (GDK_WINDOW_HWND (window), &pt);
gdk_drawable_unref (window);
- window = ((GdkWindowPrivate *) window)->parent;
+ window = (GdkWindow *) obj->parent;
+ obj = GDK_WINDOW_OBJECT (window);
gdk_drawable_ref (window);
- ScreenToClient (GDK_DRAWABLE_XID (window), &pt);
+ ScreenToClient (GDK_WINDOW_HWND (window), &pt);
x = pt.x;
y = pt.y;
GDK_NOTE (EVENTS, g_print ("...propagating to %#x, (%d,%d)\n",
- GDK_DRAWABLE_XID (window), x, y));
+ GDK_WINDOW_HWND (window), x, y));
goto dijkstra;
}
@@ -1130,10 +873,8 @@ gdk_input_win32_other_event (GdkEvent *event,
if (event->any.type == GDK_BUTTON_PRESS
|| event->any.type == GDK_BUTTON_RELEASE)
{
- event->button.time = xevent->time;
- event->button.source = gdkdev->info.source;
- last_moved_cursor_id =
- event->button.deviceid = gdkdev->info.deviceid;
+ event->button.time = msg->time;
+ event->button.device = &gdkdev->info;
#if 0
#if USE_SYSCONTEXT
@@ -1144,49 +885,39 @@ gdk_input_win32_other_event (GdkEvent *event,
#endif
gdk_input_translate_coordinates (gdkdev, input_window,
gdkdev->last_axis_data,
- &event->button.x, &event->button.y,
- &event->button.pressure,
- &event->button.xtilt,
- &event->button.ytilt);
+ event->button.axes,
+ &event->button.x,
+ &event->button.y);
event->button.state = ((gdkdev->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
- GDK_NOTE (EVENTS, g_print ("WINTAB button %s: %d %d %g,%g %g %g,%g\n",
+ GDK_NOTE (EVENTS, g_print ("WINTAB button %s:%d %g,%g %g %g,%g\n",
(event->button.type == GDK_BUTTON_PRESS ?
"press" : "release"),
- event->button.deviceid,
event->button.button,
- event->button.x, event->button.y,
- event->button.pressure,
- event->button.xtilt, event->button.ytilt));
+ event->button.x, event->button.y));
}
else
{
- event->motion.time = xevent->time;
- last_moved_cursor_id =
- event->motion.deviceid = gdkdev->info.deviceid;
+ event->motion.time = msg->time;
event->motion.is_hint = FALSE;
- event->motion.source = gdkdev->info.source;
+ event->motion.device = &gdkdev->info;
gdk_input_translate_coordinates (gdkdev, input_window,
gdkdev->last_axis_data,
- &event->motion.x, &event->motion.y,
- &event->motion.pressure,
- &event->motion.xtilt,
- &event->motion.ytilt);
+ event->motion.axes,
+ &event->motion.x,
+ &event->motion.y);
event->motion.state = ((gdkdev->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
- GDK_NOTE (EVENTS, g_print ("WINTAB motion: %d %g,%g %g %g,%g\n",
- event->motion.deviceid,
- event->motion.x, event->motion.y,
- event->motion.pressure,
- event->motion.xtilt, event->motion.ytilt));
+ GDK_NOTE (EVENTS, g_print ("WINTAB motion: %g,%g\n",
+ event->motion.x, event->motion.y));
/* Check for missing release or press events for the normal
* pressure button. At least on my ArtPadII I sometimes miss a
@@ -1215,20 +946,19 @@ gdk_input_win32_other_event (GdkEvent *event,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event2->button.button = 1;
- GDK_NOTE (EVENTS, g_print ("WINTAB synthesized button %s: %d %d %g,%g %g\n",
+ GDK_NOTE (EVENTS, g_print ("WINTAB synthesized button %s: %d %g,%gg\n",
(event2->button.type == GDK_BUTTON_PRESS ?
"press" : "release"),
- event2->button.deviceid,
event2->button.button,
- event2->button.x, event2->button.y,
- event2->button.pressure));
+ event2->button.x,
+ event2->button.y));
gdk_event_queue_append (event2);
}
}
return TRUE;
case WT_PROXIMITY:
- if (LOWORD (xevent->lParam) == 0)
+ if (LOWORD (msg->lParam) == 0)
{
event->proximity.type = GDK_PROXIMITY_OUT;
gdk_input_ignore_core = FALSE;
@@ -1238,42 +968,52 @@ gdk_input_win32_other_event (GdkEvent *event,
event->proximity.type = GDK_PROXIMITY_IN;
gdk_input_ignore_core = TRUE;
}
- event->proximity.time = xevent->time;
- event->proximity.source = GDK_SOURCE_PEN;
- event->proximity.deviceid = last_moved_cursor_id;
+ event->proximity.time = msg->time;
+ event->proximity.device = &gdkdev->info;
- GDK_NOTE (EVENTS, g_print ("WINTAB proximity %s: %d\n",
+ GDK_NOTE (EVENTS, g_print ("WINTAB proximity %s\n",
(event->proximity.type == GDK_PROXIMITY_IN ?
- "in" : "out"),
- event->proximity.deviceid));
+ "in" : "out")));
return TRUE;
}
- return FALSE;
+#endif
+ return -1;
}
-static gint
-gdk_input_win32_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev)
+gboolean
+_gdk_input_enable_window (GdkWindow *window,
+ GdkDevicePrivate *gdkdev)
{
- GDK_WINDOW_WIN32DATA (window)->extension_events_selected = TRUE;
+#ifdef HAVE_SOME_XINPUT
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+
+ impl->extension_events_selected = TRUE;
+#endif
+
return TRUE;
}
-static gint
-gdk_input_win32_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev)
+gboolean
+_gdk_input_disable_window (GdkWindow *window,
+ GdkDevicePrivate *gdkdev)
{
- GDK_WINDOW_WIN32DATA (window)->extension_events_selected = FALSE;
+#ifdef HAVE_SOME_XINPUT
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+
+ impl->extension_events_selected = FALSE;
+#endif
+
return TRUE;
}
-static gint
-gdk_input_win32_grab_pointer (GdkWindow *window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- guint32 time)
+gint
+_gdk_input_grab_pointer (GdkWindow *window,
+ gint owner_events,
+ GdkEventMask event_mask,
+ GdkWindow *confine_to,
+ guint32 time)
{
+#ifdef HAVE_SOME_XINPUT
GdkInputWindow *input_window, *new_window;
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
@@ -1285,9 +1025,9 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
need_ungrab = FALSE;
GDK_NOTE (MISC, g_print ("gdk_input_win32_grab_pointer: %#x %d %#x\n",
- GDK_DRAWABLE_XID (window),
+ GDK_WINDOW_HWND (window),
owner_events,
- (confine_to ? GDK_DRAWABLE_XID (confine_to) : 0)));
+ (confine_to ? GDK_WINDOW_HWND (confine_to) : 0)));
while (tmp_list)
{
@@ -1312,21 +1052,22 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
+ if (!GDK_IS_CORE (gdkdev) && gdkdev->hctx)
{
#if 0
/* XXX */
- gdk_input_find_events (window, gdkdev,
- event_mask,
- event_classes, &num_classes);
- result = XGrabDevice (GDK_DISPLAY(), gdkdev->xdevice,
+ gdk_input_common_find_events (window, gdkdev,
+ event_mask,
+ event_classes, &num_classes);
+
+ result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
- if (result != GDK_GRAB_SUCCESS)
+ if (result != Success)
return result;
#endif
}
@@ -1339,7 +1080,7 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
+ if (!GDK_IS_CORE (gdkdev) && gdkdev->hctx &&
((gdkdev->button_state != 0) || need_ungrab))
{
#if 0
@@ -1352,14 +1093,15 @@ gdk_input_win32_grab_pointer (GdkWindow *window,
tmp_list = tmp_list->next;
}
}
+#endif
return GDK_GRAB_SUCCESS;
-
}
-static void
-gdk_input_win32_ungrab_pointer (guint32 time)
+void
+_gdk_input_ungrab_pointer (guint32 time)
{
+#ifdef HAVE_SOME_XINPUT
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
@@ -1385,288 +1127,43 @@ gdk_input_win32_ungrab_pointer (guint32 time)
gdkdev = (GdkDevicePrivate *)tmp_list->data;
#if 0
/* XXX */
- if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
+ if (!GDK_IS_CORE (gdkdev) && gdkdev->xdevice)
XUngrabDevice (gdk_display, gdkdev->xdevice, time);
#endif
tmp_list = tmp_list->next;
}
}
+#endif
}
-#endif /* HAVE_WINTAB */
-
-GList *
-gdk_input_list_devices (void)
-{
- return gdk_input_devices;
-}
-
-void
-gdk_input_set_source (guint32 deviceid,
- GdkInputSource source)
-{
- GdkDevicePrivate *gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- gdkdev->info.source = source;
-}
-
-void gdk_input_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
- gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
-}
-
-GdkTimeCoord *
-gdk_input_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- g_return_val_if_fail (window != NULL, NULL);
- if (GDK_DRAWABLE_DESTROYED (window))
- return NULL;
-
- *nevents_return = 0;
- return NULL; /* ??? */
-}
-
-static gint
-gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.enable_window)
- return gdk_input_vtable.enable_window (window, gdkdev);
- else
- return TRUE;
-}
-
-static gint
-gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.disable_window)
- return gdk_input_vtable.disable_window(window,gdkdev);
- else
- return TRUE;
-}
-
-
-static GdkInputWindow *
-gdk_input_window_find (GdkWindow *window)
-{
- GList *tmp_list;
-
- for (tmp_list=gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
- if (((GdkInputWindow *)(tmp_list->data))->window == window)
- return (GdkInputWindow *)(tmp_list->data);
-
- return NULL; /* Not found */
-}
-
-#if !USE_SYSCONTEXT
-
-static GdkInputWindow *
-gdk_input_window_find_within (GdkWindow *window)
+gint
+_gdk_input_window_none_event (GdkEvent *event,
+ MSG *msg)
{
- GList *list;
- GdkWindow *tmpw;
- GdkInputWindow *candidate = NULL;
-
- for (list = gdk_input_windows; list != NULL; list = list->next)
- {
- tmpw = ((GdkInputWindow *) (tmp_list->data))->window;
- if (tmpw == window
- || IsChild (GDK_DRAWABLE_XID (window), GDK_DRAWABLE_XID (tmpw)))
- {
- if (candidate)
- return NULL; /* Multiple hits */
- candidate = (GdkInputWindow *) (list->data);
- }
- }
-
- return candidate;
+ return -1;
}
-#endif
-
-/* FIXME: this routine currently needs to be called between creation
- and the corresponding configure event (because it doesn't get the
- root_relative_geometry). This should work with
- gtk_window_set_extension_events, but will likely fail in other
- cases */
-
-void
-gdk_input_set_extension_events (GdkWindow *window,
- gint mask,
- GdkExtensionMode mode)
+gboolean
+_gdk_device_get_history (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events)
{
- GdkWindowPrivate *window_private;
- GList *tmp_list;
- GdkInputWindow *iw;
-
- g_return_if_fail (window != NULL);
- if (GDK_DRAWABLE_DESTROYED (window))
- return;
- window_private = (GdkWindowPrivate *) window;
-
- if (mode == GDK_EXTENSION_EVENTS_NONE)
- mask = 0;
-
- if (mask != 0)
- {
- iw = g_new (GdkInputWindow,1);
-
- iw->window = window;
- iw->mode = mode;
-
- iw->grabbed = FALSE;
-
- gdk_input_windows = g_list_append (gdk_input_windows, iw);
- window_private->extension_events = mask;
-
- /* Add enter window events to the event mask */
- gdk_window_set_events (window,
- gdk_window_get_events (window) |
- GDK_ENTER_NOTIFY_MASK);
- }
- else
- {
- iw = gdk_input_window_find (window);
- if (iw)
- {
- gdk_input_windows = g_list_remove (gdk_input_windows, iw);
- g_free (iw);
- }
-
- window_private->extension_events = 0;
- }
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
- && (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
- gdk_input_enable_window (window, gdkdev);
- else
- gdk_input_disable_window (window, gdkdev);
- }
- }
+ return FALSE;
}
-void
-gdk_input_window_destroy (GdkWindow *window)
+void
+gdk_input_init (void)
{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
- g_free (input_window);
-}
+ gdk_input_ignore_core = FALSE;
+ gdk_input_devices = NULL;
-void
-gdk_input_exit (void)
-{
#ifdef HAVE_WINTAB
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- gdk_input_win32_set_mode (gdkdev->info.deviceid, GDK_MODE_DISABLED);
- g_free (gdkdev->info.name);
- g_free (gdkdev->last_axis_data);
- g_free (gdkdev->info.axes);
- g_free (gdkdev->info.keys);
- g_free (gdkdev->axes);
- g_free (gdkdev);
- }
- }
-
- g_list_free (gdk_input_devices);
-
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- g_free (tmp_list->data);
- }
- g_list_free (gdk_input_windows);
- gdk_input_windows = NULL;
-
- gdk_drawable_unref (wintab_window);
- wintab_window = NULL;
-
-#if 1
- for (tmp_list = wintab_contexts; tmp_list; tmp_list = tmp_list->next)
- {
- HCTX *hctx = (HCTX *) tmp_list->data;
- BOOL result;
-
-#ifdef _MSC_VER
- /* For some reason WTEnable and/or WTClose tend to crash here.
- * Protect with __try/__except to avoid a message box.
- * When compiling with gcc, we cannot use __try/__except, so
- * don't call WTClose. I think this means that we'll
- * eventually run out of Wintab contexts, sigh.
- */
- __try {
-#if 0
- WTEnable (*hctx, FALSE);
-#endif
- result = WTClose (*hctx);
- }
- __except (/* GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? */
- EXCEPTION_EXECUTE_HANDLER /*:
- EXCEPTION_CONTINUE_SEARCH */) {
- result = FALSE;
- }
- if (!result)
- g_warning ("gdk_input_exit: Closing Wintab context %#x failed", *hctx);
-#endif /* _MSC_VER */
- g_free (hctx);
- }
-#endif
- g_list_free (wintab_contexts);
- wintab_contexts = NULL;
-#endif
-}
-
-static GdkDevicePrivate *
-gdk_input_find_device (guint32 id)
-{
- GList *tmp_list = gdk_input_devices;
- GdkDevicePrivate *gdkdev;
+ gdk_input_wintab_init ();
+#endif /* HAVE_WINTAB */
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *) (tmp_list->data);
- if (gdkdev->info.deviceid == id)
- return gdkdev;
- tmp_list = tmp_list->next;
- }
- return NULL;
+ gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
}
-void
-gdk_input_window_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- if (gdk_input_vtable.get_pointer)
- gdk_input_vtable.get_pointer (window, deviceid, x, y, pressure,
- xtilt, ytilt, mask);
-}
diff --git a/gdk/win32/gdkinput-win32.h b/gdk/win32/gdkinput-win32.h
new file mode 100644
index 000000000..8216f49e5
--- /dev/null
+++ b/gdk/win32/gdkinput-win32.h
@@ -0,0 +1,177 @@
+/* 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 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.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. 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_INPUT_WIN32_H__
+#define __GDK_INPUT_WIN32_H__
+
+#ifdef HAVE_WINTAB
+#include <wintab.h>
+#endif
+
+typedef struct _GdkAxisInfo GdkAxisInfo;
+typedef struct _GdkDevicePrivate GdkDevicePrivate;
+typedef struct _GdkInputWindow GdkInputWindow;
+
+/* information about a device axis */
+struct _GdkAxisInfo
+{
+ /* reported x resolution */
+ gint xresolution;
+
+ /* reported x minimum/maximum values */
+ gint xmin_value, xmax_value;
+
+ /* calibrated resolution (for aspect ration) - only relative values
+ between axes used */
+ gint resolution;
+
+ /* calibrated minimum/maximum values */
+ gint min_value, max_value;
+};
+
+#define GDK_INPUT_NUM_EVENTC 6
+
+struct _GdkDevicePrivate
+{
+ GdkDevice info;
+
+ /* information about the axes */
+ GdkAxisInfo *axes;
+
+ /* minimum key code for device */
+ gint min_keycode;
+
+ int buttonpress_type, buttonrelease_type, keypress_type,
+ keyrelease_type, motionnotify_type, proximityin_type,
+ proximityout_type, changenotify_type;
+
+ /* true if we need to select a different set of events, but
+ can't because this is the core pointer */
+ gint needs_update;
+
+ /* Mask of buttons (used for button grabs) */
+ gint button_state;
+
+ /* true if we've claimed the device as active. (used only for XINPUT_GXI) */
+ gint claimed;
+
+ gint *last_axis_data;
+ gint last_buttons;
+#ifdef HAVE_WINTAB
+ /* WINTAB stuff: */
+ HCTX hctx;
+ /* Cursor number */
+ UINT cursor;
+ /* The cursor's CSR_PKTDATA */
+ WTPKT pktdata;
+ /* CSR_NPBTNMARKS */
+ UINT npbtnmarks[2];
+ /* Azimuth and altitude axis */
+ AXIS orientation_axes[2];
+#endif
+};
+
+struct _GdkInputWindow
+{
+ /* gdk window */
+ GdkWindow *window;
+
+ /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
+ GdkExtensionMode mode;
+
+ /* position relative to root window */
+ gint root_x;
+ gint root_y;
+
+ /* rectangles relative to window of windows obscuring this one */
+ GdkRectangle *obscuring;
+ gint num_obscuring;
+
+ /* Is there a pointer grab for this window ? */
+ gint grabbed;
+};
+
+/* Global data */
+
+#define GDK_IS_CORE(d) (((GdkDevice *)(d)) == gdk_core_pointer)
+
+extern GList *gdk_input_devices;
+extern GList *gdk_input_windows;
+
+extern gint gdk_input_ignore_core;
+
+extern GdkDevice gdk_input_core_info;
+
+/* Function declarations */
+
+void gdk_input_window_destroy (GdkWindow *window);
+GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
+ gint n_events);
+
+/* The following functions are provided by each implementation
+ * (just wintab for now)
+ */
+gint _gdk_input_window_none_event(GdkEvent *event,
+ MSG *msg);
+void _gdk_input_configure_event (GdkEventConfigure *event,
+ GdkWindow *window);
+void _gdk_input_enter_event (GdkEventCrossing *event,
+ GdkWindow *window);
+gint _gdk_input_other_event (GdkEvent *event,
+ MSG *msg,
+ GdkWindow *window);
+
+/* These should be in gdkinternals.h */
+
+GdkInputWindow *gdk_input_window_find (GdkWindow *window);
+
+gint _gdk_input_enable_window (GdkWindow *window,
+ GdkDevicePrivate *gdkdev);
+gint _gdk_input_disable_window (GdkWindow *window,
+ GdkDevicePrivate *gdkdev);
+gint _gdk_input_grab_pointer (GdkWindow *window,
+ gint owner_events,
+ GdkEventMask event_mask,
+ GdkWindow *confine_to,
+ guint32 time);
+void _gdk_input_ungrab_pointer (guint32 time);
+gboolean _gdk_device_get_history (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events);
+
+
+#define GDK_MAX_DEVICE_CLASSES 13
+
+gint gdk_input_common_init (gint include_core);
+gint gdk_input_common_other_event (GdkEvent *event,
+ MSG *msg,
+ GdkInputWindow *input_window,
+ GdkWindow *window);
+
+#endif /* __GDK_INPUT_WIN32_H__ */
diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c
new file mode 100644
index 000000000..feb135464
--- /dev/null
+++ b/gdk/win32/gdkinput.c
@@ -0,0 +1,368 @@
+/* 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 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.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999. 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/.
+ */
+
+/* This file should really be one level up, in the backend-independent
+ * GDK, and the x11/gdkinput.c could also be removed.
+ *
+ * That stuff in x11/gdkinput.c which really *is* X11-dependent should
+ * be in x11/gdkinput-x11.c.
+ */
+
+#include "config.h"
+
+#include "gdkinput.h"
+#include "gdkprivate.h"
+
+/* When ther necessary stuff is in
+ * gdkinput.h, gdkinternals.h and
+ * gdkprivate.h, these includes shouldn't be here.
+ */
+
+#include <windows.h>
+#include <wintab.h>
+#include "gdkinput-win32.h"
+
+static GdkDeviceAxis gdk_input_core_axes[] = {
+ { GDK_AXIS_X, 0, 0 },
+ { GDK_AXIS_Y, 0, 0 }
+};
+
+GdkDevice gdk_input_core_info =
+{
+ "Core Pointer",
+ GDK_SOURCE_MOUSE,
+ GDK_MODE_SCREEN,
+ TRUE,
+
+ 2,
+ gdk_input_core_axes,
+
+ 0,
+ NULL
+};
+
+/* Global variables */
+
+GDKVAR GdkDevice *gdk_core_pointer = (GdkDevice *)&gdk_input_core_info;
+
+gint gdk_input_ignore_core;
+
+GList *gdk_input_devices;
+GList *gdk_input_windows;
+
+GList *
+gdk_devices_list (void)
+{
+ return gdk_input_devices;
+}
+
+void
+gdk_device_set_source (GdkDevice *device,
+ GdkInputSource source)
+{
+ g_return_if_fail (device != NULL);
+
+ device->source = source;
+}
+
+void
+gdk_device_set_key (GdkDevice *device,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
+{
+ g_return_if_fail (device != NULL);
+ g_return_if_fail (index < device->num_keys);
+
+ device->keys[index].keyval = keyval;
+ device->keys[index].modifiers = modifiers;
+}
+
+void
+gdk_device_set_axis_use (GdkDevice *device,
+ guint index,
+ GdkAxisUse use)
+{
+ g_return_if_fail (device != NULL);
+ g_return_if_fail (index < device->num_axes);
+
+ device->axes[index].use = use;
+
+ switch (use)
+ {
+ case GDK_AXIS_X:
+ case GDK_AXIS_Y:
+ device->axes[index].min = 0.;
+ device->axes[index].max = 0.;
+ break;
+ case GDK_AXIS_XTILT:
+ case GDK_AXIS_YTILT:
+ device->axes[index].min = -1.;
+ device->axes[index].max = 1;
+ break;
+ default:
+ device->axes[index].min = 0.;
+ device->axes[index].max = 1;
+ break;
+ }
+}
+
+GdkTimeCoord **
+_gdk_device_allocate_history (GdkDevice *device,
+ gint n_events)
+{
+ GdkTimeCoord **result = g_new (GdkTimeCoord *, n_events);
+ gint i;
+
+ for (i=0; i<n_events; i++)
+ result[i] = g_malloc (sizeof (GdkTimeCoord) -
+ sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->num_axes));
+
+ return result;
+}
+
+void
+gdk_device_free_history (GdkTimeCoord **events,
+ gint n_events)
+{
+ gint i;
+
+ for (i=0; i<n_events; i++)
+ g_free (events[i]);
+
+ g_free (events);
+}
+
+GdkInputWindow *
+gdk_input_window_find(GdkWindow *window)
+{
+ GList *tmp_list;
+
+ for (tmp_list=gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
+ if (((GdkInputWindow *)(tmp_list->data))->window == window)
+ return (GdkInputWindow *)(tmp_list->data);
+
+ return NULL; /* Not found */
+}
+
+/* FIXME: this routine currently needs to be called between creation
+ and the corresponding configure event (because it doesn't get the
+ root_relative_geometry). This should work with
+ gtk_window_set_extension_events, but will likely fail in other
+ cases */
+
+void
+gdk_input_set_extension_events (GdkWindow *window, gint mask,
+ GdkExtensionMode mode)
+{
+ GdkWindowObject *window_private;
+ GList *tmp_list;
+ GdkInputWindow *iw;
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ window_private = (GdkWindowObject*) window;
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ if (mode == GDK_EXTENSION_EVENTS_NONE)
+ mask = 0;
+
+ if (mask != 0)
+ {
+ iw = g_new(GdkInputWindow,1);
+
+ iw->window = window;
+ iw->mode = mode;
+
+ iw->obscuring = NULL;
+ iw->num_obscuring = 0;
+ iw->grabbed = FALSE;
+
+ gdk_input_windows = g_list_append(gdk_input_windows,iw);
+ window_private->extension_events = mask;
+
+ /* Add enter window events to the event mask */
+ if (g_list_length (gdk_input_devices) > 1)
+ gdk_window_set_events (window,
+ gdk_window_get_events (window) |
+ GDK_ENTER_NOTIFY_MASK);
+ }
+ else
+ {
+ iw = gdk_input_window_find (window);
+ if (iw)
+ {
+ gdk_input_windows = g_list_remove(gdk_input_windows,iw);
+ g_free(iw);
+ }
+
+ window_private->extension_events = 0;
+ }
+
+ for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
+ {
+ GdkDevicePrivate *gdkdev = tmp_list->data;
+
+ if (!GDK_IS_CORE (gdkdev))
+ {
+ if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
+ && (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
+ _gdk_input_enable_window (window,gdkdev);
+ else
+ _gdk_input_disable_window (window,gdkdev);
+ }
+ }
+}
+
+void
+gdk_input_window_destroy (GdkWindow *window)
+{
+ GdkInputWindow *input_window;
+
+ input_window = gdk_input_window_find (window);
+ g_return_if_fail (input_window != NULL);
+
+ gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
+ g_free(input_window);
+}
+
+void
+gdk_input_exit (void)
+{
+ GList *tmp_list;
+ GdkDevicePrivate *gdkdev;
+
+ for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
+ {
+ gdkdev = (GdkDevicePrivate *)(tmp_list->data);
+ if (!GDK_IS_CORE (gdkdev))
+ {
+ gdk_device_set_mode (&gdkdev->info, GDK_MODE_DISABLED);
+
+ g_free(gdkdev->info.name);
+ g_free(gdkdev->axes);
+ g_free(gdkdev->info.axes);
+ g_free(gdkdev->info.keys);
+ g_free(gdkdev);
+ }
+ }
+
+ g_list_free(gdk_input_devices);
+
+ for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
+ g_free(tmp_list->data);
+
+ g_list_free(gdk_input_windows);
+}
+
+/**
+ * gdk_device_get_axis:
+ * @axis: a #GdkDevice
+ * @axes: pointer to an array of axes
+ * @use: the use to look for
+ * @value: location to store the found value.
+ *
+ * Interprets an array of double as axis values for a given device,
+ * and locates the value in the array for a given axis use.
+ *
+ * Return value: %TRUE if the given axis use was found, otherwies %FALSE
+ **/
+gboolean
+gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value)
+{
+ gint i;
+
+ g_return_val_if_fail (device != NULL, FALSE);
+
+ if (axes == NULL)
+ return FALSE;
+
+ for (i=0; i<device->num_axes; i++)
+ if (device->axes[i].use == use)
+ {
+ if (value)
+ *value = axes[i];
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+gboolean
+gdk_device_set_mode (GdkDevice *device,
+ GdkInputMode mode)
+{
+ GList *tmp_list;
+ GdkDevicePrivate *gdkdev;
+ GdkInputMode old_mode;
+ GdkInputWindow *input_window;
+
+ if (GDK_IS_CORE (device))
+ return FALSE;
+
+ gdkdev = (GdkDevicePrivate *)device;
+
+ if (device->mode == mode)
+ return TRUE;
+
+ old_mode = device->mode;
+ device->mode = mode;
+
+ if (mode == GDK_MODE_WINDOW)
+ {
+ device->has_cursor = FALSE;
+ for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
+ {
+ input_window = (GdkInputWindow *)tmp_list->data;
+ if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
+ _gdk_input_enable_window (input_window->window, gdkdev);
+ else
+ if (old_mode != GDK_MODE_DISABLED)
+ _gdk_input_disable_window (input_window->window, gdkdev);
+ }
+ }
+ else if (mode == GDK_MODE_SCREEN)
+ {
+ device->has_cursor = TRUE;
+ for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
+ _gdk_input_enable_window (((GdkInputWindow *)tmp_list->data)->window,
+ gdkdev);
+ }
+ else /* mode == GDK_MODE_DISABLED */
+ {
+ for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
+ {
+ input_window = (GdkInputWindow *)tmp_list->data;
+ if (old_mode != GDK_MODE_WINDOW ||
+ input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
+ _gdk_input_disable_window (input_window->window, gdkdev);
+ }
+ }
+
+ return TRUE;
+}
diff --git a/gdk/win32/gdkinputprivate.h b/gdk/win32/gdkinputprivate.h
deleted file mode 100644
index 97b555cc5..000000000
--- a/gdk/win32/gdkinputprivate.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* 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 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.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. 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_INPUTPRIVATE_H__
-#define __GDK_INPUTPRIVATE_H__
-
-typedef struct _GdkAxisInfo GdkAxisInfo;
-typedef struct _GdkInputVTable GdkInputVTable;
-typedef struct _GdkDevicePrivate GdkDevicePrivate;
-typedef struct _GdkInputWindow GdkInputWindow;
-
-struct _GdkInputVTable {
- gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
- void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
- void (*set_key) (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers);
-
- GdkTimeCoord* (*motion_events) (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
- void (*get_pointer) (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
- gint (*grab_pointer) (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
- void (*ungrab_pointer) (guint32 time);
-
- void (*configure_event) (GdkEventConfigure *event, GdkWindow *window);
- void (*enter_event) (GdkEventCrossing *event, GdkWindow *window);
- gint (*other_event) (GdkEvent *event, MSG *xevent);
- gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
- gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
-};
-
-/* information about a device axis */
-struct _GdkAxisInfo
-{
- /* reported x resolution */
- gint xresolution;
-
- /* reported x minimum/maximum values */
- gint xmin_value, xmax_value;
-
- /* calibrated resolution (for aspect ration) - only relative values
- between axes used */
- gint resolution;
-
- /* calibrated minimum/maximum values */
- gint min_value, max_value;
-};
-
-struct _GdkInputWindow
-{
- /* gdk window */
- GdkWindow *window;
-
- /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
- GdkExtensionMode mode;
-
- /* position relative to root window */
- gint16 root_x;
- gint16 root_y;
-
- /* rectangles relative to window of windows obscuring this one */
- GdkRectangle *obscuring;
- gint num_obscuring;
-
- /* Is there a pointer grab for this window ? */
- gint grabbed;
-};
-
-/* Global data */
-
-extern GdkInputVTable gdk_input_vtable;
-extern gint gdk_input_ignore_core;
-extern gint gdk_input_ignore_wintab;
-
-/* Function declarations */
-
-void gdk_input_window_destroy (GdkWindow *window);
-void gdk_input_init (void);
-void gdk_input_exit (void);
-
-#endif /* __GDK_INPUTPRIVATE_H__ */
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index ff2b87231..607bcfb49 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -34,10 +34,11 @@
#include <io.h>
#include "gdk.h"
+#include "gdkkeysyms.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
-#include "gdkinputprivate.h"
-#include "gdkkeysyms.h"
+#include "gdkwindow-win32.h"
+#include "gdkinput-win32.h"
#include <objbase.h>
@@ -71,9 +72,10 @@ _gdk_windowing_init_check (int argc,
{
gint i, j, k;
+#ifdef HAVE_WINTAB
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
gdk_input_ignore_wintab = TRUE;
-
+#endif
if (getenv ("GDK_EVENT_FUNC_FROM_WINDOW_PROC") != NULL)
gdk_event_func_from_window_proc = TRUE;
@@ -127,7 +129,7 @@ gdk_win32_gdi_failed (const gchar *where,
/* On Win9x GDI calls are implemented in 16-bit code and thus
* don't set the 32-bit error code, sigh.
*/
- if (IS_WIN_NT (windows_version))
+ if (IS_WIN_NT ())
gdk_win32_api_failed (where, line, api);
else
gdk_other_api_failed (where, line, api);
@@ -163,7 +165,7 @@ gdk_get_use_xshm (void)
gint
gdk_screen_width (void)
{
- return ((GdkWindowPrivate *) gdk_parent_root)->drawable.width;
+ return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (gdk_parent_root)->impl)->width;
}
/*
@@ -184,7 +186,7 @@ gdk_screen_width (void)
gint
gdk_screen_height (void)
{
- return ((GdkWindowPrivate *) gdk_parent_root)->drawable.height;
+ return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (gdk_parent_root)->impl)->height;
}
/*
diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c
index 3db605454..81f2d968e 100644
--- a/gdk/win32/gdkpixmap-win32.c
+++ b/gdk/win32/gdkpixmap-win32.c
@@ -34,62 +34,100 @@
#include "gdkpixmap.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
+#include "gdkpixmap-win32.h"
-typedef struct
+static void gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+
+static void gdk_pixmap_impl_win32_init (GdkPixmapImplWin32 *pixmap);
+static void gdk_pixmap_impl_win32_class_init (GdkPixmapImplWin32Class *klass);
+static void gdk_pixmap_impl_win32_finalize (GObject *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_pixmap_impl_win32_get_type (void)
{
- gchar *color_string;
- GdkColor color;
- gint transparent;
-} _GdkPixmapColor;
+ static GType object_type = 0;
+
+ if (!object_type)
+ {
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkPixmapImplWin32Class),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gdk_pixmap_impl_win32_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkPixmapImplWin32),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gdk_pixmap_impl_win32_init,
+ };
+
+ object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32,
+ "GdkPixmapImplWin32",
+ &object_info);
+ }
+
+ return object_type;
+}
-typedef struct
+GType
+_gdk_pixmap_impl_get_type (void)
{
- guint ncolors;
- GdkColormap *colormap;
- gulong pixels[1];
-} _GdkPixmapInfo;
+ return gdk_pixmap_impl_win32_get_type ();
+}
static void
-gdk_win32_pixmap_destroy (GdkPixmap *pixmap)
+gdk_pixmap_impl_win32_init (GdkPixmapImplWin32 *impl)
{
- GdkDrawablePrivate *private = (GdkDrawablePrivate *) pixmap;
-
- GDK_NOTE (MISC, g_print ("gdk_win32_pixmap_destroy: %#x\n",
- GDK_DRAWABLE_XID (pixmap)));
+ impl->width = 1;
+ impl->height = 1;
+}
- if (!DeleteObject (GDK_DRAWABLE_XID (pixmap)))
- WIN32_GDI_FAILED ("DeleteObject");
+static void
+gdk_pixmap_impl_win32_class_init (GdkPixmapImplWin32Class *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
- gdk_xid_table_remove (GDK_DRAWABLE_XID (pixmap));
+ object_class->finalize = gdk_pixmap_impl_win32_finalize;
- g_free (GDK_DRAWABLE_WIN32DATA (pixmap));
+ drawable_class->get_size = gdk_pixmap_impl_win32_get_size;
}
-static GdkDrawable *
-gdk_win32_pixmap_alloc (void)
+static void
+gdk_pixmap_impl_win32_finalize (GObject *object)
{
- GdkDrawable *drawable;
- GdkDrawablePrivate *private;
-
- static GdkDrawableClass klass;
- static gboolean initialized = FALSE;
+ GdkPixmapImplWin32 *impl = GDK_PIXMAP_IMPL_WIN32 (object);
+ GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_WIN32 (impl)->wrapper);
- if (!initialized)
- {
- initialized = TRUE;
-
- klass = _gdk_win32_drawable_class;
- klass.destroy = gdk_win32_pixmap_destroy;
- }
+ GDK_NOTE (MISC, g_print ("gdk_pixmap_impl_win32_finalize: %#x\n",
+ GDK_PIXMAP_HBITMAP (object)));
+
+ if (!DeleteObject (GDK_PIXMAP_HBITMAP (object)))
+ WIN32_GDI_FAILED ("DeleteObject");
- drawable = gdk_drawable_alloc ();
- private = (GdkDrawablePrivate *) drawable;
+ gdk_win32_handle_table_remove (GDK_PIXMAP_HBITMAP (object));
- private->klass = &klass;
- private->klass_data = g_new (GdkDrawableWin32Data, 1);
- private->window_type = GDK_DRAWABLE_PIXMAP;
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
- return drawable;
+static void
+gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ if (width)
+ *width = GDK_PIXMAP_IMPL_WIN32 (drawable)->width;
+ if (height)
+ *height = GDK_PIXMAP_IMPL_WIN32 (drawable)->height;
}
GdkPixmap*
@@ -99,7 +137,10 @@ gdk_pixmap_new (GdkWindow *window,
gint depth)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
+ GdkDrawableImplWin32 *draw_impl;
+ GdkPixmapImplWin32 *pix_impl;
+ GdkVisual *visual;
+
struct {
BITMAPINFOHEADER bmiHeader;
union {
@@ -110,7 +151,7 @@ gdk_pixmap_new (GdkWindow *window,
} bmi;
UINT iUsage;
HDC hdc;
- GdkVisual *visual;
+
guchar *bits;
gint i;
@@ -134,24 +175,31 @@ gdk_pixmap_new (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
+ visual = gdk_drawable_get_visual (window);
+
if (depth == -1)
- depth = gdk_drawable_get_visual (window)->depth;
+ depth = visual->depth;
GDK_NOTE (MISC, g_print ("gdk_pixmap_new: %dx%dx%d\n",
width, height, depth));
- pixmap = gdk_win32_pixmap_alloc ();
- private = (GdkDrawablePrivate *) pixmap;
-
- visual = gdk_drawable_get_visual (window);
+ pixmap = g_object_new (gdk_pixmap_get_type (), NULL);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+ pix_impl->is_foreign = FALSE;
+ pix_impl->width = width;
+ pix_impl->height = height;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
- if ((hdc = GetDC (GDK_DRAWABLE_XID (window))) == NULL)
+ if ((hdc = GetDC (GDK_WINDOW_HWND (window))) == NULL)
{
WIN32_GDI_FAILED ("GetDC");
- g_free (private);
+ g_object_unref ((GObject *) pixmap);
return NULL;
}
@@ -163,11 +211,9 @@ gdk_pixmap_new (GdkWindow *window,
bmi.bmiHeader.biBitCount = 16;
else
bmi.bmiHeader.biBitCount = depth;
-#if 1
if (depth == 16)
bmi.bmiHeader.biCompression = BI_BITFIELDS;
else
-#endif
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter =
@@ -187,13 +233,13 @@ gdk_pixmap_new (GdkWindow *window,
bmi.u.bmiColors[1].rgbGreen =
bmi.u.bmiColors[1].rgbRed = 0xFF;
bmi.u.bmiColors[1].rgbReserved = 0x00;
- private->colormap = NULL;
+ draw_impl->colormap = NULL;
}
else
{
- private->colormap = ((GdkWindowPrivate *) window)->drawable.colormap;
- if (private->colormap == NULL)
- private->colormap = gdk_colormap_get_system ();
+ draw_impl->colormap = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap;
+ if (draw_impl->colormap == NULL)
+ draw_impl->colormap = gdk_colormap_get_system ();
if (depth == 8)
{
@@ -206,75 +252,28 @@ gdk_pixmap_new (GdkWindow *window,
if (depth != visual->depth)
g_warning ("gdk_pixmap_new: depth %d doesn't match display depth %d",
depth, visual->depth);
-#if 1
if (depth == 16)
{
bmi.u.bmiMasks[0] = visual->red_mask;
bmi.u.bmiMasks[1] = visual->green_mask;
bmi.u.bmiMasks[2] = visual->blue_mask;
}
-#endif
}
}
- if ((GDK_DRAWABLE_WIN32DATA (pixmap)->xid =
- CreateDIBSection (hdc, (BITMAPINFO *) &bmi,
- iUsage, (PVOID *) &bits, NULL, 0)) == NULL)
+ if ((draw_impl->handle = CreateDIBSection (hdc, (BITMAPINFO *) &bmi,
+ iUsage, (PVOID *) &bits,
+ NULL, 0)) == NULL)
{
WIN32_GDI_FAILED ("CreateDIBSection");
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
- g_free (pixmap);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
+ g_object_unref ((GObject *) pixmap);
return NULL;
}
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
-
- GDK_NOTE (MISC, g_print ("... = %#x\n", GDK_DRAWABLE_XID (pixmap)));
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
- private->width = width;
- private->height = height;
+ GDK_NOTE (MISC, g_print ("... = %#x\n", GDK_PIXMAP_HBITMAP (pixmap)));
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
-
- return pixmap;
-}
-
-GdkPixmap *
-gdk_pixmap_create_on_shared_image (GdkImage **image_return,
- GdkWindow *window,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
-
- g_return_val_if_fail (window != NULL, NULL);
-
-
- if (depth == 1)
- *image_return = gdk_image_bitmap_new (GDK_IMAGE_SHARED_PIXMAP, visual, width, height);
- else
- {
- g_return_val_if_fail (depth == visual->depth, NULL);
- *image_return = gdk_image_new (GDK_IMAGE_SHARED_PIXMAP, visual, width, height);
- }
-
- g_return_val_if_fail (*image_return != NULL, NULL);
-
- pixmap = gdk_win32_pixmap_alloc ();
- private = (GdkDrawablePrivate *) pixmap;
-
- GDK_DRAWABLE_WIN32DATA (pixmap)->xid =
- ((GdkImagePrivateWin32 *) *image_return)->ximage;
- private->colormap = ((GdkWindowPrivate *) window)->drawable.colormap;
- private->width = width;
- private->height = height;
-
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
-
- GDK_NOTE (MISC,
- g_print ("gdk_pixmap_create_on_shared_image: %dx%dx%d = %#x\n",
- width, height, depth, GDK_DRAWABLE_XID (pixmap)));
+ gdk_win32_handle_table_insert (GDK_PIXMAP_HBITMAP (pixmap), pixmap);
return pixmap;
}
@@ -321,7 +320,8 @@ gdk_bitmap_create_from_data (GdkWindow *window,
gint height)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
+ GdkDrawableImplWin32 *draw_impl;
+ GdkPixmapImplWin32 *pix_impl;
gint i, j, bpl, aligned_bpl;
guchar *bits;
@@ -332,14 +332,18 @@ gdk_bitmap_create_from_data (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return NULL;
- pixmap = gdk_win32_pixmap_alloc ();
- private = (GdkDrawablePrivate *) pixmap;
+ pixmap = g_object_new (gdk_pixmap_get_type (), NULL);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
- private->width = width;
- private->height = height;
+ pix_impl->is_foreign = FALSE;
+ pix_impl->width = width;
+ pix_impl->height = height;
+ GDK_PIXMAP_OBJECT (pixmap)->depth = 1;
bpl = ((width - 1) / 8 + 1);
aligned_bpl = ((bpl - 1) / 2 + 1) * 2;
@@ -348,16 +352,15 @@ gdk_bitmap_create_from_data (GdkWindow *window,
for (j = 0; j < bpl; j++)
bits[i*aligned_bpl + j] = mirror[(guchar) data[i*bpl + j]];
- GDK_DRAWABLE_WIN32DATA (pixmap)->xid =
- CreateBitmap (width, height, 1, 1, bits);
+ draw_impl->handle = CreateBitmap (width, height, 1, 1, bits);
GDK_NOTE (MISC, g_print ("gdk_bitmap_create_from_data: %dx%d = %#x\n",
- width, height, GDK_DRAWABLE_XID (pixmap)));
+ width, height, GDK_PIXMAP_HBITMAP (pixmap)));
g_free (bits);
- private->colormap = NULL;
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
+ draw_impl->colormap = NULL;
+ gdk_win32_handle_table_insert (GDK_PIXMAP_HBITMAP (pixmap), pixmap);
return pixmap;
}
@@ -389,605 +392,45 @@ gdk_pixmap_create_from_data (GdkWindow *window,
GDK_NOTE (MISC, g_print ("gdk_pixmap_create_from_data: %dx%dx%d = %#x\n",
width, height, depth,
- GDK_DRAWABLE_XID (result)));
- return result;
-}
-
-static gint
-gdk_pixmap_seek_string (FILE *infile,
- const gchar *str,
- gint skip_comments)
-{
- char instr[1024];
-
- while (1)
- {
- if (fscanf (infile, "%1023s", instr) != 1)
- return FALSE;
-
- if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
- {
- do
- {
- if (fscanf (infile, "%1023s", instr) != 1)
- return FALSE;
- }
- while (strcmp (instr, "*/") != 0);
- }
- else if (strcmp (instr, str) == 0)
- return TRUE;
- }
-}
-
-static gint
-gdk_pixmap_seek_char (FILE *infile,
- gchar c)
-{
- gint b, oldb;
-
- while ((b = getc(infile)) != EOF)
- {
- if (c != b && b == '/')
- {
- b = getc (infile);
- if (b == EOF)
- return FALSE;
- else if (b == '*') /* we have a comment */
- {
- b = -1;
- do
- {
- oldb = b;
- b = getc (infile);
- if (b == EOF)
- return FALSE;
- }
- while (!(oldb == '*' && b == '/'));
- }
- }
- else if (c == b)
- return TRUE;
- }
- return FALSE;
-}
-
-static gint
-gdk_pixmap_read_string (FILE *infile,
- gchar **buffer,
- guint *buffer_size)
-{
- gint c;
- guint cnt = 0, bufsiz, ret = FALSE;
- gchar *buf;
-
- buf = *buffer;
- bufsiz = *buffer_size;
- if (buf == NULL)
- {
- bufsiz = 10 * sizeof (gchar);
- buf = g_new(gchar, bufsiz);
- }
-
- do
- c = getc (infile);
- while (c != EOF && c != '"');
-
- if (c != '"')
- goto out;
-
- while ((c = getc(infile)) != EOF)
- {
- if (cnt == bufsiz)
- {
- guint new_size = bufsiz * 2;
- if (new_size > bufsiz)
- bufsiz = new_size;
- else
- goto out;
-
- buf = (gchar *) g_realloc (buf, bufsiz);
- buf[bufsiz-1] = '\0';
- }
-
- if (c != '"')
- buf[cnt++] = c;
- else
- {
- buf[cnt] = 0;
- ret = TRUE;
- break;
- }
- }
-
- out:
- buf[bufsiz-1] = '\0'; /* ensure null termination for errors */
- *buffer = buf;
- *buffer_size = bufsiz;
- return ret;
-}
-
-static gchar*
-gdk_pixmap_skip_whitespaces (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
- index++;
-
- return &buffer[index];
-}
-
-static gchar*
-gdk_pixmap_skip_string (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
- index++;
-
- return &buffer[index];
-}
-
-#define MAX_COLOR_LEN 120
-
-static gchar*
-gdk_pixmap_extract_color (gchar *buffer)
-{
- gint counter, numnames;
- gchar *ptr = NULL, ch, temp[128];
- gchar color[MAX_COLOR_LEN], *retcol;
- gint space;
-
- counter = 0;
- while (ptr == NULL)
- {
- if (buffer[counter] == 'c')
- {
- ch = buffer[counter + 1];
- if (ch == 0x20 || ch == 0x09)
- ptr = &buffer[counter + 1];
- }
- else if (buffer[counter] == 0)
- return NULL;
-
- counter++;
- }
-
- ptr = gdk_pixmap_skip_whitespaces (ptr);
-
- if (ptr[0] == 0)
- return NULL;
- else if (ptr[0] == '#')
- {
- counter = 1;
- while (ptr[counter] != 0 &&
- ((ptr[counter] >= '0' && ptr[counter] <= '9') ||
- (ptr[counter] >= 'a' && ptr[counter] <= 'f') ||
- (ptr[counter] >= 'A' && ptr[counter] <= 'F')))
- counter++;
-
- retcol = g_new (gchar, counter+1);
- strncpy (retcol, ptr, counter);
-
- retcol[counter] = 0;
-
- return retcol;
- }
-
- color[0] = 0;
- numnames = 0;
-
- space = MAX_COLOR_LEN - 1;
- while (space > 0)
- {
- sscanf (ptr, "%127s", temp);
-
- if (((gint)ptr[0] == 0) ||
- (strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) ||
- (strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0))
- {
- break;
- }
- else
- {
- if (numnames > 0)
- {
- space -= 1;
- strcat (color, " ");
- }
- strncat (color, temp, space);
- space -= MIN (space, strlen (temp));
- ptr = gdk_pixmap_skip_string (ptr);
- ptr = gdk_pixmap_skip_whitespaces (ptr);
- numnames++;
- }
- }
-
- retcol = g_strdup (color);
- return retcol;
-}
-
-
-enum buffer_op
-{
- op_header,
- op_cmap,
- op_body
-};
-
-
-static void
-gdk_xpm_destroy_notify (gpointer data)
-{
- _GdkPixmapInfo *info = (_GdkPixmapInfo *)data;
- GdkColor color;
- int i;
-
- for (i=0; i<info->ncolors; i++)
- {
- color.pixel = info->pixels[i];
- gdk_colormap_free_colors (info->colormap, &color, 1);
- }
-
- gdk_colormap_unref (info->colormap);
- g_free (info);
-}
+ GDK_PIXMAP_HBITMAP (result)));
-static GdkPixmap *
-_gdk_pixmap_create_from_xpm (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar * (*get_buf) (enum buffer_op op,
- gpointer handle),
- gpointer handle)
-{
- GdkPixmap *pixmap = NULL;
- GdkImage *image = NULL;
- GdkVisual *visual;
- GdkGC *gc = NULL;
- GdkColor tmp_color;
- gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
- gchar *buffer, pixel_str[32];
- gchar *name_buf;
- _GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
- _GdkPixmapColor *colors = NULL;
- gulong index;
- GHashTable *color_hash = NULL;
- _GdkPixmapInfo *color_info = NULL;
-
- if ((window == NULL) && (colormap == NULL))
- g_warning ("Creating pixmap from xpm with NULL window and colormap");
-
- if (window == NULL)
- window = gdk_parent_root;
-
- if (colormap == NULL)
- {
- colormap = gdk_drawable_get_colormap (window);
- visual = gdk_drawable_get_visual (window);
- }
- else
- visual = ((GdkColormapPrivate *)colormap)->visual;
-
- buffer = (*get_buf) (op_header, handle);
- if (buffer == NULL)
- return NULL;
-
- sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
- if (cpp >= 32)
- {
- g_warning ("Pixmap has more than 31 characters per color");
- return NULL;
- }
-
- color_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- if (transparent_color == NULL)
- {
- gdk_color_white (colormap, &tmp_color);
- transparent_color = &tmp_color;
- }
-
- /* For pseudo-color and grayscale visuals, we have to remember
- * the colors we allocated, so we can free them later.
- */
- if ((visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
- (visual->type == GDK_VISUAL_GRAYSCALE))
- {
- color_info = g_malloc (sizeof (_GdkPixmapInfo) +
- sizeof(gulong) * (num_cols - 1));
- color_info->ncolors = num_cols;
- color_info->colormap = colormap;
- gdk_colormap_ref (colormap);
- }
-
- name_buf = g_new (gchar, num_cols * (cpp+1));
- colors = g_new (_GdkPixmapColor, num_cols);
-
- for (cnt = 0; cnt < num_cols; cnt++)
- {
- gchar *color_name;
-
- buffer = (*get_buf) (op_cmap, handle);
- if (buffer == NULL)
- goto error;
-
- color = &colors[cnt];
- color->color_string = &name_buf [cnt * (cpp + 1)];
- strncpy (color->color_string, buffer, cpp);
- color->color_string[cpp] = 0;
- buffer += strlen (color->color_string);
- color->transparent = FALSE;
-
- color_name = gdk_pixmap_extract_color (buffer);
-
- if (color_name == NULL ||
- gdk_color_parse (color_name, &color->color) == FALSE)
- {
- color->color = *transparent_color;
- color->transparent = TRUE;
- }
-
- g_free (color_name);
-
- /* FIXME: The remaining slowness appears to happen in this
- function. */
- gdk_color_alloc (colormap, &color->color);
-
- if (color_info)
- color_info->pixels[cnt] = color->color.pixel;
-
- g_hash_table_insert (color_hash, color->color_string, color);
- if (cnt == 0)
- fallbackcolor = color;
- }
-
- index = 0;
- image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
-
- if (mask)
- {
- /* The pixmap mask is just a bits pattern.
- * Color 0 is used for background and 1 for foreground.
- * We don't care about the colormap, we just need 0 and 1.
- */
- GdkColor mask_pattern;
-
- *mask = gdk_pixmap_new (window, width, height, 1);
- gc = gdk_gc_new (*mask);
-
- mask_pattern.pixel = 0;
- gdk_gc_set_foreground (gc, &mask_pattern);
- gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
-
- mask_pattern.pixel = 1;
- gdk_gc_set_foreground (gc, &mask_pattern);
- }
-
- wbytes = width * cpp;
- for (ycnt = 0; ycnt < height; ycnt++)
- {
- buffer = (*get_buf) (op_body, handle);
-
- /* FIXME: this slows things down a little - it could be
- * integrated into the strncpy below, perhaps. OTOH, strlen
- * is fast.
- */
- if ((buffer == NULL) || strlen (buffer) < wbytes)
- continue;
-
- for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++)
- {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
- ns = 0;
-
- color = g_hash_table_lookup (color_hash, pixel_str);
-
- if (!color) /* screwed up XPM file */
- color = fallbackcolor;
-
- gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
-
- if (mask && color->transparent)
- {
- if (cnt < xcnt)
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- cnt = xcnt + 1;
- }
- }
-
- if (mask && (cnt < xcnt))
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- }
-
- error:
-
- if (mask)
- gdk_gc_unref (gc);
-
- if (image != NULL)
- {
- pixmap = gdk_pixmap_new (window, width, height, visual->depth);
-
- if (color_info)
- gdk_drawable_set_data (pixmap, "gdk-xpm", color_info,
- gdk_xpm_destroy_notify);
-
- gc = gdk_gc_new (pixmap);
- gdk_gc_set_foreground (gc, transparent_color);
- gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
- gdk_gc_unref (gc);
- gdk_image_unref (image);
- }
- else if (color_info)
- gdk_xpm_destroy_notify (color_info);
-
- if (color_hash != NULL)
- g_hash_table_destroy (color_hash);
-
- if (colors != NULL)
- g_free (colors);
-
- if (name_buf != NULL)
- g_free (name_buf);
-
- return pixmap;
-}
-
-
-struct file_handle
-{
- FILE *infile;
- gchar *buffer;
- guint buffer_size;
-};
-
-
-static gchar *
-file_buffer (enum buffer_op op, gpointer handle)
-{
- struct file_handle *h = handle;
-
- switch (op)
- {
- case op_header:
- if (gdk_pixmap_seek_string (h->infile, "XPM", FALSE) != TRUE)
- break;
-
- if (gdk_pixmap_seek_char (h->infile,'{') != TRUE)
- break;
- /* Fall through to the next gdk_pixmap_seek_char. */
-
- case op_cmap:
- gdk_pixmap_seek_char (h->infile, '"');
- fseek (h->infile, -1, SEEK_CUR);
- /* Fall through to the gdk_pixmap_read_string. */
-
- case op_body:
- gdk_pixmap_read_string (h->infile, &h->buffer, &h->buffer_size);
- return h->buffer;
- }
- return 0;
-}
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- struct file_handle h;
- GdkPixmap *pixmap = NULL;
-
- memset (&h, 0, sizeof (h));
- h.infile = fopen (filename, "rb");
- if (h.infile != NULL)
- {
- pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
- transparent_color,
- file_buffer, &h);
- fclose (h.infile);
- g_free (h.buffer);
- }
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
- transparent_color, filename);
-}
-
-struct mem_handle
-{
- gchar **data;
- int offset;
-};
-
-
-static gchar *
-mem_buffer (enum buffer_op op, gpointer handle)
-{
- struct mem_handle *h = handle;
- switch (op)
- {
- case op_header:
- case op_cmap:
- case op_body:
- if (h->data[h->offset])
- return h->data[h->offset ++];
- }
- return 0;
-}
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- struct mem_handle h;
- GdkPixmap *pixmap = NULL;
-
- memset (&h, 0, sizeof (h));
- h.data = data;
- pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
- transparent_color,
- mem_buffer, &h);
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm_d (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
- transparent_color, data);
+ return result;
}
GdkPixmap*
-gdk_pixmap_foreign_new (guint32 anid)
+gdk_pixmap_foreign_new (GdkNativeWindow anid)
{
GdkPixmap *pixmap;
- GdkDrawablePrivate *private;
- HBITMAP xpixmap;
+ GdkDrawableImplWin32 *draw_impl;
+ GdkPixmapImplWin32 *pix_impl;
+ HBITMAP hbitmap;
SIZE size;
unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
- /* check to make sure we were passed something at
- least a little sane */
- g_return_val_if_fail((anid != 0), NULL);
+ /* check to make sure we were passed a HBITMAP */
+ g_return_val_if_fail(GetObjectType ((HGDIOBJ) anid) == OBJ_BITMAP, NULL);
/* set the pixmap to the passed in value */
- xpixmap = (HBITMAP) anid;
+ hbitmap = (HBITMAP) anid;
- /* get information about the BITMAP to fill in the structure for
+ /* get information about the bitmap to fill in the structure for
the gdk window */
- GetBitmapDimensionEx (xpixmap, &size);
+ GetBitmapDimensionEx (hbitmap, &size);
w_ret = size.cx;
h_ret = size.cy;
/* allocate a new gdk pixmap */
- pixmap = gdk_win32_pixmap_alloc ();
- private = (GdkDrawablePrivate *) pixmap;
-
- GDK_DRAWABLE_WIN32DATA (pixmap)->xid = xpixmap;
- private->colormap = NULL;
- private->width = w_ret;
- private->height = h_ret;
+ pixmap = g_object_new (gdk_pixmap_get_type (), NULL);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ pix_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+ draw_impl->handle = hbitmap;
+ draw_impl->colormap = NULL;
+ pix_impl->width = w_ret;
+ pix_impl->height = h_ret;
- gdk_xid_table_insert(&GDK_DRAWABLE_XID (pixmap), pixmap);
+ gdk_win32_handle_table_insert (GDK_PIXMAP_HBITMAP (pixmap), pixmap);
return pixmap;
}
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 759b6775c..40a0d9399 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -30,21 +30,15 @@
#include <gdk/gdkprivate.h>
#include "gdkwin32.h"
-void gdk_xid_table_insert (HANDLE *hnd,
- gpointer data);
-void gdk_xid_table_remove (HANDLE xid);
+void gdk_win32_handle_table_insert (HANDLE handle,
+ gpointer data);
+void gdk_win32_handle_table_remove (HANDLE handle);
GdkGC * _gdk_win32_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
-COLORREF gdk_colormap_color (GdkColormapPrivateWin32 *colormap_private,
- gulong pixel);
-HDC gdk_gc_predraw (GdkDrawable *drawable,
- GdkGCWin32 *gcwin32,
- GdkGCValuesMask usage);
-void gdk_gc_postdraw (GdkDrawable *drawable,
- GdkGCWin32 *gcwin32,
- GdkGCValuesMask usage);
+COLORREF gdk_colormap_color (GdkColormap *colormap,
+ gulong pixel);
HRGN BitmapToRegion (HBITMAP hBmp);
gchar *gdk_font_full_name_get (GdkFont *font);
@@ -95,7 +89,6 @@ void gdk_win32_api_failed (const gchar *where,
extern LRESULT CALLBACK gdk_window_procedure (HWND, UINT, WPARAM, LPARAM);
-extern GdkDrawableClass _gdk_win32_drawable_class;
extern HWND gdk_root_window;
extern gboolean gdk_event_func_from_window_proc;
@@ -111,6 +104,8 @@ extern GdkAtom gdk_win32_dropfiles_atom;
extern GdkAtom gdk_ole2_dnd_atom;
extern DWORD windows_version;
-#define IS_WIN_NT(dwVersion) (dwVersion < 0x80000000)
+#define IS_WIN_NT() (windows_version < 0x80000000)
+
+extern gint gdk_input_ignore_wintab;
#endif /* __GDK_PRIVATE_WIN32_H__ */
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 2cc5b52f3..6a7c7de77 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -32,6 +32,8 @@
#include "gdkselection.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkdrawable-win32.h"
+#include "gdkwindow-win32.h"
GdkAtom
gdk_atom_intern (const gchar *atom_name,
@@ -122,7 +124,7 @@ gdk_property_get (GdkWindow *window,
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return FALSE;
g_warning ("gdk_property_get: Not implemented");
@@ -147,14 +149,14 @@ gdk_property_change (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
GDK_NOTE (MISC,
(prop_name = gdk_atom_name (property),
type_name = gdk_atom_name (type),
g_print ("gdk_property_change: %#x %#x (%s) %#x (%s) %s %d*%d bytes %.10s\n",
- GDK_DRAWABLE_XID (window), property, prop_name,
+ GDK_WINDOW_HWND (window), property, prop_name,
type, type_name,
(mode == GDK_PROP_MODE_REPLACE ? "REPLACE" :
(mode == GDK_PROP_MODE_PREPEND ? "PREPEND" :
@@ -175,8 +177,8 @@ gdk_property_change (GdkWindow *window,
length++;
#if 1
GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n",
- GDK_DRAWABLE_XID (window)));
- if (!OpenClipboard (GDK_DRAWABLE_XID (window)))
+ GDK_WINDOW_HWND (window)));
+ if (!OpenClipboard (GDK_WINDOW_HWND (window)))
{
WIN32_API_FAILED ("OpenClipboard");
return;
@@ -221,7 +223,7 @@ gdk_property_delete (GdkWindow *window,
GDK_NOTE (MISC,
(prop_name = gdk_atom_name (property),
g_print ("gdk_property_delete: %#x %#x (%s)\n",
- (window ? GDK_DRAWABLE_XID (window) : 0),
+ (window ? GDK_WINDOW_HWND (window) : 0),
property, prop_name),
g_free (prop_name)));
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index 7f3bb9f09..e7f207e0e 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -33,6 +33,7 @@
#include "gdkinternals.h"
#include "gdkprivate.h"
#include "gdkprivate-win32.h"
+#include "gdkwindow-win32.h"
/* We emulate the GDK_SELECTION window properties by storing
* it's data in a per-window hashtable.
@@ -63,18 +64,18 @@ gdk_sel_prop_store (GdkWindow *owner,
{
GdkSelProp *prop;
- prop = g_hash_table_lookup (sel_prop_table, &GDK_DRAWABLE_XID (owner));
+ prop = g_hash_table_lookup (sel_prop_table, &GDK_WINDOW_HWND (owner));
if (prop != NULL)
{
g_free (prop->data);
- g_hash_table_remove (sel_prop_table, &GDK_DRAWABLE_XID (owner));
+ g_hash_table_remove (sel_prop_table, &GDK_WINDOW_HWND (owner));
}
prop = g_new (GdkSelProp, 1);
prop->data = data;
prop->length = length;
prop->format = format;
prop->type = type;
- g_hash_table_insert (sel_prop_table, &GDK_DRAWABLE_XID (owner), prop);
+ g_hash_table_insert (sel_prop_table, &GDK_WINDOW_HWND (owner), prop);
}
gboolean
@@ -89,7 +90,7 @@ gdk_selection_owner_set (GdkWindow *owner,
GDK_NOTE (MISC,
(sel_name = gdk_atom_name (selection),
g_print ("gdk_selection_owner_set: %#x %#x (%s)\n",
- (owner ? GDK_DRAWABLE_XID (owner) : 0),
+ (owner ? GDK_WINDOW_HWND (owner) : 0),
selection, sel_name),
g_free (sel_name)));
@@ -97,7 +98,7 @@ gdk_selection_owner_set (GdkWindow *owner,
return FALSE;
if (owner != NULL)
- xwindow = GDK_DRAWABLE_XID (owner);
+ xwindow = GDK_WINDOW_HWND (owner);
else
xwindow = NULL;
@@ -153,7 +154,7 @@ gdk_selection_owner_get (GdkAtom selection)
if (selection != gdk_clipboard_atom)
window = NULL;
else
- window = gdk_window_lookup (GetClipboardOwner ());
+ window = gdk_win32_handle_table_lookup (GetClipboardOwner ());
#endif
@@ -161,7 +162,7 @@ gdk_selection_owner_get (GdkAtom selection)
(sel_name = gdk_atom_name (selection),
g_print ("gdk_selection_owner_get: %#x (%s) = %#x\n",
selection, sel_name,
- (window ? GDK_DRAWABLE_XID (window) : 0)),
+ (window ? GDK_WINDOW_HWND (window) : 0)),
g_free (sel_name)));
return window;
@@ -180,14 +181,14 @@ gdk_selection_convert (GdkWindow *requestor,
gchar *sel_name, *tgt_name;
g_return_if_fail (requestor != NULL);
- if (GDK_DRAWABLE_DESTROYED (requestor))
+ if (GDK_WINDOW_DESTROYED (requestor))
return;
GDK_NOTE (MISC,
(sel_name = gdk_atom_name (selection),
tgt_name = gdk_atom_name (target),
g_print ("gdk_selection_convert: %#x %#x (%s) %#x (%s)\n",
- GDK_DRAWABLE_XID (requestor), selection, sel_name, target, tgt_name),
+ GDK_WINDOW_HWND (requestor), selection, sel_name, target, tgt_name),
g_free (sel_name),
g_free (tgt_name)));
@@ -198,8 +199,8 @@ gdk_selection_convert (GdkWindow *requestor,
* and store it for later.
*/
GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n",
- GDK_DRAWABLE_XID (requestor)));
- if (!OpenClipboard (GDK_DRAWABLE_XID (requestor)))
+ GDK_WINDOW_HWND (requestor)));
+ if (!OpenClipboard (GDK_WINDOW_HWND (requestor)))
{
WIN32_API_FAILED ("OpenClipboard");
return;
@@ -250,7 +251,7 @@ gdk_selection_convert (GdkWindow *requestor,
/* Send ourselves an ersatz selection notify message so that we actually
* fetch the data.
*/
- SendMessage (GDK_DRAWABLE_XID (requestor), gdk_selection_notify_msg, selection, target);
+ SendMessage (GDK_WINDOW_HWND (requestor), gdk_selection_notify_msg, selection, target);
}
else if (selection == gdk_win32_dropfiles_atom)
{
@@ -261,16 +262,16 @@ gdk_selection_convert (GdkWindow *requestor,
GdkSelProp *prop;
prop = g_hash_table_lookup (sel_prop_table,
- &GDK_DRAWABLE_XID (gdk_parent_root));
+ &GDK_WINDOW_HWND (gdk_parent_root));
if (prop != NULL)
{
g_hash_table_remove (sel_prop_table,
- &GDK_DRAWABLE_XID (gdk_parent_root));
+ &GDK_WINDOW_HWND (gdk_parent_root));
gdk_sel_prop_store (requestor, prop->type, prop->format,
prop->data, prop->length);
g_free (prop);
- SendMessage (GDK_DRAWABLE_XID (requestor), gdk_selection_notify_msg, selection, target);
+ SendMessage (GDK_WINDOW_HWND (requestor), gdk_selection_notify_msg, selection, target);
}
}
else
@@ -290,13 +291,13 @@ gdk_selection_property_get (GdkWindow *requestor,
g_return_val_if_fail (requestor != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
- if (GDK_DRAWABLE_DESTROYED (requestor))
+ if (GDK_WINDOW_DESTROYED (requestor))
return 0;
GDK_NOTE (MISC, g_print ("gdk_selection_property_get: %#x\n",
- GDK_DRAWABLE_XID (requestor)));
+ GDK_WINDOW_HWND (requestor)));
- prop = g_hash_table_lookup (sel_prop_table, &GDK_DRAWABLE_XID (requestor));
+ prop = g_hash_table_lookup (sel_prop_table, &GDK_WINDOW_HWND (requestor));
if (prop == NULL)
{
@@ -319,11 +320,11 @@ gdk_selection_property_delete (GdkWindow *window)
{
GdkSelProp *prop;
- prop = g_hash_table_lookup (sel_prop_table, &GDK_DRAWABLE_XID (window));
+ prop = g_hash_table_lookup (sel_prop_table, &GDK_WINDOW_HWND (window));
if (prop != NULL)
{
g_free (prop->data);
- g_hash_table_remove (sel_prop_table, &GDK_DRAWABLE_XID (window));
+ g_hash_table_remove (sel_prop_table, &GDK_WINDOW_HWND (window));
}
else
g_warning ("huh?");
diff --git a/gdk/win32/gdkwin32.h b/gdk/win32/gdkwin32.h
index cb06d284b..50b6ca306 100644
--- a/gdk/win32/gdkwin32.h
+++ b/gdk/win32/gdkwin32.h
@@ -188,7 +188,6 @@ typedef struct {
unsigned long base_pixel;
} XStandardColormap;
-typedef struct _GdkGCWin32Data GdkGCWin32Data;
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
@@ -295,10 +294,11 @@ GType gdk_gc_win32_get_type (void);
#define GDK_ROOT_WINDOW() ((guint32) HWND_DESKTOP)
#define GDK_ROOT_PARENT() ((GdkWindow *) gdk_parent_root)
#define GDK_DISPLAY() NULL
-#define GDK_WINDOW_HWND(win) (HWND) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
-#define GDK_PIXMAP_HBITMAP(win) (HBITMAP) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)win)->impl)->handle)
-#define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? ((HGDIOBJ) GDK_WINDOW_HWND (win)) : ((HGDIOBJ) GDK_PIXMAP_HBITMAP (win)))
+#define GDK_WINDOW_HWND(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
+#define GDK_PIXMAP_HBITMAP(pixmap) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)pixmap)->impl)->handle)
+#define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? (GDK_WINDOW_HWND (win)) : (GDK_PIXMAP_HBITMAP (win)))
#define GDK_IMAGE_HBM(image) (((GdkImagePrivateWin32 *) GDK_IMAGE (image)->windowing_data)->hbm)
+#define GDK_COLORMAP_PRIVATE_DATA(cmap) ((GdkColormapPrivateWin32 *) cmap->windowing_data)
#define GDK_COLORMAP_WIN32COLORMAP(cmap) (((GdkColormapPrivateWin32 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap)
#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
@@ -310,7 +310,7 @@ GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
GdkWindow *gdk_window_foreign_new (guint32 anid);
/* Return the Gdk* for a particular HANDLE */
-gpointer gdk_xid_table_lookup (HANDLE handle);
+gpointer gdk_win32_handle_table_lookup (HANDLE handle);
/* Return a device context to draw in a drawable, given a GDK GC,
* and a mask indicating which GC values might be used (for efficiency,
diff --git a/gdk/win32/gdkwin32id.c b/gdk/win32/gdkwin32id.c
index a0a6a556f..dfd796bb1 100644
--- a/gdk/win32/gdkwin32id.c
+++ b/gdk/win32/gdkwin32id.c
@@ -24,65 +24,56 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include "config.h"
-
-#include <stdio.h>
#include <gdk/gdk.h>
#include "gdkprivate-win32.h"
-static guint gdk_xid_hash (HANDLE *xid);
-static gint gdk_xid_compare (HANDLE *a,
- HANDLE *b);
-
+static GHashTable *handle_ht = NULL;
-static GHashTable *xid_ht = NULL;
+static guint
+gdk_handle_hash (HANDLE *handle)
+{
+ return (guint) *handle;
+}
+static gint
+gdk_handle_compare (HANDLE *a,
+ HANDLE *b)
+{
+ return (*a == *b);
+}
+/* Note that the handle is passed by value to this function! */
void
-gdk_xid_table_insert (HANDLE *xid,
- gpointer data)
+gdk_win32_handle_table_insert (HANDLE handle,
+ gpointer data)
{
- g_return_if_fail (xid != NULL);
+ g_return_if_fail (handle != NULL);
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
+ if (!handle_ht)
+ handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash,
+ (GCompareFunc) gdk_handle_compare);
- g_hash_table_insert (xid_ht, xid, data);
+ g_hash_table_insert (handle_ht, &handle, data);
}
void
-gdk_xid_table_remove (HANDLE xid)
+gdk_win32_handle_table_remove (HANDLE handle)
{
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
+ if (!handle_ht)
+ handle_ht = g_hash_table_new ((GHashFunc) gdk_handle_hash,
+ (GCompareFunc) gdk_handle_compare);
- g_hash_table_remove (xid_ht, &xid);
+ g_hash_table_remove (handle_ht, &handle);
}
gpointer
-gdk_xid_table_lookup (HANDLE xid)
+gdk_win32_handle_table_lookup (HANDLE handle)
{
gpointer data = NULL;
- if (xid_ht)
- data = g_hash_table_lookup (xid_ht, &xid);
+ if (handle_ht)
+ data = g_hash_table_lookup (handle_ht, &handle);
return data;
}
-
-
-static guint
-gdk_xid_hash (HANDLE *xid)
-{
- return (guint) *xid;
-}
-
-static gint
-gdk_xid_compare (HANDLE *a,
- HANDLE *b)
-{
- return (*a == *b);
-}
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 919bde2e6..fd72bc5fb 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -25,135 +25,233 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include "config.h"
-
#include <stdlib.h>
-#include <stdio.h>
#include "gdkevents.h"
#include "gdkpixmap.h"
#include "gdkwindow.h"
#include "gdkinternals.h"
-#include "gdkprivate.h"
#include "gdkprivate-win32.h"
-#include "gdkinputprivate.h"
-#include "gdkwin32.h"
+#include "gdkwindow-win32.h"
+#include "gdkpixmap-win32.h"
static gboolean gdk_window_gravity_works (void);
static void gdk_window_set_static_win_gravity (GdkWindow *window,
gboolean on);
-/* The Win API function AdjustWindowRect may return negative values
- * resulting in obscured title bars. This helper function is coreccting it.
- */
-BOOL
-SafeAdjustWindowRectEx (RECT* lpRect,
- DWORD dwStyle,
- BOOL bMenu,
- DWORD dwExStyle)
+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 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);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_window_impl_win32_get_type (void)
{
- if (!AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle))
- {
- WIN32_API_FAILED ("AdjustWindowRectEx");
- return FALSE;
- }
- if (lpRect->left < 0)
- {
- lpRect->right -= lpRect->left;
- lpRect->left = 0;
- }
- if (lpRect->top < 0)
+ static GType object_type = 0;
+
+ if (!object_type)
{
- lpRect->bottom -= lpRect->top;
- lpRect->top = 0;
+ static const GTypeInfo object_info =
+ {
+ sizeof (GdkWindowImplWin32Class),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gdk_window_impl_win32_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkWindowImplWin32),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gdk_window_impl_win32_init,
+ };
+
+ object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32,
+ "GdkWindowImplWin32",
+ &object_info);
}
- return TRUE;
+
+ return object_type;
+}
+
+GType
+_gdk_window_impl_get_type (void)
+{
+ return gdk_window_impl_win32_get_type ();
}
-GdkDrawableClass _gdk_windowing_window_class;
+static void
+gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
+{
+ impl->width = 1;
+ impl->height = 1;
+
+ impl->event_mask = 0;
+ impl->hcursor = NULL;
+ impl->hint_flags = 0;
+ impl->extension_events_selected = FALSE;
+ impl->input_locale = GetKeyboardLayout (0);
+ TranslateCharsetInfo ((DWORD FAR *) GetACP (), &impl->charset_info,
+ TCI_SRCCODEPAGE);
+}
static void
-gdk_win32_window_destroy (GdkDrawable *drawable)
+gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
{
- if (!GDK_DRAWABLE_DESTROYED (drawable))
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_window_impl_win32_finalize;
+
+ 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;
+}
+
+static void
+gdk_window_impl_win32_finalize (GObject *object)
+{
+ GdkWindowObject *wrapper;
+ GdkDrawableImplWin32 *draw_impl;
+ GdkWindowImplWin32 *window_impl;
+
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (object));
+
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (object);
+ window_impl = GDK_WINDOW_IMPL_WIN32 (object);
+
+ wrapper = (GdkWindowObject*) draw_impl->wrapper;
+
+ if (!GDK_WINDOW_DESTROYED (wrapper))
{
- if (GDK_DRAWABLE_TYPE (drawable) != GDK_WINDOW_FOREIGN)
- {
- g_warning ("losing last reference to undestroyed window");
- _gdk_window_destroy (drawable, FALSE);
- }
- else
- /* We use TRUE here, to keep us from actually calling
- * DestroyWindow() on the window
- */
- _gdk_window_destroy (drawable, TRUE);
-
- gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable));
+ gdk_win32_handle_table_remove (draw_impl->handle);
}
- if (GDK_WINDOW_WIN32DATA (drawable)->xcursor != NULL)
- DestroyCursor (GDK_WINDOW_WIN32DATA (drawable)->xcursor);
+ if (window_impl->hcursor != NULL)
+ {
+ DestroyCursor (window_impl->hcursor);
+ window_impl->hcursor = NULL;
+ }
- g_free (GDK_DRAWABLE_WIN32DATA (drawable));
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GdkWindow *
-gdk_win32_window_alloc (void)
+static GdkColormap*
+gdk_window_impl_win32_get_colormap (GdkDrawable *drawable)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
+ GdkDrawableImplWin32 *drawable_impl;
+ GdkWindowImplWin32 *window_impl;
- static gboolean initialized = FALSE;
+ g_return_val_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable), NULL);
+
+ drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
+ window_impl = GDK_WINDOW_IMPL_WIN32 (drawable);
- if (!initialized)
+ if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
+ drawable_impl->colormap == NULL)
{
- initialized = TRUE;
-
- _gdk_windowing_window_class = _gdk_win32_drawable_class;
- _gdk_win32_drawable_class.destroy = gdk_win32_window_destroy;
+ g_assert_not_reached ();
}
+
+ return drawable_impl->colormap;
+}
- window = _gdk_window_alloc ();
- private = (GdkWindowPrivate *) window;
+static void
+gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
+ GdkColormap *cmap)
+{
+ GdkWindowImplWin32 *impl;
+ GdkDrawableImplWin32 *draw_impl;
+
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable));
+ g_return_if_fail (gdk_colormap_get_visual (cmap) != gdk_drawable_get_visual (drawable));
- private->drawable.klass = &_gdk_windowing_window_class;
- private->drawable.klass_data = g_new (GdkWindowWin32Data, 1);
+ impl = GDK_WINDOW_IMPL_WIN32 (drawable);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
- GDK_WINDOW_WIN32DATA (window)->event_mask = 0;
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_NORMAL;
- GDK_WINDOW_WIN32DATA (window)->xcursor = NULL;
- GDK_WINDOW_WIN32DATA (window)->hint_flags = 0;
- GDK_WINDOW_WIN32DATA (window)->extension_events_selected = FALSE;
+ GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
- GDK_WINDOW_WIN32DATA (window)->input_locale = GetKeyboardLayout (0);
- TranslateCharsetInfo ((DWORD FAR *) GetACP (),
- &GDK_WINDOW_WIN32DATA (window)->charset_info,
- TCI_SRCCODEPAGE);
+ /* XXX */
- return window;
+}
+
+static void
+gdk_window_impl_win32_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height)
+{
+ g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable));
+
+ if (width)
+ *width = GDK_WINDOW_IMPL_WIN32 (drawable)->width;
+ if (height)
+ *height = GDK_WINDOW_IMPL_WIN32 (drawable)->height;
}
void
-gdk_window_init (void)
+_gdk_windowing_window_init (void)
{
- GdkWindowPrivate *private;
- RECT r;
+ GdkWindowObject *private;
+ GdkWindowImplWin32 *impl;
+ GdkDrawableImplWin32 *draw_impl;
+ RECT rect;
guint width;
guint height;
- SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
- width = r.right - r.left;
- height = r.bottom - r.top;
-
- gdk_parent_root = gdk_win32_window_alloc ();
- private = (GdkWindowPrivate *) gdk_parent_root;
+ g_assert (gdk_parent_root == NULL);
+
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+
+ gdk_parent_root = g_object_new (GDK_TYPE_WINDOW, NULL);
+ private = (GdkWindowObject *)gdk_parent_root;
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
- GDK_DRAWABLE_WIN32DATA (gdk_parent_root)->xid = gdk_root_window;
- private->drawable.window_type = GDK_WINDOW_ROOT;
- private->drawable.width = width;
- private->drawable.height = height;
+ draw_impl->handle = gdk_root_window;
+ draw_impl->wrapper = GDK_DRAWABLE (private);
+
+ private->window_type = GDK_WINDOW_ROOT;
+ private->depth = gdk_visual_get_system ()->depth;
+ impl->width = width;
+ impl->height = height;
- gdk_xid_table_insert (&gdk_root_window, gdk_parent_root);
+ gdk_win32_handle_table_insert (gdk_root_window, gdk_parent_root);
+}
+
+/* The Win API function AdjustWindowRect may return negative values
+ * resulting in obscured title bars. This helper function is coreccting it.
+ */
+BOOL
+SafeAdjustWindowRectEx (RECT* lpRect,
+ DWORD dwStyle,
+ BOOL bMenu,
+ DWORD dwExStyle)
+{
+ if (!AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle))
+ {
+ WIN32_API_FAILED ("AdjustWindowRectEx");
+ return FALSE;
+ }
+ if (lpRect->left < 0)
+ {
+ lpRect->right -= lpRect->left;
+ lpRect->left = 0;
+ }
+ if (lpRect->top < 0)
+ {
+ lpRect->bottom -= lpRect->top;
+ lpRect->top = 0;
+ }
+ return TRUE;
}
/* RegisterGdkClass
@@ -164,7 +262,7 @@ gdk_window_init (void)
* get its own class
*/
ATOM
-RegisterGdkClass (GdkDrawableType wtype)
+RegisterGdkClass (GdkWindowType wtype)
{
static ATOM klassTOPLEVEL = 0;
static ATOM klassDIALOG = 0;
@@ -216,53 +314,54 @@ RegisterGdkClass (GdkDrawableType wtype)
switch (wtype)
{
- case GDK_WINDOW_TOPLEVEL:
- if (0 == klassTOPLEVEL)
+ case GDK_WINDOW_TOPLEVEL:
+ if (0 == klassTOPLEVEL)
{
wcl.lpszClassName = "gdkWindowToplevel";
-
+
ONCE_PER_CLASS();
klassTOPLEVEL = RegisterClassEx (&wcl);
}
- klass = klassTOPLEVEL;
- break;
+ klass = klassTOPLEVEL;
+ break;
+
case GDK_WINDOW_CHILD:
if (0 == klassCHILD)
- {
- wcl.lpszClassName = "gdkWindowChild";
-
- wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
- ONCE_PER_CLASS();
- klassCHILD = RegisterClassEx (&wcl);
- }
+ {
+ wcl.lpszClassName = "gdkWindowChild";
+
+ wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
+ ONCE_PER_CLASS();
+ klassCHILD = RegisterClassEx (&wcl);
+ }
klass = klassCHILD;
break;
- case GDK_WINDOW_DIALOG:
- if (0 == klassDIALOG)
+
+ case GDK_WINDOW_DIALOG:
+ if (0 == klassDIALOG)
{
wcl.lpszClassName = "gdkWindowDialog";
wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS();
klassDIALOG = RegisterClassEx (&wcl);
}
- klass = klassDIALOG;
- break;
- case GDK_WINDOW_TEMP:
- if (0 == klassTEMP)
+ klass = klassDIALOG;
+ break;
+
+ case GDK_WINDOW_TEMP:
+ if (0 == klassTEMP)
{
wcl.lpszClassName = "gdkWindowTemp";
wcl.style |= CS_SAVEBITS;
ONCE_PER_CLASS();
klassTEMP = RegisterClassEx (&wcl);
}
- klass = klassTEMP;
- break;
- case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
- case GDK_DRAWABLE_PIXMAP:
- g_error ("cannot make windows of type GDK_DRAWABLE_PIXMAP (use gdk_pixmap_new)");
- break;
+ klass = klassTEMP;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
}
if (klass == 0)
@@ -279,14 +378,19 @@ gdk_window_new (GdkWindow *parent,
gint attributes_mask)
{
GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
+ GdkWindowObject *private;
+ GdkWindowObject *parent_private;
+ GdkWindowImplWin32 *impl;
+ GdkDrawableImplWin32 *draw_impl;
+
GdkVisual *visual;
- HANDLE xparent;
- Visual *xvisual;
+
+ HANDLE hparent;
ATOM klass = 0;
DWORD dwStyle, dwExStyle;
RECT rect;
+ Visual *xvisual;
+
int width, height;
int x, y;
char *title;
@@ -300,24 +404,44 @@ gdk_window_new (GdkWindow *parent,
if (!parent)
parent = gdk_parent_root;
- parent_private = (GdkWindowPrivate*) parent;
- if (GDK_DRAWABLE_DESTROYED (parent))
+ g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
+
+ parent_private = (GdkWindowObject*) parent;
+ if (GDK_WINDOW_DESTROYED (parent))
return NULL;
+
+ hparent = GDK_WINDOW_HWND (parent);
- xparent = GDK_DRAWABLE_XID (parent);
-
- window = gdk_win32_window_alloc ();
- private = (GdkWindowPrivate *)window;
+ window = g_object_new (GDK_TYPE_WINDOW, NULL);
+ private = (GdkWindowObject *)window;
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (window);
- private->parent = parent;
+ private->parent = (GdkWindowObject *)parent;
- private->x = (attributes_mask & GDK_WA_X) ? attributes->x : 0;
- private->y = (attributes_mask & GDK_WA_Y) ? attributes->y : 0;
+ if (attributes_mask & GDK_WA_X)
+ x = attributes->x;
+ else
+ x = CW_USEDEFAULT;
+
+ if (attributes_mask & GDK_WA_Y)
+ y = attributes->y;
+ else if (attributes_mask & GDK_WA_X)
+ y = 100; /* ??? We must put it somewhere... */
+ else
+ y = 0; /* x is CW_USEDEFAULT, y doesn't matter then */
+
+ private->x = x;
+ private->y = y;
+ impl->width = (attributes->width > 1) ? (attributes->width) : (1);
+ impl->height = (attributes->height > 1) ? (attributes->height) : (1);
+ impl->extension_events_selected = FALSE;
+ private->window_type = attributes->window_type;
- private->drawable.width = (attributes->width > 1) ? (attributes->width) : (1);
- private->drawable.height = (attributes->height > 1) ? (attributes->height) : (1);
- private->drawable.window_type = attributes->window_type;
- GDK_WINDOW_WIN32DATA (window)->extension_events_selected = FALSE;
+ _gdk_window_init_position (GDK_WINDOW (private));
+ if (impl->position_info.big)
+ private->guffaw_gravity = TRUE;
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
@@ -332,7 +456,7 @@ gdk_window_new (GdkWindow *parent,
if (!title)
title = "GDK client window";
- GDK_WINDOW_WIN32DATA (window)->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
+ impl->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
if (parent_private && parent_private->guffaw_gravity)
{
@@ -342,65 +466,73 @@ gdk_window_new (GdkWindow *parent,
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
dwExStyle = 0;
+
+ private->input_only = FALSE;
+ private->depth = visual->depth;
+
if (attributes_mask & GDK_WA_COLORMAP)
- private->drawable.colormap = attributes->colormap;
+ {
+ draw_impl->colormap = attributes->colormap;
+ gdk_colormap_ref (attributes->colormap);
+ }
else
- private->drawable.colormap = gdk_colormap_get_system ();
+ {
+ if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
+ {
+ draw_impl->colormap =
+ gdk_colormap_get_system ();
+ gdk_colormap_ref (draw_impl->colormap);
+ }
+ else
+ {
+ draw_impl->colormap =
+ gdk_colormap_new (visual, FALSE);
+ }
+ }
}
else
{
dwExStyle = WS_EX_TRANSPARENT;
- private->drawable.colormap = NULL;
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_TRANSPARENT;
- GDK_WINDOW_WIN32DATA (window)->bg_pixmap = NULL;
+ private->depth = 0;
+ private->input_only = TRUE;
+ draw_impl->colormap = NULL;
}
- if (attributes_mask & GDK_WA_X)
- x = attributes->x;
- else
- x = CW_USEDEFAULT;
-
- if (attributes_mask & GDK_WA_Y)
- y = attributes->y;
- else if (attributes_mask & GDK_WA_X)
- y = 100; /* ??? We must put it somewhere... */
- else
- y = 500; /* x is CW_USEDEFAULT, y doesn't matter then */
-
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
- switch (private->drawable.window_type)
+ switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
- xparent = gdk_root_window;
+ hparent = gdk_root_window;
break;
+
case GDK_WINDOW_CHILD:
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
break;
+
case GDK_WINDOW_DIALOG:
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
#if 0
dwExStyle |= WS_EX_TOPMOST; /* //HB: want this? */
#endif
- xparent = gdk_root_window;
+ hparent = gdk_root_window;
break;
+
case GDK_WINDOW_TEMP:
dwStyle = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
dwExStyle |= WS_EX_TOOLWINDOW;
break;
+
case GDK_WINDOW_ROOT:
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
break;
- case GDK_DRAWABLE_PIXMAP:
- g_error ("cannot make windows of type GDK_DRAWABLE_PIXMAP (use gdk_pixmap_new)");
- break;
}
- klass = RegisterGdkClass (private->drawable.window_type);
+ klass = RegisterGdkClass (private->window_type);
- if (private->drawable.window_type != GDK_WINDOW_CHILD)
+ if (private->window_type != GDK_WINDOW_CHILD)
{
if (x == CW_USEDEFAULT)
{
@@ -413,8 +545,8 @@ gdk_window_new (GdkWindow *parent,
rect.top = y;
}
- rect.right = rect.left + private->drawable.width;
- rect.bottom = rect.top + private->drawable.height;
+ rect.right = rect.left + impl->width;
+ rect.bottom = rect.top + impl->height;
SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
@@ -428,8 +560,8 @@ gdk_window_new (GdkWindow *parent,
}
else
{
- width = private->drawable.width;
- height = private->drawable.height;
+ width = impl->width;
+ height = impl->height;
}
titlelen = strlen (title);
@@ -440,49 +572,44 @@ gdk_window_new (GdkWindow *parent,
WideCharToMultiByte (GetACP (), 0, wctitle, -1,
mbtitle, 3*titlelen, NULL, NULL);
- GDK_DRAWABLE_WIN32DATA (window)->xid =
- CreateWindowEx (dwExStyle,
- MAKEINTRESOURCE(klass),
- mbtitle,
- dwStyle,
- x, y,
- width, height,
- xparent,
- NULL,
- gdk_app_hmodule,
- NULL);
+ draw_impl->handle = CreateWindowEx (dwExStyle,
+ MAKEINTRESOURCE(klass),
+ mbtitle,
+ dwStyle,
+ x, y,
+ width, height,
+ hparent,
+ NULL,
+ gdk_app_hmodule,
+ NULL);
GDK_NOTE (MISC,
g_print ("gdk_window_new: %s %s %dx%d@+%d+%d %#x = %#x\n"
"...locale %#x codepage %d\n",
- (private->drawable.window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
- (private->drawable.window_type == GDK_WINDOW_CHILD ? "CHILD" :
- (private->drawable.window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
- (private->drawable.window_type == GDK_WINDOW_TEMP ? "TEMP" :
+ (private->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
+ (private->window_type == GDK_WINDOW_CHILD ? "CHILD" :
+ (private->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
+ (private->window_type == GDK_WINDOW_TEMP ? "TEMP" :
"???")))),
mbtitle,
width, height, (x == CW_USEDEFAULT ? -9999 : x), y,
- xparent,
- GDK_DRAWABLE_XID (window),
- GDK_WINDOW_WIN32DATA (window)->input_locale,
- GDK_WINDOW_WIN32DATA (window)->charset_info.ciACP));
+ hparent,
+ GDK_WINDOW_HWND (window),
+ impl->input_locale,
+ impl->charset_info.ciACP));
g_free (mbtitle);
g_free (wctitle);
- if (GDK_DRAWABLE_XID (window) == NULL)
+ if (draw_impl->handle == NULL)
{
WIN32_API_FAILED ("CreateWindowEx");
- g_free (GDK_DRAWABLE_WIN32DATA (window));
- g_free (private);
+ g_object_unref ((GObject *) window);
return NULL;
}
gdk_drawable_ref (window);
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
-
- if (private->drawable.colormap)
- gdk_colormap_ref (private->drawable.colormap);
+ gdk_win32_handle_table_insert (GDK_WINDOW_HWND (window), window);
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
@@ -492,45 +619,49 @@ gdk_window_new (GdkWindow *parent,
}
GdkWindow *
-gdk_window_foreign_new (guint32 anid)
+gdk_window_foreign_new (GdkNativeWindow anid)
{
GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
+ GdkWindowObject *private;
+ GdkWindowObject *parent_private;
+ GdkWindowImplWin32 *impl;
+ GdkDrawableImplWin32 *draw_impl;
+
HANDLE parent;
RECT rect;
POINT point;
- window = gdk_win32_window_alloc ();
- private = (GdkWindowPrivate *)window;
-
- parent = GetParent ((HWND) anid);
- private->parent = gdk_xid_table_lookup (parent);
-
- parent_private = (GdkWindowPrivate *)private->parent;
+ window = g_object_new (GDK_TYPE_WINDOW, NULL);
+ private = (GdkWindowObject *)window;
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+ draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
+ draw_impl->wrapper = GDK_DRAWABLE (window);
+
+ private->parent = gdk_win32_handle_table_lookup (parent);
+
+ parent_private = (GdkWindowObject *)private->parent;
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
- GDK_DRAWABLE_WIN32DATA (window)->xid = (HWND) anid;
+ draw_impl->handle = (HWND) anid;
GetClientRect ((HWND) anid, &rect);
point.x = rect.left;
point.y = rect.right;
ClientToScreen ((HWND) anid, &point);
- if (parent != GetDesktopWindow ())
+ if (parent != gdk_root_window)
ScreenToClient (parent, &point);
private->x = point.x;
private->y = point.y;
- private->drawable.width = rect.right - rect.left;
- private->drawable.height = rect.bottom - rect.top;
- private->drawable.window_type = GDK_WINDOW_FOREIGN;
- private->drawable.destroyed = FALSE;
- private->mapped = IsWindowVisible (GDK_DRAWABLE_XID (window));
-
- private->drawable.colormap = NULL;
+ impl->width = rect.right - rect.left;
+ impl->height = rect.bottom - rect.top;
+ private->window_type = GDK_WINDOW_FOREIGN;
+ private->destroyed = FALSE;
+ private->mapped = IsWindowVisible ((HWND) anid);
+ private->depth = gdk_visual_get_system ()->depth;
gdk_drawable_ref (window);
- gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
+ gdk_win32_handle_table_insert (GDK_WINDOW_HWND (window), window);
return window;
}
@@ -540,19 +671,21 @@ _gdk_windowing_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_destroy %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
if (private->extension_events != 0)
gdk_input_window_destroy (window);
- if (private->drawable.window_type == GDK_WINDOW_FOREIGN)
+ if (private->window_type == GDK_WINDOW_FOREIGN)
{
if (!foreign_destroy && (private->parent != NULL))
{
- /* It's somebody else's window, but in our heirarchy,
+ /* It's somebody else's window, but in our hierarchy,
* so reparent it to the root window, and then call
* DestroyWindow() on it.
*/
@@ -564,11 +697,11 @@ _gdk_windowing_window_destroy (GdkWindow *window,
* OTOH, I don't think foreign windows are much
* used, so the question is maybe academic.
*/
- PostMessage (GDK_DRAWABLE_XID (window), WM_QUIT, 0, 0);
+ PostMessage (GDK_WINDOW_HWND (window), WM_QUIT, 0, 0);
}
}
else if (!recursing && !foreign_destroy)
- DestroyWindow (GDK_DRAWABLE_XID (window));
+ DestroyWindow (GDK_WINDOW_HWND (window));
}
/* This function is called when the window really gone.
@@ -580,51 +713,54 @@ gdk_window_destroy_notify (GdkWindow *window)
GDK_NOTE (EVENTS,
g_print ("gdk_window_destroy_notify: %#x %s\n",
- GDK_DRAWABLE_XID (window),
- (GDK_DRAWABLE_DESTROYED (window) ? "(destroyed)" : "")));
+ GDK_WINDOW_HWND (window),
+ (GDK_WINDOW_DESTROYED (window) ? "(destroyed)" : "")));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
- if (GDK_DRAWABLE_TYPE(window) != GDK_WINDOW_FOREIGN)
+ if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
g_warning ("window %#x unexpectedly destroyed",
- GDK_DRAWABLE_XID (window));
+ GDK_WINDOW_HWND (window));
_gdk_window_destroy (window, TRUE);
}
- gdk_xid_table_remove (GDK_DRAWABLE_XID (window));
+ gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
gdk_drawable_unref (window);
}
void
gdk_window_show (GdkWindow *window)
{
- g_return_if_fail (window != NULL);
-
- if (!GDK_DRAWABLE_DESTROYED (window))
+ GdkWindowObject *private;
+
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_show: %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
- ((GdkWindowPrivate *) window)->mapped = TRUE;
- if (GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_TEMP)
+ private->mapped = TRUE;
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
{
- ShowWindow (GDK_DRAWABLE_XID (window), SW_SHOWNOACTIVATE);
- SetWindowPos (GDK_DRAWABLE_XID (window), HWND_TOPMOST, 0, 0, 0, 0,
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
+ SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
#if 0
/* Don't put on toolbar */
- ShowWindow (GDK_DRAWABLE_XID (window), SW_HIDE);
+ ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
#endif
}
else
{
- ShowWindow (GDK_DRAWABLE_XID (window), SW_SHOWNORMAL);
- ShowWindow (GDK_DRAWABLE_XID (window), SW_RESTORE);
- SetForegroundWindow (GDK_DRAWABLE_XID (window));
- BringWindowToTop (GDK_DRAWABLE_XID (window));
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
+ ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
+ SetForegroundWindow (GDK_WINDOW_HWND (window));
+ BringWindowToTop (GDK_WINDOW_HWND (window));
#if 0
- ShowOwnedPopups (GDK_DRAWABLE_XID (window), TRUE);
+ ShowOwnedPopups (GDK_WINDOW_HWND (window), TRUE);
#endif
}
}
@@ -633,37 +769,38 @@ gdk_window_show (GdkWindow *window)
void
gdk_window_hide (GdkWindow *window)
{
+ GdkWindowObject *private;
+
g_return_if_fail (window != NULL);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_hide: %#x\n",
- GDK_DRAWABLE_XID (window)));
-
- ((GdkWindowPrivate *) window)->mapped = FALSE;
- if (GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_TOPLEVEL)
- ShowOwnedPopups (GDK_DRAWABLE_XID (window), FALSE);
-#if 1
- ShowWindow (GDK_DRAWABLE_XID (window), SW_HIDE);
-#elif 0
- ShowWindow (GDK_DRAWABLE_XID (window), SW_MINIMIZE);
-#else
- CloseWindow (GDK_DRAWABLE_XID (window));
-#endif
+ GDK_WINDOW_HWND (window)));
+
+ private->mapped = FALSE;
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
+ ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
+
+ ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
}
}
void
gdk_window_withdraw (GdkWindow *window)
{
+ GdkWindowObject *private;
+
g_return_if_fail (window != NULL);
-
- if (!GDK_DRAWABLE_DESTROYED (window))
+
+ private = (GdkWindowObject*) window;
+ if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
- gdk_window_hide (window); /* XXX */
+ gdk_window_hide (window); /* ??? */
}
}
@@ -672,59 +809,15 @@ gdk_window_move (GdkWindow *window,
gint x,
gint y)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkWindowImplWin32 *impl;
g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- {
- RECT rect;
-
- GDK_NOTE (MISC, g_print ("gdk_window_move: %#x +%d+%d\n",
- GDK_DRAWABLE_XID (window), x, y));
-
- private = (GdkWindowPrivate *) window;
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
-
- if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_CHILD)
- {
- POINT ptTL, ptBR;
- DWORD dwStyle;
- DWORD dwExStyle;
-
- ptTL.x = 0;
- ptTL.y = 0;
- ClientToScreen (GDK_DRAWABLE_XID (window), &ptTL);
- rect.left = x;
- rect.top = y;
-
- ptBR.x = rect.right;
- ptBR.y = rect.bottom;
- ClientToScreen (GDK_DRAWABLE_XID (window), &ptBR);
- rect.right = x + ptBR.x - ptTL.x;
- rect.bottom = y + ptBR.y - ptTL.y;
-
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
- SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
-
- x = rect.left;
- y = rect.top;
- }
- else
- {
- private->x = x;
- private->y = y;
- }
- GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
- GDK_DRAWABLE_XID (window),
- rect.right - rect.left, rect.bottom - rect.top,
- x, y));
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
- x, y, rect.right - rect.left, rect.bottom - rect.top,
- TRUE))
- WIN32_API_FAILED ("MoveWindow");
- }
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+
+ gdk_window_move_resize (window, x, y, impl->width, impl->height);
}
void
@@ -732,28 +825,26 @@ gdk_window_resize (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private = (GdkWindowObject*) window;
+ GdkWindowImplWin32 *impl;
+ int x, y;
g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
- if ((gint16) width < 1)
+ if (width < 1)
width = 1;
- if ((gint16) height < 1)
+ if (height < 1)
height = 1;
- private = (GdkWindowPrivate*) window;
-
- if (!private->drawable.destroyed &&
- ((private->resize_count > 0) ||
- (private->drawable.width != (guint16) width) ||
- (private->drawable.height != (guint16) height)))
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+
+ if (!private->destroyed)
{
- int x, y;
-
GDK_NOTE (MISC, g_print ("gdk_window_resize: %#x %dx%d\n",
- GDK_DRAWABLE_XID (window), width, height));
+ GDK_WINDOW_HWND (window), width, height));
- if (private->drawable.window_type != GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (private) != GDK_WINDOW_CHILD)
{
POINT pt;
RECT rect;
@@ -762,14 +853,14 @@ gdk_window_resize (GdkWindow *window,
pt.x = 0;
pt.y = 0;
- ClientToScreen (GDK_DRAWABLE_XID (window), &pt);
+ ClientToScreen (GDK_WINDOW_HWND (window), &pt);
rect.left = pt.x;
rect.top = pt.y;
rect.right = pt.x + width;
rect.bottom = pt.y + height;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
WIN32_API_FAILED ("AdjustWindowRectEx");
@@ -782,18 +873,16 @@ gdk_window_resize (GdkWindow *window,
{
x = private->x;
y = private->y;
- private->drawable.width = width;
- private->drawable.height = height;
+ impl->width = width;
+ impl->height = height;
}
private->resize_count += 1;
GDK_NOTE (MISC,
g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
- GDK_DRAWABLE_XID (window), width, height, x, y));
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
- x, y, width, height,
- TRUE))
+ GDK_WINDOW_HWND (window), width, height, x, y));
+ if (!MoveWindow (GDK_WINDOW_HWND (window), x, y, width, height, TRUE))
WIN32_API_FAILED ("MoveWindow");
}
}
@@ -805,66 +894,52 @@ gdk_window_move_resize (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowPrivate *private;
+ GdkWindowObject *private = (GdkWindowObject*) window;
+ GdkWindowImplWin32 *impl;
g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
- if ((gint16) width < 1)
+ if (width < 1)
width = 1;
- if ((gint16) height < 1)
+ if (height < 1)
height = 1;
+
+ impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!private->destroyed)
{
RECT rect;
DWORD dwStyle;
DWORD dwExStyle;
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %#x %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window), width, height, x, y));
+ GDK_WINDOW_HWND (window), width, height, x, y));
- private = (GdkWindowPrivate*) window;
- rect.left = x;
- rect.top = y;
- rect.right = x + width;
- rect.bottom = y + height;
-
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
- if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
- WIN32_API_FAILED ("AdjustWindowRectEx");
-
- if (private->drawable.window_type == GDK_WINDOW_CHILD)
+ if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
+ _gdk_window_move_resize_child (window, x, y, width, height);
+ else
{
- private->x = x;
- private->y = y;
- private->drawable.width = width;
- private->drawable.height = height;
- }
- GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
- GDK_DRAWABLE_XID (window),
- rect.right - rect.left, rect.bottom - rect.top,
- rect.left, rect.top));
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
- rect.left, rect.top,
- rect.right - rect.left, rect.bottom - rect.top,
- TRUE))
- WIN32_API_FAILED ("MoveWindow");
+ rect.left = x;
+ rect.top = y;
+ rect.right = x + width;
+ rect.bottom = y + height;
- if (private->guffaw_gravity)
- {
- GList *tmp_list = private->children;
- while (tmp_list)
- {
- GdkWindowPrivate *child_private = tmp_list->data;
-
- child_private->x -= x - private->x;
- child_private->y -= y - private->y;
-
- tmp_list = tmp_list->next;
- }
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
+ if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
+ WIN32_API_FAILED ("AdjustWindowRectEx");
+
+ GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
+ GDK_WINDOW_HWND (window),
+ rect.right - rect.left, rect.bottom - rect.top,
+ rect.left, rect.top));
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
+ rect.left, rect.top,
+ rect.right - rect.left, rect.bottom - rect.top,
+ TRUE))
+ WIN32_API_FAILED ("MoveWindow");
}
-
}
}
@@ -874,38 +949,36 @@ gdk_window_reparent (GdkWindow *window,
gint x,
gint y)
{
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *parent_private;
- GdkWindowPrivate *old_parent_private;
+ GdkWindowObject *window_private;
+ GdkWindowObject *parent_private;
+ GdkWindowObject *old_parent_private;
+ GdkWindowImplWin32 *impl;
g_return_if_fail (window != NULL);
if (!new_parent)
new_parent = gdk_parent_root;
- window_private = (GdkWindowPrivate*) window;
- old_parent_private = (GdkWindowPrivate *) window_private->parent;
- parent_private = (GdkWindowPrivate*) new_parent;
+ window_private = (GdkWindowObject*) window;
+ old_parent_private = (GdkWindowObject *) window_private->parent;
+ parent_private = (GdkWindowObject*) new_parent;
+ impl = GDK_WINDOW_IMPL_WIN32 (window_private->impl);
- if (!GDK_DRAWABLE_DESTROYED (window)
- && !GDK_DRAWABLE_DESTROYED (new_parent))
+ if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (new_parent))
{
GDK_NOTE (MISC, g_print ("gdk_window_reparent: %#x %#x\n",
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (new_parent)));
- if (!SetParent (GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (new_parent)))
+ GDK_WINDOW_HWND (window),
+ GDK_WINDOW_HWND (new_parent)));
+ if (!SetParent (GDK_WINDOW_HWND (window),
+ GDK_WINDOW_HWND (new_parent)))
WIN32_API_FAILED ("SetParent");
- if (!MoveWindow (GDK_DRAWABLE_XID (window),
- x, y,
- window_private->drawable.width,
- window_private->drawable.height,
- TRUE))
+ if (!MoveWindow (GDK_WINDOW_HWND (window),
+ x, y, impl->width, impl->height, TRUE))
WIN32_API_FAILED ("MoveWindow");
}
- window_private->parent = new_parent;
+ window_private->parent = (GdkWindowObject *)new_parent;
if (old_parent_private)
old_parent_private->children =
@@ -926,24 +999,28 @@ _gdk_windowing_window_clear_area (GdkWindow *window,
gint width,
gint height)
{
+ GdkWindowImplWin32 *impl;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+
+ if (!GDK_WINDOW_DESTROYED (window))
{
HDC hdc;
if (width == 0)
- width = ((GdkDrawablePrivate *) window)->width - x;
+ width = impl->width - x;
if (height == 0)
- height = ((GdkDrawablePrivate *) window)->height - y;
+ height = impl->height - y;
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: "
"%#x %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window), width, height, x, y));
- hdc = GetDC (GDK_DRAWABLE_XID (window));
+ GDK_WINDOW_HWND (window), width, height, x, y));
+ hdc = GetDC (GDK_WINDOW_HWND (window));
IntersectClipRect (hdc, x, y, x + width + 1, y + height + 1);
- SendMessage (GDK_DRAWABLE_XID (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
- ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
+ SendMessage (GDK_WINDOW_HWND (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
+ ReleaseDC (GDK_WINDOW_HWND (window), hdc);
}
}
@@ -957,21 +1034,21 @@ _gdk_windowing_window_clear_area_e (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
RECT rect;
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area_e: "
"%#x %dx%d@+%d+%d\n",
- GDK_DRAWABLE_XID (window), width, height, x, y));
+ GDK_WINDOW_HWND (window), width, height, x, y));
rect.left = x;
rect.right = x + width + 1;
rect.top = y;
rect.bottom = y + height + 1;
- if (!InvalidateRect (GDK_DRAWABLE_XID (window), &rect, TRUE))
+ if (!InvalidateRect (GDK_WINDOW_HWND (window), &rect, TRUE))
WIN32_GDI_FAILED ("InvalidateRect");
- UpdateWindow (GDK_DRAWABLE_XID (window));
+ UpdateWindow (GDK_WINDOW_HWND (window));
}
}
@@ -981,12 +1058,12 @@ gdk_window_raise (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
GDK_NOTE (MISC, g_print ("gdk_window_raise: %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
- if (!BringWindowToTop (GDK_DRAWABLE_XID (window)))
+ if (!BringWindowToTop (GDK_WINDOW_HWND (window)))
WIN32_API_FAILED ("BringWindowToTop");
}
}
@@ -997,12 +1074,12 @@ gdk_window_lower (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
GDK_NOTE (MISC, g_print ("gdk_window_lower: %#x\n",
- GDK_DRAWABLE_XID (window)));
+ GDK_WINDOW_HWND (window)));
- if (!SetWindowPos (GDK_DRAWABLE_XID (window), HWND_BOTTOM, 0, 0, 0, 0,
+ if (!SetWindowPos (GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
WIN32_API_FAILED ("SetWindowPos");
}
@@ -1018,6 +1095,7 @@ gdk_window_set_hints (GdkWindow *window,
gint max_height,
gint flags)
{
+ GdkWindowImplWin32 *impl;
WINDOWPLACEMENT size_hints;
RECT rect;
DWORD dwStyle;
@@ -1027,21 +1105,23 @@ gdk_window_set_hints (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+
GDK_NOTE (MISC, g_print ("gdk_window_set_hints: %#x %dx%d..%dx%d @+%d+%d\n",
- GDK_DRAWABLE_XID (window),
+ GDK_WINDOW_HWND (window),
min_width, min_height, max_width, max_height,
x, y));
- GDK_WINDOW_WIN32DATA (window)->hint_flags = flags;
+ impl->hint_flags = flags;
size_hints.length = sizeof (size_hints);
if (flags)
{
if (flags & GDK_HINT_POS)
- if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
+ if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
WIN32_API_FAILED ("GetWindowPlacement");
else
{
@@ -1058,8 +1138,8 @@ gdk_window_set_hints (GdkWindow *window,
rect.top = y;
rect.right = rect.left + 200; /* dummy */
rect.bottom = rect.top + 200;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
size_hints.flags = 0;
size_hints.showCmd = SW_SHOWNA;
@@ -1078,10 +1158,10 @@ gdk_window_set_hints (GdkWindow *window,
size_hints.rcNormalPosition.top,
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
- if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
+ if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
WIN32_API_FAILED ("SetWindowPlacement");
- GDK_WINDOW_WIN32DATA (window)->hint_x = rect.left;
- GDK_WINDOW_WIN32DATA (window)->hint_y = rect.top;
+ impl->hint_x = rect.left;
+ impl->hint_y = rect.top;
}
if (flags & GDK_HINT_MIN_SIZE)
@@ -1090,16 +1170,14 @@ gdk_window_set_hints (GdkWindow *window,
rect.top = 0;
rect.right = min_width;
rect.bottom = min_height;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
- GDK_WINDOW_WIN32DATA (window)->hint_min_width =
- rect.right - rect.left;
- GDK_WINDOW_WIN32DATA (window)->hint_min_height =
- rect.bottom - rect.top;
+ impl->hint_min_width = rect.right - rect.left;
+ impl->hint_min_height = rect.bottom - rect.top;
/* Also chek if he current size of the window is in bounds. */
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
if (rect.right < min_width && rect.bottom < min_height)
gdk_window_resize (window, min_width, min_height);
else if (rect.right < min_width)
@@ -1114,15 +1192,13 @@ gdk_window_set_hints (GdkWindow *window,
rect.top = 0;
rect.right = max_width;
rect.bottom = max_height;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
- GDK_WINDOW_WIN32DATA (window)->hint_max_width =
- rect.right - rect.left;
- GDK_WINDOW_WIN32DATA (window)->hint_max_height =
- rect.bottom - rect.top;
+ impl->hint_max_width = rect.right - rect.left;
+ impl->hint_max_height = rect.bottom - rect.top;
/* Again, check if the window is too large currently. */
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
if (rect.right > max_width && rect.bottom > max_height)
gdk_window_resize (window, max_width, max_height);
else if (rect.right > max_width)
@@ -1138,6 +1214,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
+ GdkWindowImplWin32 *impl;
WINDOWPLACEMENT size_hints;
RECT rect;
DWORD dwStyle;
@@ -1147,12 +1224,13 @@ gdk_window_set_geometry_hints (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
size_hints.length = sizeof (size_hints);
- GDK_WINDOW_WIN32DATA (window)->hint_flags = geom_mask;
+ impl->hint_flags = geom_mask;
if (geom_mask & GDK_HINT_POS)
; /* XXX */
@@ -1163,14 +1241,14 @@ gdk_window_set_geometry_hints (GdkWindow *window,
rect.top = 0;
rect.right = geometry->min_width;
rect.bottom = geometry->min_height;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
- GDK_WINDOW_WIN32DATA (window)->hint_min_width = rect.right - rect.left;
- GDK_WINDOW_WIN32DATA (window)->hint_min_height = rect.bottom - rect.top;
+ impl->hint_min_width = rect.right - rect.left;
+ impl->hint_min_height = rect.bottom - rect.top;
/* Also check if he current size of the window is in bounds */
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
if (rect.right < geometry->min_width
&& rect.bottom < geometry->min_height)
gdk_window_resize (window, geometry->min_width, geometry->min_height);
@@ -1186,14 +1264,14 @@ gdk_window_set_geometry_hints (GdkWindow *window,
rect.top = 0;
rect.right = geometry->max_width;
rect.bottom = geometry->max_height;
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
- GDK_WINDOW_WIN32DATA (window)->hint_max_width = rect.right - rect.left;
- GDK_WINDOW_WIN32DATA (window)->hint_max_height = rect.bottom - rect.top;
+ impl->hint_max_width = rect.right - rect.left;
+ impl->hint_max_height = rect.bottom - rect.top;
/* Again, check if the window is too large currently. */
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
if (rect.right > geometry->max_width
&& rect.bottom > geometry->max_height)
gdk_window_resize (window, geometry->max_width, geometry->max_height);
@@ -1207,7 +1285,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
if (geom_mask & GDK_HINT_BASE_SIZE
&& geometry->base_width > 0
&& geometry->base_height > 0)
- if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
+ if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
WIN32_API_FAILED ("GetWindowPlacement");
else
{
@@ -1226,7 +1304,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
size_hints.rcNormalPosition.top,
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
- if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
+ if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
WIN32_API_FAILED ("SetWindowPlacement");
}
@@ -1253,11 +1331,11 @@ gdk_window_set_title (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (title != NULL);
- g_return_if_fail (strlen (title) > 0);
GDK_NOTE (MISC, g_print ("gdk_window_set_title: %#x %s\n",
- GDK_DRAWABLE_XID (window), title));
- if (!GDK_DRAWABLE_DESTROYED (window))
+ GDK_WINDOW_HWND (window), title));
+
+ if (!GDK_WINDOW_DESTROYED (window))
{
/* As the title is in UTF-8 we must translate it
* to the system codepage.
@@ -1270,7 +1348,7 @@ gdk_window_set_title (GdkWindow *window,
WideCharToMultiByte (GetACP (), 0, wcstr, -1,
mbstr, 3*titlelen, NULL, NULL);
- if (!SetWindowText (GDK_DRAWABLE_XID (window), mbstr))
+ if (!SetWindowText (GDK_WINDOW_HWND (window), mbstr))
WIN32_API_FAILED ("SetWindowText");
g_free (mbstr);
@@ -1286,7 +1364,7 @@ gdk_window_set_role (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_role: %#x %s\n",
- GDK_DRAWABLE_XID (window), (role ? role : "NULL")));
+ GDK_WINDOW_HWND (window), (role ? role : "NULL")));
/* XXX */
}
@@ -1298,8 +1376,8 @@ gdk_window_set_transient_for (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %#x %#x\n",
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (parent)));
+ GDK_WINDOW_HWND (window),
+ GDK_WINDOW_HWND (parent)));
/* XXX */
}
@@ -1307,26 +1385,23 @@ void
gdk_window_set_background (GdkWindow *window,
GdkColor *color)
{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (!GDK_DRAWABLE_DESTROYED (window))
- {
- GDK_NOTE (MISC, g_print ("gdk_window_set_background: %#x %s\n",
- GDK_DRAWABLE_XID (window),
- gdk_win32_color_to_string (color)));
+ GDK_NOTE (MISC, g_print ("gdk_window_set_background: %#x %s\n",
+ GDK_WINDOW_HWND (window),
+ gdk_win32_color_to_string (color)));
- if (GDK_WINDOW_WIN32DATA (window)->bg_type == GDK_WIN32_BG_PIXMAP)
- {
- if (GDK_WINDOW_WIN32DATA (window)->bg_pixmap != NULL)
- {
- gdk_drawable_unref (GDK_WINDOW_WIN32DATA (window)->bg_pixmap);
- GDK_WINDOW_WIN32DATA (window)->bg_pixmap = NULL;
- }
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_NORMAL;
- }
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_PIXEL;
- GDK_WINDOW_WIN32DATA (window)->bg_pixel = color->pixel;
+ private->bg_color = *color;
+
+ if (private->bg_pixmap &&
+ private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
+ private->bg_pixmap != GDK_NO_BG)
+ {
+ gdk_drawable_unref (private->bg_pixmap);
+ private->bg_pixmap = NULL;
}
}
@@ -1335,37 +1410,31 @@ gdk_window_set_back_pixmap (GdkWindow *window,
GdkPixmap *pixmap,
gint parent_relative)
{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ g_return_if_fail (pixmap == NULL || !parent_relative);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (private->bg_pixmap &&
+ private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
+ private->bg_pixmap != GDK_NO_BG)
+ gdk_drawable_unref (private->bg_pixmap);
+
+ if (parent_relative)
{
- if (GDK_WINDOW_WIN32DATA (window)->bg_type == GDK_WIN32_BG_PIXMAP)
- {
- if (GDK_WINDOW_WIN32DATA (window)->bg_pixmap != NULL)
- {
- gdk_drawable_unref (GDK_WINDOW_WIN32DATA (window)->bg_pixmap);
- GDK_WINDOW_WIN32DATA (window)->bg_pixmap = NULL;
- }
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_NORMAL;
- }
- if (parent_relative)
- {
- GDK_WINDOW_WIN32DATA (window)->bg_type =
- GDK_WIN32_BG_PARENT_RELATIVE;
- }
- else if (!pixmap)
+ private->bg_pixmap = GDK_PARENT_RELATIVE_BG;
+ }
+ else
+ {
+ if (pixmap)
{
-
+ gdk_drawable_ref (pixmap);
+ private->bg_pixmap = pixmap;
}
else
{
- /* We must cache the pixmap in the GdkWindowWin32Data and
- * paint it each time we get WM_ERASEBKGND
- */
- GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_PIXMAP;
- GDK_WINDOW_WIN32DATA (window)->bg_pixmap = pixmap;
- gdk_drawable_ref (pixmap);
+ private->bg_pixmap = GDK_NO_BG;
}
}
}
@@ -1374,33 +1443,34 @@ void
gdk_window_set_cursor (GdkWindow *window,
GdkCursor *cursor)
{
+ GdkWindowImplWin32 *impl;
GdkCursorPrivate *cursor_private;
- HCURSOR xcursor;
+ HCURSOR hcursor;
POINT pt;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
cursor_private = (GdkCursorPrivate*) cursor;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
if (!cursor)
- xcursor = NULL;
+ hcursor = NULL;
else
- xcursor = cursor_private->xcursor;
+ hcursor = cursor_private->hcursor;
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n",
- GDK_DRAWABLE_XID (window), xcursor));
- if (GDK_WINDOW_WIN32DATA (window)->xcursor != NULL)
+ GDK_WINDOW_HWND (window), hcursor));
+ if (impl->hcursor != NULL)
{
- GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n",
- GDK_WINDOW_WIN32DATA (window)->xcursor));
+ GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n", impl->hcursor));
- DestroyCursor (GDK_WINDOW_WIN32DATA (window)->xcursor);
- GDK_WINDOW_WIN32DATA (window)->xcursor = NULL;
+ DestroyCursor (impl->hcursor);
+ impl->hcursor = NULL;
}
- if (xcursor != NULL)
+ if (hcursor != NULL)
{
/* We must copy the cursor as it is OK to destroy the GdkCursor
* while still in use for some window. See for instance
@@ -1408,14 +1478,13 @@ gdk_window_set_cursor (GdkWindow *window,
* gdk_window_set_cursor (win, cursor), and immediately
* afterwards gdk_cursor_destroy (cursor).
*/
- GDK_WINDOW_WIN32DATA (window)->xcursor = CopyCursor (xcursor);
+ impl->hcursor = CopyCursor (hcursor);
GDK_NOTE (MISC, g_print ("...CopyCursor (%#x) = %#x\n",
- xcursor,
- GDK_WINDOW_WIN32DATA (window)->xcursor));
+ hcursor, impl->hcursor));
GetCursorPos (&pt);
- if (ChildWindowFromPoint (GDK_DRAWABLE_XID (window), pt) == GDK_DRAWABLE_XID (window))
- SetCursor (GDK_WINDOW_WIN32DATA (window)->xcursor);
+ if (ChildWindowFromPoint (GDK_WINDOW_HWND (window), pt) == GDK_WINDOW_HWND (window))
+ SetCursor (impl->hcursor);
}
}
}
@@ -1433,11 +1502,11 @@ gdk_window_get_geometry (GdkWindow *window,
if (!window)
window = gdk_parent_root;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
RECT rect;
- if (!GetClientRect (GDK_DRAWABLE_XID (window), &rect))
+ if (!GetClientRect (GDK_WINDOW_HWND (window), &rect))
WIN32_API_FAILED ("GetClientRect");
if (x)
@@ -1464,13 +1533,13 @@ gdk_window_get_origin (GdkWindow *window,
g_return_val_if_fail (window != NULL, 0);
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
POINT pt;
pt.x = 0;
pt.y = 0;
- ClientToScreen (GDK_DRAWABLE_XID (window), &pt);
+ ClientToScreen (GDK_WINDOW_HWND (window), &pt);
tx = pt.x;
ty = pt.y;
return_val = 1;
@@ -1484,7 +1553,7 @@ gdk_window_get_origin (GdkWindow *window,
*y = ty;
GDK_NOTE (MISC, g_print ("gdk_window_get_origin: %#x: +%d+%d\n",
- GDK_DRAWABLE_XID (window), tx, ty));
+ GDK_WINDOW_HWND (window), tx, ty));
return return_val;
}
@@ -1501,36 +1570,37 @@ gdk_window_get_root_origin (GdkWindow *window,
gint *x,
gint *y)
{
- GdkWindowPrivate *rover;
+ GdkWindowObject *rover;
POINT pt;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- rover = (GdkWindowPrivate*) window;
+ rover = (GdkWindowObject*) window;
if (x)
*x = 0;
if (y)
*y = 0;
- if (GDK_DRAWABLE_DESTROYED (window))
+
+ if (GDK_WINDOW_DESTROYED (window))
return;
- while (rover->parent && ((GdkWindowPrivate*) rover->parent)->parent)
- rover = (GdkWindowPrivate *) rover->parent;
- if (rover->drawable.destroyed)
+ while (rover->parent && ((GdkWindowObject*) rover->parent)->parent)
+ rover = (GdkWindowObject *) rover->parent;
+ if (rover->destroyed)
return;
pt.x = 0;
pt.y = 0;
- ClientToScreen (GDK_DRAWABLE_XID (rover), &pt);
+ ClientToScreen (GDK_WINDOW_HWND (rover), &pt);
if (x)
*x = pt.x;
if (y)
*y = pt.y;
GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %#x: (%#x) +%d+%d\n",
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (rover), pt.x, pt.y));
+ GDK_WINDOW_HWND (window),
+ GDK_WINDOW_HWND (rover), pt.x, pt.y));
}
GdkWindow*
@@ -1551,7 +1621,7 @@ gdk_window_get_pointer (GdkWindow *window,
return_val = NULL;
GetCursorPos (&pointc);
point = pointc;
- ScreenToClient (GDK_DRAWABLE_XID (window), &point);
+ ScreenToClient (GDK_WINDOW_HWND (window), &point);
if (x)
*x = point.x;
@@ -1568,7 +1638,7 @@ gdk_window_get_pointer (GdkWindow *window,
ScreenToClient (hwndc, &point);
} while (hwndc != hwnd && (hwnd = hwndc, 1)); /* Ouch! */
- return_val = gdk_window_lookup (hwnd);
+ return_val = gdk_win32_handle_table_lookup (hwnd);
if (mask)
{
@@ -1626,7 +1696,7 @@ gdk_window_at_pointer (gint *win_x,
ScreenToClient (hwndc, &point);
} while (hwndc != hwnd && (hwnd = hwndc, 1));
- window = gdk_window_lookup (hwnd);
+ window = gdk_win32_handle_table_lookup (hwnd);
if (window && (win_x || win_y))
{
@@ -1644,35 +1714,16 @@ gdk_window_at_pointer (gint *win_x,
return window;
}
-GList*
-gdk_window_get_children (GdkWindow *window)
-{
- GdkWindowPrivate *private;
- GList *children;
-
- g_return_val_if_fail (window != NULL, NULL);
- g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
- if (GDK_DRAWABLE_DESTROYED (window))
- return NULL;
-
- /* XXX ??? */
- g_warning ("gdk_window_get_children not implemented");
- children = NULL;
-
- return children;
-}
-
GdkEventMask
gdk_window_get_events (GdkWindow *window)
{
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return 0;
- return GDK_WINDOW_WIN32DATA (window)->event_mask;
+ return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask;
}
void
@@ -1682,16 +1733,10 @@ gdk_window_set_events (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- GDK_WINDOW_WIN32DATA (window)->event_mask = event_mask;
-}
-
-void
-gdk_window_add_colormap_windows (GdkWindow *window)
-{
- g_warning ("gdk_window_add_colormap_windows not implemented");
+ GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask = event_mask;
}
void
@@ -1705,8 +1750,8 @@ gdk_window_shape_combine_mask (GdkWindow *window,
if (!mask)
{
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x none\n",
- GDK_DRAWABLE_XID (window)));
- SetWindowRgn (GDK_DRAWABLE_XID (window), NULL, TRUE);
+ GDK_WINDOW_HWND (window)));
+ SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
}
else
{
@@ -1716,30 +1761,30 @@ gdk_window_shape_combine_mask (GdkWindow *window,
RECT rect;
/* Convert mask bitmap to region */
- hrgn = BitmapToRegion (GDK_DRAWABLE_XID (mask));
+ hrgn = BitmapToRegion (GDK_WINDOW_HWND (mask));
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x %#x\n",
- GDK_DRAWABLE_XID (window),
- GDK_DRAWABLE_XID (mask)));
+ GDK_WINDOW_HWND (window),
+ GDK_WINDOW_HWND (mask)));
/* SetWindowRgn wants window (not client) coordinates */
- dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
- GetClientRect (GDK_DRAWABLE_XID (window), &rect);
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
+ GetClientRect (GDK_WINDOW_HWND (window), &rect);
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
OffsetRgn (hrgn, -rect.left, -rect.top);
OffsetRgn (hrgn, x, y);
/* If this is a top-level window, add the title bar to the region */
- if (GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_TOPLEVEL)
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
{
CombineRgn (hrgn, hrgn,
CreateRectRgn (0, 0, rect.right - rect.left, -rect.top),
RGN_OR);
}
- SetWindowRgn (GDK_DRAWABLE_XID (window), hrgn, TRUE);
+ SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
}
}
@@ -1762,7 +1807,7 @@ gdk_window_set_icon (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
/* Nothing to do, really. As we share window classes between windows
@@ -1778,10 +1823,10 @@ gdk_window_set_icon_name (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- if (!SetWindowText (GDK_DRAWABLE_XID (window), name))
+ if (!SetWindowText (GDK_WINDOW_HWND (window), name))
WIN32_API_FAILED ("SetWindowText");
}
@@ -1794,7 +1839,7 @@ gdk_window_set_group (GdkWindow *window,
g_return_if_fail (leader != NULL);
g_return_if_fail (GDK_IS_WINDOW (leader));
- if (GDK_DRAWABLE_DESTROYED (window) || GDK_DRAWABLE_DESTROYED (leader))
+ if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
return;
g_warning ("gdk_window_set_group not implemented");
@@ -1809,8 +1854,8 @@ gdk_window_set_decorations (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- style = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- exstyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
style &= (WS_OVERLAPPED|WS_POPUP|WS_CHILD|WS_MINIMIZE|WS_VISIBLE|WS_DISABLED
|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZE);
@@ -1832,7 +1877,7 @@ gdk_window_set_decorations (GdkWindow *window,
if (decorations & GDK_DECOR_MAXIMIZE)
style |= (WS_MAXIMIZEBOX);
- SetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE, style);
+ SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
}
void
@@ -1844,8 +1889,8 @@ gdk_window_set_functions (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- style = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
- exstyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
+ style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
style &= (WS_OVERLAPPED|WS_POPUP|WS_CHILD|WS_MINIMIZE|WS_VISIBLE|WS_DISABLED
|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZE|WS_CAPTION|WS_BORDER
@@ -1864,7 +1909,7 @@ gdk_window_set_functions (GdkWindow *window,
if (functions & GDK_FUNC_MAXIMIZE)
style |= (WS_MAXIMIZEBOX);
- SetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE, style);
+ SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
}
/*
@@ -1951,10 +1996,10 @@ gdk_window_set_child_shapes (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- gdk_propagate_shapes (GDK_DRAWABLE_XID (window), FALSE);
+ gdk_propagate_shapes (GDK_WINDOW_HWND (window), FALSE);
}
void
@@ -1963,10 +2008,10 @@ gdk_window_merge_child_shapes (GdkWindow *window)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_DRAWABLE_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window))
return;
- gdk_propagate_shapes (GDK_DRAWABLE_XID (window), TRUE);
+ gdk_propagate_shapes (GDK_WINDOW_HWND (window), TRUE);
}
/* Support for windows that can be guffaw-scrolled
@@ -2053,7 +2098,7 @@ gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+ GdkWindowObject *private = (GdkWindowObject *)window;
GList *tmp_list;
g_return_val_if_fail (window != NULL, FALSE);
@@ -2067,7 +2112,7 @@ gdk_window_set_static_gravities (GdkWindow *window,
private->guffaw_gravity = use_static;
- if (!GDK_DRAWABLE_DESTROYED (window))
+ if (!GDK_WINDOW_DESTROYED (window))
{
gdk_window_set_static_bit_gravity (window, use_static);
diff --git a/gdk/win32/gdkwindow-win32.h b/gdk/win32/gdkwindow-win32.h
index bf0f15b24..ff44d11f5 100644
--- a/gdk/win32/gdkwindow-win32.h
+++ b/gdk/win32/gdkwindow-win32.h
@@ -77,18 +77,6 @@ struct _GdkWindowImplWin32
/* We must keep the event mask here to filter them ourselves */
gint event_mask;
- /* Values for bg_type */
-#define GDK_WIN32_BG_NORMAL 0
-#define GDK_WIN32_BG_PIXEL 1
-#define GDK_WIN32_BG_PIXMAP 2
-#define GDK_WIN32_BG_PARENT_RELATIVE 3
-#define GDK_WIN32_BG_TRANSPARENT 4
-
- /* We draw the background ourselves at WM_ERASEBKGND */
- guchar bg_type;
- gulong bg_pixel;
- GdkPixmap *bg_pixmap;
-
HCURSOR hcursor;
/* Window size hints */
diff --git a/gdk/win32/makefile.mingw.in b/gdk/win32/makefile.mingw.in
index 0ca4f3497..61f499cb8 100644
--- a/gdk/win32/makefile.mingw.in
+++ b/gdk/win32/makefile.mingw.in
@@ -17,7 +17,7 @@ OPTIMIZE = -g
INCLUDES = -I ../.. -I .. -I $(WTKIT)/include
DEPCFLAGS = $(GLIB_CFLAGS) $(PANGO_CFLAGS)
-DEFINES = -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\"
+DEFINES = -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DGDK_COMPILATION
all: \
../../config.h \
@@ -39,6 +39,7 @@ gdk_win32_OBJECTS = \
gdkglobals-win32.o \
gdkim-win32.o \
gdkimage-win32.o \
+ gdkinput.o \
gdkinput-win32.o \
gdkmain-win32.o \
gdkpixmap-win32.o \
diff --git a/gtk/gtk.def b/gtk/gtk.def
index f5ea0d165..35335a301 100755
--- a/gtk/gtk.def
+++ b/gtk/gtk.def
@@ -218,8 +218,8 @@ EXPORTS
gtk_calendar_freeze
gtk_calendar_get_date
gtk_calendar_get_type
- gtk_calendar_new
gtk_calendar_mark_day
+ gtk_calendar_new
gtk_calendar_select_day
gtk_calendar_select_month
gtk_calendar_thaw
@@ -298,7 +298,6 @@ EXPORTS
gtk_clist_set_selection_mode
gtk_clist_set_shadow_type
gtk_clist_set_shift
- gtk_ctree_set_show_stub
gtk_clist_set_sort_column
gtk_clist_set_sort_type
gtk_clist_set_text
@@ -418,6 +417,7 @@ EXPORTS
gtk_ctree_set_indent
gtk_ctree_set_line_style
gtk_ctree_set_node_info
+ gtk_ctree_set_show_stub
gtk_ctree_set_spacing
gtk_ctree_sort_node
gtk_ctree_sort_recursive
@@ -447,8 +447,8 @@ EXPORTS
gtk_drag_highlight
gtk_drag_set_default_icon
gtk_drag_set_icon_default
- gtk_drag_set_icon_widget
gtk_drag_set_icon_pixmap
+ gtk_drag_set_icon_widget
gtk_drag_source_handle_event
gtk_drag_source_set
gtk_drag_source_set_icon
@@ -695,8 +695,8 @@ EXPORTS
gtk_marshal_NONE__POINTER
gtk_marshal_NONE__POINTER_INT
gtk_marshal_NONE__POINTER_INT_INT
- gtk_marshal_NONE__POINTER_INT_POINTER
gtk_marshal_NONE__POINTER_INT_INT_POINTER_INT_INT
+ gtk_marshal_NONE__POINTER_INT_POINTER
gtk_marshal_NONE__POINTER_POINTER
gtk_marshal_NONE__POINTER_POINTER_INT_INT
gtk_marshal_NONE__POINTER_POINTER_POINTER
@@ -854,13 +854,13 @@ EXPORTS
gtk_paint_focus
gtk_paint_handle
gtk_paint_hline
- gtk_paint_oval
gtk_paint_option
+ gtk_paint_oval
gtk_paint_polygon
gtk_paint_ramp
- gtk_paint_slider
gtk_paint_shadow
gtk_paint_shadow_gap
+ gtk_paint_slider
gtk_paint_string
gtk_paint_tab
gtk_paint_vline
@@ -967,8 +967,8 @@ EXPORTS
gtk_rc_find_pixmap_in_path
gtk_rc_get_default_files
gtk_rc_get_module_dir
- gtk_rc_get_theme_dir
gtk_rc_get_style
+ gtk_rc_get_theme_dir
gtk_rc_init
gtk_rc_load_image
gtk_rc_parse
@@ -1053,9 +1053,9 @@ EXPORTS
gtk_signal_name
gtk_signal_new
gtk_signal_newv
- gtk_signal_set_funcs
gtk_signal_query
gtk_signal_remove_emission_hook
+ gtk_signal_set_funcs
gtk_socket_get_type
gtk_socket_new
gtk_socket_steal
@@ -1320,6 +1320,7 @@ EXPORTS
gtk_widget_unparent
gtk_widget_unrealize
gtk_widget_unref
+ gtk_win32_get_installation_directory
gtk_window_activate_default
gtk_window_activate_focus
gtk_window_add_accel_group
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 9fbaa444c..b6b3c8203 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -255,35 +255,35 @@ static GtkImageLoader image_loader = NULL;
#ifdef G_OS_WIN32
gchar *
-get_gtk_sysconf_directory (void)
+gtk_win32_get_installation_directory (void)
{
static gboolean been_here = FALSE;
- static gchar gtk_sysconf_dir[200];
+ static gchar gtk_installation_dir[200];
gchar win_dir[100];
HKEY reg_key = NULL;
DWORD type;
- DWORD nbytes = sizeof (gtk_sysconf_dir);
+ DWORD nbytes = sizeof (gtk_installation_dir);
if (been_here)
- return gtk_sysconf_dir;
+ return gtk_installation_dir;
been_here = TRUE;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\GNU\\GTk+", 0,
KEY_QUERY_VALUE, &reg_key) != ERROR_SUCCESS
|| RegQueryValueEx (reg_key, "InstallationDirectory", 0,
- &type, gtk_sysconf_dir, &nbytes) != ERROR_SUCCESS
+ &type, gtk_installation_dir, &nbytes) != ERROR_SUCCESS
|| type != REG_SZ)
{
/* Uh oh. Use the old hard-coded %WinDir%\GTk+ value */
GetWindowsDirectory (win_dir, sizeof (win_dir));
- sprintf (gtk_sysconf_dir, "%s\\gtk+", win_dir);
+ sprintf (gtk_installation_dir, "%s\\gtk+", win_dir);
}
if (reg_key != NULL)
RegCloseKey (reg_key);
- return gtk_sysconf_dir;
+ return gtk_installation_dir;
}
static gchar *
@@ -291,7 +291,7 @@ get_themes_directory (void)
{
static gchar themes_dir[200];
- sprintf (themes_dir, "%s\\themes", get_gtk_sysconf_directory ());
+ sprintf (themes_dir, "%s\\themes", gtk_win32_get_installation_directory ());
return themes_dir;
}
@@ -398,7 +398,7 @@ gtk_rc_add_initial_default_files (void)
#ifndef G_OS_WIN32
str = g_strdup (GTK_SYSCONFDIR G_DIR_SEPARATOR_S "gtk-2.0" G_DIR_SEPARATOR_S "gtkrc");
#else
- str = g_strdup_printf ("%s\\gtkrc", get_gtk_sysconf_directory ());
+ str = g_strdup_printf ("%s\\gtkrc", gtk_win32_get_installation_directory ());
#endif
gtk_rc_add_default_file (str);
diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h
index cba8e1f84..942a27a25 100644
--- a/gtk/gtkrc.h
+++ b/gtk/gtkrc.h
@@ -186,6 +186,11 @@ guint gtk_rc_parse_state (GScanner *scanner,
guint gtk_rc_parse_priority (GScanner *scanner,
GtkPathPriorityType *priority);
+#ifdef G_OS_WIN32
+
+gchar *gtk_win32_get_installation_directory (void);
+
+#endif
#ifdef __cplusplus