gdk/win32/gdkprivate-win32.h Rename all global variables and functions to

2002-11-12  Tor Lillqvist  <tml@iki.fi>

	* gdk/win32/gdkprivate-win32.h
	* gdk/win32/*.c: Rename all global variables and functions to
	start with underscore.

	Merge from stable:

	More work on the Win32 backend. The cause of some scrolling
	problems was that SetWindowPos() and ScrollWindowEx() don't blit
	those parts of the window they think are invalid. As we didn't
	keep Windows's update region in synch with GDK's, Windows thought
	those areas that in fact had been updated were invalid. Calling
	ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
	be an elegant and efficient solution, removing from Windows's
	update region those areas we are about to repaint proactively.

	In some cases garbage leftover values were used for the clip
	origin in GdkGCWin32. This showed up as odd blank areas around the
	pixmaps included in the Text Widget in gtk-demo.

	Having the clip region either as a GdkRegion or a HRGN in
	GdkGCWin32 was unnecessary, it's better to just use a HRGN.

	The translation and antiexpose queue handling in
	gdkgeometry-win32.c seems unnecessary (and not implementable in
	the same way as on X11 anyway, no serial numbers) on Windows,
	ifdeffed out.

	Don't (try to) do guffaw scrolling as there is no static window
	gravity on Windows. Guffaw scrolling would be unnecessary anyway,
	as there is the ScrollWindow() API. This improves the behaviour of
	the Text Widget demo in gtk-demo a lot. But I have no idea how the
	lack of static win gravity should be handled in other places where
	the X11 code uses it. Especially _gdk_window_move_resize_child().

	There is still some problem in expose handling. By moving an
	obscuring window back and forth over testgtk's main window, for
	instance, every now and then you typically get narrow vertical or
	horizontal strips of pixels that haven't been properly redrawn
	after being exposed. A fencepost error somewhere?

	Otherwise, all of testgtk and gtk-demo except "big windows" now
	seem to work pretty well.

	Bug #79720 should be fixed now.

	* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
	gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
	gdk_win32_print_hpalette)
	* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
	* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
	Move all debugging helper functions to gdkmain-win32.c.

	* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
	Rewrite. Make static. Must take tile origin parameters, too.

	(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
	_gdk_win32_draw_tiles(). Remove #if 0 code.

	(blit_inside_window): Don't call ScrollDC(), that didn't work at
	all like I thought. A simple call to BitBlt() is enough.

	* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
	latin_locale_loaded variable.

	(_gdk_win32_get_next_tick): New function. Used to make sure
	timestamps of events are always increasing, both in events
	generated from the window procedure and in events gotten via
	PeekMessage(). Not sure whether this is actually useful, but it
	seemed as a good idea.

	(real_window_procedure): Don't use a local GdkEventPrivate
	variable. Don't attempt any compression of configure or expose
	events here, handled elsewhere.

	(erase_background): Accumulate window offsets when traversing up
	the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
	correct alignment of background pixmaps. Don't fill with
	BLACK_BRUSH if GDK_NO_BG.

	(gdk_event_get_graphics_expose): A bit more verbose debugging output.

	(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
	WM_PAINT handler, don't check for empty update rect. When we get a
	WM_PAINT, the update region isn't empty. And if it for some
	strange reason is, that will be handled later anyway. Call
	GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
	empty the update region).

	* gdk/win32/gdkdnd-win32.c
	* gdk/win32/gdkinput-win32.c:
	Use _gdk_win32_get_next_tick().

	* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.

	(gdk_text_size): Remove, unused.

	* gdk/win32/gdkgc-win32.c:  Set clip origins to zero
	when appropriate.

	(gdk_gc_copy): Increase refcount on colormap if present.

	(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
	combine it with clip region after selecting into the DC.

	(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.

	(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
	extracted from gdk_win32_hdc_get().

	* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
	handling.

	(gdk_window_copy_area_scroll): Increase clipRect to avoid
	ScrollWindowEx() not scrolling pixels it thinks are invalid.
	Scroll also children with the ScrollWindowEx() call. No need to
	call gdk_window_move() on the children.

	(gdk_window_scroll): Don't do guffaw scrolling.

	(gdk_window_compute_position): Fix typo, used win32_y where x was
	intended.

	(gdk_window_premove, gdk_window_postmove,
	gdk_window_clip_changed): Add debugging output.

	(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
	on the region.

	(_gdk_window_process_expose): No use for the serial number
	parameter now. Instead of a rectangle, take a region parameter, as
	Windows gives us one in WM_PAINT.

	* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
	_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
	_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
	_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
	_gdk_win32_gdkregion_to_string): New debugging functions.

	(static_printf): Helper function for the above. sprintfs into a
	static circular buffer, return value should be used "soon".

	* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
	leak, free list after use.

	(gdk_window_gravity_works): Remove, we know that there is no such
	thing on Windows.

	(gdk_window_set_static_bit_gravity,
	gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
	anything anyway.

	(_gdk_windowing_window_init, gdk_window_foreign_new): Call
	_gdk_window_init_position() like in the X11 backend.

	(gdk_window_reparent): Don't call the now nonexistent
	gdk_window_set_static_win_gravity(). No idea what should be done
	instead.

	(gdk_window_get_geometry): The returned x and y should be relative
	to parent. Used to be always zero..

	(gdk_window_set_static_gravities): Return FALSE if trying to set
	static gravity.

	* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
	GdkGCWin32. Only use the HRGN hcliprgn. Declare new
	functions.

	* gdk/win32/*.c: Use new debugging functions.

	* gdk/win32/rc/gdk.rc.in: Update copyright year.
This commit is contained in:
Tor Lillqvist 2002-11-12 22:17:48 +00:00 committed by Tor Lillqvist
parent 3c321d9f53
commit e96a41be45
24 changed files with 2428 additions and 1383 deletions

175
ChangeLog
View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -1,3 +1,178 @@
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well. (Well, that is in the stable branch, I
haven't really tested HEAD. Only checked that gdk/win32 compiles.)
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
Tue Nov 12 16:51:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinputdialog.c: Make multihead aware (#80283)

View File

@ -118,92 +118,6 @@ gdk_colormap_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gint
palette_size (HPALETTE hpal)
{
WORD npal = 0;
if (!GetObject (hpal, sizeof (npal), &npal))
WIN32_GDI_FAILED ("GetObject (HPALETTE)");
return npal;
}
#ifdef G_ENABLE_DEBUG
gchar *
gdk_win32_color_to_string (const GdkColor *color)
{
static char buf[100];
sprintf (buf, "(%.04x,%.04x,%.04x):%.06x",
color->red, color->green, color->blue, color->pixel);
return buf;
}
void
gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
const int nentries)
{
char buf[20];
int i;
for (i = 0; i < nentries; i++)
g_print (" %3d %02x: %02x %02x %02x%s\n",
i, i,
pep[i].peRed, pep[i].peGreen, pep[i].peBlue,
(pep[i].peFlags == 0 ? "" :
(pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" :
(pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" :
(pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" :
(sprintf (buf, " %d", pep[i].peFlags), buf))))));
}
void
gdk_win32_print_system_palette (void)
{
PALETTEENTRY *pe;
int k;
k = GetSystemPaletteEntries (gdk_display_hdc, 0, 0, NULL);
pe = g_new (PALETTEENTRY, k);
k = GetSystemPaletteEntries (gdk_display_hdc, 0, k, pe);
if (!k)
g_print ("GetSystemPaletteEntries failed: %s\n",
g_win32_error_message (GetLastError ()));
else
{
g_print ("System palette: %d entries\n", k);
gdk_win32_print_paletteentries (pe, k);
}
g_free (pe);
}
void
gdk_win32_print_hpalette (HPALETTE hpal)
{
PALETTEENTRY *pe;
gint n, npal;
npal = palette_size (hpal);
pe = g_new (PALETTEENTRY, npal);
n = GetPaletteEntries (hpal, 0, npal, pe);
if (!n)
g_print ("HPALETTE %p: GetPaletteEntries failed: %s\n",
hpal, g_win32_error_message (GetLastError ()));
else
{
g_print ("HPALETTE %p: %d (%d) entries\n", hpal, n, npal);
gdk_win32_print_paletteentries (pe, n);
}
g_free (pe);
}
#endif
/* Mimics XAllocColorCells. Allocate read/write color cells. */
static gboolean
@ -431,7 +345,7 @@ alloc_color (GdkColormap *cmap,
case GDK_VISUAL_TRUE_COLOR:
/* Determine what color will actually be used on non-colormap systems. */
*pixelp = GetNearestColor (gdk_display_hdc, new_pixel);
*pixelp = GetNearestColor (_gdk_display_hdc, new_pixel);
color->peRed = GetRValue (*pixelp);
color->peGreen = GetGValue (*pixelp);
color->peBlue = GetBValue (*pixelp);
@ -502,7 +416,7 @@ free_colors (GdkColormap *cmap,
}
}
#if 0
GDK_NOTE (COLORMAP, gdk_win32_print_hpalette (cmapp->hpal));
GDK_NOTE (COLORMAP, _gdk_win32_print_hpalette (cmapp->hpal));
#else
GDK_NOTE (COLORMAP, (set_black_count > 0 ?
g_print ("free_colors: %d (%d) set to black\n",
@ -550,7 +464,7 @@ create_colormap (GdkColormap *cmap,
lp.pal.palPalEntry[i].peFlags = 0;
GDK_NOTE (COLORMAP, (g_print ("Default palette %p: %d entries\n",
hpal, lp.pal.palNumEntries),
gdk_win32_print_paletteentries (lp.pal.palPalEntry,
_gdk_win32_print_paletteentries (lp.pal.palPalEntry,
lp.pal.palNumEntries)));
DeleteObject (hpal);
@ -604,7 +518,7 @@ sync_colors (GdkColormap *colormap)
GDK_NOTE (COLORMAP, (g_print ("sync_colors: %p hpal=%p: %d entries\n",
private, private->hpal, nlookup),
gdk_win32_print_paletteentries (pe, nlookup)));
_gdk_win32_print_paletteentries (pe, nlookup)));
for (i = 0; i < nlookup; i++)
{

View File

@ -73,7 +73,7 @@ _gdk_win32_data_to_wcursor (GdkCursorType cursor_type)
#undef SET_BIT
#undef RESET_BIT
rv = CreateCursor (gdk_app_hmodule, cursors[i].hotx, cursors[i].hoty,
rv = CreateCursor (_gdk_app_hmodule, cursors[i].hotx, cursors[i].hoty,
w, h, and_plane, xor_plane);
if (rv == NULL)
WIN32_API_FAILED ("CreateCursor");
@ -264,7 +264,7 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
q[-1] |= residue; /* Set left-over bits */
}
hcursor = CreateCursor (gdk_app_hmodule, x, y, cursor_width, cursor_height,
hcursor = CreateCursor (_gdk_app_hmodule, x, y, cursor_width, cursor_height,
and_mask, xor_mask);
GDK_NOTE (MISC, g_print ("gdk_cursor_new_from_pixmap: "

View File

@ -965,7 +965,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
gdk_drawable_ref (context->dest_window);
/* WM_DROPFILES drops are always file names */
context->targets =
g_list_append (NULL, GUINT_TO_POINTER (text_uri_list));
g_list_append (NULL, GUINT_TO_POINTER (_text_uri_list));
current_dest_drag = context;
event->dnd.type = GDK_DROP_START;
@ -977,7 +977,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
event->dnd.x_root = pt.x;
event->dnd.y_root = pt.y;
event->dnd.time = msg->time;
event->dnd.time = _gdk_win32_get_next_tick (msg->time);
nfiles = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
@ -1675,11 +1675,11 @@ GdkAtom
gdk_drag_get_selection (GdkDragContext *context)
{
if (context->protocol == GDK_DRAG_PROTO_LOCAL)
return local_dnd;
return _local_dnd;
else if (context->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES)
return gdk_win32_dropfiles;
return _gdk_win32_dropfiles;
else if (context->protocol == GDK_DRAG_PROTO_OLE2)
return gdk_ole2_dnd;
return _gdk_ole2_dnd;
else
return GDK_NONE;
}

View File

@ -123,39 +123,6 @@ static void gdk_drawable_impl_win32_finalize (GObject *object);
static gpointer parent_class = NULL;
#ifdef G_ENABLE_DEBUG
gchar *
gdk_win32_drawable_description (GdkDrawable *d)
{
GdkVisual *v;
static gchar buf[1000];
static gchar *bufp = buf;
gchar *msg;
gint width, height;
gchar *retval;
gdk_drawable_get_size (d, &width, &height);
msg = g_strdup_printf
("%s:%p:%dx%dx%d",
G_OBJECT_TYPE_NAME (d),
GDK_DRAWABLE_HANDLE (d),
width, height,
(GDK_IS_PIXMAP (d) ? GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (d)->impl)->image->depth
: ((v = gdk_drawable_get_visual (d)) ? v->depth : gdk_visual_get_system ()->depth)));
if (bufp + strlen (msg) + 1 > buf + sizeof (buf))
bufp = buf;
retval = bufp;
strcpy (bufp, msg);
bufp += strlen (msg) + 1;
g_free (msg);
return retval;
}
#endif
GType
gdk_drawable_impl_win32_get_type (void)
{
@ -322,6 +289,59 @@ render_line_vertical (HDC hdc,
return TRUE;
}
static void
_gdk_win32_draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *tile,
gint dest_x,
gint dest_y,
gint tile_x_origin,
gint tile_y_origin,
gint width,
gint height)
{
gint x, y;
gint tile_width, tile_height;
GDK_NOTE (MISC, g_print ("_gdk_win32_draw_tiles: %s +%d+%d tile=%s@+%d+%d %dx%d\n",
_gdk_win32_drawable_description (drawable),
dest_x, dest_y,
_gdk_win32_drawable_description (tile),
tile_x_origin, tile_y_origin,
width, height));
gdk_drawable_get_size (tile, &tile_width, &tile_height);
y = tile_y_origin % tile_height;
if (y > 0)
y -= tile_height;
while (y < dest_y + height)
{
if (y + tile_height >= dest_y)
{
x = tile_x_origin % tile_width;
if (x > 0)
x -= tile_width;
while (x < dest_x + width)
{
if (x + tile_width >= dest_x)
{
gint src_x = MAX (0, dest_x - x);
gint src_y = MAX (0, dest_y - y);
gdk_draw_drawable (drawable, gc, tile,
src_x, src_y,
x + src_x, y + src_y,
MIN (tile_width, dest_x + width - (x + src_x)),
MIN (tile_height, dest_y + height - (y + src_y)));
}
x += tile_width;
}
}
y += tile_height;
}
}
static void
gdk_win32_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
@ -339,41 +359,27 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gboolean ok = TRUE;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %s (%p) %s%dx%d@+%d+%d\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
gc_private,
(filled ? "fill " : ""),
width, height, x, y));
if (filled
&& (gc_private->tile)
&& (gc_private->values_mask & GDK_GC_TILE)
&& (gc_private->values_mask & GDK_GC_FILL))
&& (gc_private->tile)
&& (gc_private->values_mask & GDK_GC_FILL)
&& (gc_private->fill_style == GDK_TILED))
{
_gdk_win32_draw_tiles (drawable, gc, gc_private->tile, x, y, width, height);
_gdk_win32_draw_tiles (drawable, gc, gc_private->tile,
x, y,
gc->ts_x_origin,
gc->ts_y_origin,
width, height);
return;
}
hdc = gdk_win32_hdc_get (drawable, gc, mask);
#if 0
{
HBRUSH hbr = GetCurrentObject (hdc, OBJ_BRUSH);
HPEN hpen = GetCurrentObject (hdc, OBJ_PEN);
LOGBRUSH lbr;
LOGPEN lpen;
GetObject (hbr, sizeof (lbr), &lbr);
GetObject (hpen, sizeof (lpen), &lpen);
g_print ("current brush: style = %s, color = 0x%.08x\n",
(lbr.lbStyle == BS_SOLID ? "SOLID" : "???"),
lbr.lbColor);
g_print ("current pen: style = %s, width = %d, color = 0x%.08x\n",
(lpen.lopnStyle == PS_SOLID ? "SOLID" : "???"),
lpen.lopnWidth,
lpen.lopnColor);
}
#endif
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
@ -466,7 +472,7 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
int nXStartArc, nYStartArc, nXEndArc, nYEndArc;
GDK_NOTE (MISC, g_print ("gdk_draw_arc: %s %d,%d,%d,%d %d %d\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
x, y, width, height, angle1, angle2));
/* Seems that drawing arcs with width or height <= 2 fails, at least
@ -537,7 +543,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
int i;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %s (%p) %d\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
gc_private,
npoints));
@ -662,7 +668,7 @@ gdk_win32_draw_text (GdkDrawable *drawable,
arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
GDK_NOTE (MISC, g_print ("gdk_draw_text: %s (%d,%d) \"%.*s\" (len %d)\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
x, y,
(text_length > 10 ? 10 : text_length),
text, text_length));
@ -711,7 +717,7 @@ gdk_win32_draw_text_wc (GdkDrawable *drawable,
arg.hdc = gdk_win32_hdc_get (drawable, gc, mask);
GDK_NOTE (MISC, g_print ("gdk_draw_text_wc: %s (%d,%d) len: %d\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
x, y, text_length));
if (sizeof (wchar_t) != sizeof (GdkWChar))
@ -750,49 +756,6 @@ gdk_win32_draw_drawable (GdkDrawable *drawable,
xdest, ydest, width, height);
}
void
_gdk_win32_draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *tile,
gint x_from,
gint y_from,
gint max_width,
gint max_height)
{
gint x = x_from, y = y_from;
gint tile_width, tile_height;
gint width, height;
GDK_NOTE (MISC, g_print ("_gdk_win32_draw_tiles: %s tile=%s +%d+%d %d,%d\n",
gdk_win32_drawable_description (drawable),
gdk_win32_drawable_description (tile),
x_from, y_from, max_width, max_height));
gdk_drawable_get_size (drawable, &width, &height);
gdk_drawable_get_size (tile, &tile_width, &tile_height);
width = MIN (width, max_width);
height = MIN (height, max_height);
tile_width = MIN (tile_width, max_width);
tile_height = MIN (tile_height, max_height);
while (y < height)
{
x = x_from;
while (x < width)
{
gdk_draw_drawable (drawable, gc, tile,
x % tile_width, /* xsrc */
y % tile_height, /* ysrc */
x, y, /* dest */
tile_width, tile_height);
x += tile_width;
}
y += tile_height;
}
}
static void
gdk_win32_draw_points (GdkDrawable *drawable,
GdkGC *gc,
@ -810,7 +773,7 @@ gdk_win32_draw_points (GdkDrawable *drawable,
fg = _gdk_win32_colormap_color (impl->colormap, gc_private->foreground);
GDK_NOTE (MISC, g_print ("gdk_draw_points: %s %dx%.06x\n",
gdk_win32_drawable_description (drawable),
_gdk_win32_drawable_description (drawable),
npoints, (guint) fg));
for (i = 0; i < npoints; i++)
@ -832,7 +795,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
int i;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_segments: %s nsegs: %d\n",
gdk_win32_drawable_description (drawable), nsegs));
_gdk_win32_drawable_description (drawable), nsegs));
hdc = gdk_win32_hdc_get (drawable, gc, mask);
@ -1235,34 +1198,11 @@ blit_inside_window (GdkDrawableImplWin32 *window,
gint height)
{
RECT scrollRect, clipRect, emptyRect;
HRGN updateRgn;
GDK_NOTE (MISC, g_print ("blit_inside_window\n"));
scrollRect.left = MIN (xsrc, xdest);
scrollRect.top = MIN (ysrc, ydest);
scrollRect.right = MAX (xsrc + width + 1, xdest + width + 1);
scrollRect.bottom = MAX (ysrc + height + 1, ydest + height + 1);
clipRect.left = xdest;
clipRect.top = ydest;
clipRect.right = xdest + width + 1;
clipRect.bottom = ydest + height + 1;
SetRectEmpty (&emptyRect);
updateRgn = CreateRectRgnIndirect (&emptyRect);
if (!ScrollDC (hdc, xdest - xsrc, ydest - ysrc,
&scrollRect, &clipRect,
updateRgn, NULL))
WIN32_GDI_FAILED ("ScrollDC");
else if (!InvalidateRgn (window->handle, updateRgn, FALSE))
WIN32_GDI_FAILED ("InvalidateRgn");
else if (!UpdateWindow (window->handle))
WIN32_GDI_FAILED ("UpdateWindow");
if (!DeleteObject (updateRgn))
WIN32_GDI_FAILED ("DeleteObject");
if (!BitBlt (hdc, xdest, ydest, width, height,
hdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
}
static void
@ -1333,9 +1273,9 @@ _gdk_win32_blit (gboolean use_fg_bg,
GDK_NOTE (MISC, g_print ("_gdk_win32_blit: src:%s %dx%d@+%d+%d\n"
" dst:%s @+%d+%d use_fg_bg=%d\n",
gdk_win32_drawable_description (src),
_gdk_win32_drawable_description (src),
width, height, xsrc, ysrc,
gdk_win32_drawable_description ((GdkDrawable *) drawable),
_gdk_win32_drawable_description ((GdkDrawable *) drawable),
xdest, ydest,
use_fg_bg));

View File

@ -136,7 +136,19 @@ static PFN_TrackMouseEvent track_mouse_event = NULL;
static gboolean use_ime_composition = FALSE;
static HKL latin_locale = NULL;
static gboolean latin_locale_loaded = FALSE;
gulong
_gdk_win32_get_next_tick (gulong suggested_tick)
{
static gulong cur_tick = 0;
if (suggested_tick == 0)
suggested_tick = GetTickCount ();
if (suggested_tick <= cur_tick)
return ++cur_tick;
else
return cur_tick = suggested_tick;
}
static LRESULT
real_window_procedure (HWND hwnd,
@ -146,8 +158,7 @@ real_window_procedure (HWND hwnd,
{
/* any way to have more than one display on win32 ? */
GdkDisplay *display = gdk_display_get_default ();
GdkEventPrivate event;
GdkEvent *eventp;
GdkEvent *event;
MSG msg;
DWORD pos;
#ifdef HAVE_DIMM_H
@ -160,66 +171,16 @@ real_window_procedure (HWND hwnd,
msg.message = message;
msg.wParam = wparam;
msg.lParam = lparam;
msg.time = GetTickCount ();
msg.time = _gdk_win32_get_next_tick (0);
pos = GetMessagePos ();
msg.pt.x = LOWORD (pos);
msg.pt.y = HIWORD (pos);
event.flags = GDK_EVENT_PENDING;
event.screen = NULL;
if (gdk_event_translate (display, &event.event, &msg, &ret_val_flag, &ret_val, FALSE))
event = gdk_event_new (GDK_NOTHING);
((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
if (gdk_event_translate (display, event, &msg, &ret_val_flag, &ret_val, FALSE))
{
event.flags &= ~GDK_EVENT_PENDING;
#if 1
if (event.event.any.type == GDK_CONFIGURE)
{
/* Compress configure events */
GList *list = display->queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_CONFIGURE
|| ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GDK_NOTE (EVENTS, g_print ("... compressing an CONFIGURE event\n"));
*((GdkEvent *)list->data) = event.event;
gdk_drawable_unref (event.event.any.window);
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
return FALSE;
}
}
else if (event.event.any.type == GDK_EXPOSE)
{
/* Compress expose events */
GList *list = display->queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_EXPOSE
|| ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GdkRectangle u;
GDK_NOTE (EVENTS, g_print ("... compressing an EXPOSE event\n"));
gdk_rectangle_union (&event.event.expose.area,
&((GdkEvent *)list->data)->expose.area,
&u);
((GdkEvent *)list->data)->expose.area = u;
gdk_drawable_unref (event.event.any.window);
#if 0
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
#endif
return FALSE;
}
}
#endif
eventp = gdk_event_new (GDK_NOTHING);
*((GdkEventPrivate *) eventp) = event;
((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
/* Philippe Colantoni <colanton@aris.ss.uci.edu> suggests this
* in order to handle events while opaque resizing neatly. I
@ -227,21 +188,21 @@ real_window_procedure (HWND hwnd,
* GDK_EVENT_FUNC_FROM_WINDOW_PROC env var to get this
* behaviour.
*/
if (gdk_event_func_from_window_proc && _gdk_event_func)
if (_gdk_event_func_from_window_proc && _gdk_event_func)
{
GDK_THREADS_ENTER ();
(*_gdk_event_func) (eventp, _gdk_event_data);
gdk_event_free (eventp);
(*_gdk_event_func) (event, _gdk_event_data);
gdk_event_free (event);
GDK_THREADS_LEAVE ();
}
else
{
_gdk_event_queue_append (display, eventp);
_gdk_event_queue_append (display, event);
if (eventp->type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, eventp);
if (event->type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
#if 1
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
@ -253,6 +214,8 @@ real_window_procedure (HWND hwnd,
else
return FALSE;
}
else
gdk_event_free (event);
if (ret_val_flag)
return ret_val;
@ -279,12 +242,12 @@ _gdk_win32_window_procedure (HWND hwnd,
LRESULT retval;
GDK_NOTE (MISC, g_print ("_gdk_win32_window_procedure: %p %s\n",
hwnd, gdk_win32_message_name (message)));
hwnd, _gdk_win32_message_to_string (message)));
retval = real_window_procedure (hwnd, message, wparam, lparam);
GDK_NOTE (MISC, g_print ("_gdk_win32_window_procedure: %p returns %ld\n",
hwnd, retval));
GDK_NOTE (MISC, g_print ("_gdk_win32_window_procedure: %p %s return %ld\n",
hwnd, _gdk_win32_message_to_string (message), retval));
return retval;
}
@ -383,8 +346,6 @@ _gdk_events_init (void)
char id[9];
sprintf (id, "%08x", MAKELANGID (latin_languages[i++], SUBLANG_DEFAULT));
latin_locale = LoadKeyboardLayout (id, KLF_NOTELLSHELL|KLF_SUBSTITUTE_OK);
if (latin_locale != NULL)
latin_locale_loaded = TRUE;
}
}
@ -437,7 +398,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 & 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
@ -510,11 +471,15 @@ gdk_event_get_graphics_expose (GdkWindow *window)
if (gdk_event_translate (gdk_drawable_get_display (window),
event, &msg, NULL, NULL, TRUE))
return event;
{
GDK_NOTE (EVENTS, g_print ("gdk_event_get_graphics_expose: got it!\n"));
return event;
}
else
gdk_event_free (event);
}
GDK_NOTE (EVENTS, g_print ("gdk_event_get_graphics_expose: nope\n"));
return NULL;
#endif
}
@ -529,27 +494,27 @@ event_mask_string (GdkEventMask mask)
#define BIT(x) \
if (mask & GDK_##x##_MASK) \
p += sprintf (p, "%s" #x, (p > bfr ? " " : ""))
BIT(EXPOSURE);
BIT(POINTER_MOTION);
BIT(POINTER_MOTION_HINT);
BIT(BUTTON_MOTION);
BIT(BUTTON1_MOTION);
BIT(BUTTON2_MOTION);
BIT(BUTTON3_MOTION);
BIT(BUTTON_PRESS);
BIT(BUTTON_RELEASE);
BIT(KEY_PRESS);
BIT(KEY_RELEASE);
BIT(ENTER_NOTIFY);
BIT(LEAVE_NOTIFY);
BIT(FOCUS_CHANGE);
BIT(STRUCTURE);
BIT(PROPERTY_CHANGE);
BIT(VISIBILITY_NOTIFY);
BIT(PROXIMITY_IN);
BIT(PROXIMITY_OUT);
BIT(SUBSTRUCTURE);
BIT(SCROLL);
BIT (EXPOSURE);
BIT (POINTER_MOTION);
BIT (POINTER_MOTION_HINT);
BIT (BUTTON_MOTION);
BIT (BUTTON1_MOTION);
BIT (BUTTON2_MOTION);
BIT (BUTTON3_MOTION);
BIT (BUTTON_PRESS);
BIT (BUTTON_RELEASE);
BIT (KEY_PRESS);
BIT (KEY_RELEASE);
BIT (ENTER_NOTIFY);
BIT (LEAVE_NOTIFY);
BIT (FOCUS_CHANGE);
BIT (STRUCTURE);
BIT (PROPERTY_CHANGE);
BIT (VISIBILITY_NOTIFY);
BIT (PROXIMITY_IN);
BIT (PROXIMITY_OUT);
BIT (SUBSTRUCTURE);
BIT (SCROLL);
#undef BIT
return bfr;
@ -941,7 +906,7 @@ build_keypress_event (GdkEvent *event,
wchar_t wbuf[100];
event->key.type = GDK_KEY_PRESS;
event->key.time = msg->time;
event->key.time = _gdk_win32_get_next_tick (msg->time);
event->key.state = 0;
event->key.group = 0; /* ??? */
event->key.keyval = GDK_VoidSymbol;
@ -1033,12 +998,13 @@ build_keyrelease_event (GdkEvent *event,
wchar_t wbuf;
event->key.type = GDK_KEY_RELEASE;
event->key.time = msg->time;
event->key.time = _gdk_win32_get_next_tick (msg->time);
event->key.state = 0;
event->key.group = 0; /* ??? */
if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
{
event->key.hardware_keycode = vk_from_char (msg->wParam);
if (msg->wParam < ' ')
{
event->key.keyval = msg->wParam + '@';
@ -1052,7 +1018,6 @@ build_keyrelease_event (GdkEvent *event,
event->key.keyval = gdk_unicode_to_keyval (wbuf);
}
event->key.hardware_keycode = vk_from_char (msg->wParam);
}
else
{
@ -1145,11 +1110,8 @@ print_event (GdkEvent *event)
switch (event->any.type)
{
case GDK_EXPOSE:
g_print ("%dx%d@+%d+%d %d",
event->expose.area.width,
event->expose.area.height,
event->expose.area.x,
event->expose.area.y,
g_print ("%s %d",
_gdk_win32_gdkrectangle_to_string (&event->expose.area),
event->expose.count);
break;
case GDK_MOTION_NOTIFY:
@ -1240,7 +1202,7 @@ synthesize_enter_or_leave_event (GdkWindow *window,
event->crossing.send_event = FALSE;
gdk_window_ref (event->crossing.window);
event->crossing.subwindow = NULL;
event->crossing.time = msg->time;
event->crossing.time = _gdk_win32_get_next_tick (msg->time);
event->crossing.x = x;
event->crossing.y = y;
event->crossing.x_root = msg->pt.x;
@ -1720,12 +1682,18 @@ erase_background (GdkWindow *window,
COLORREF bg;
GdkColormap *colormap;
GdkColormapPrivateWin32 *colormap_private;
int i, j;
int x, y;
int x_offset, y_offset;
if (GDK_WINDOW_OBJECT (window)->input_only ||
GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_NO_BG ||
GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
return;
if (((GdkWindowObject *) window)->input_only ||
((GdkWindowObject *) window)->bg_pixmap == GDK_NO_BG ||
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
{
GDK_NOTE (EVENTS, g_print (((GdkWindowObject *) window)->input_only ? "...input_only\n" :
((GdkWindowObject *) window)->bg_pixmap == GDK_NO_BG ? "GDK_NO_BG" :
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg ? "no_bg\n" : "???\n"));
return;
}
colormap = gdk_drawable_get_colormap (window);
@ -1742,37 +1710,44 @@ erase_background (GdkWindow *window,
else if ((k = RealizePalette (hdc)) == GDI_ERROR)
WIN32_GDI_FAILED ("RealizePalette");
else if (k > 0)
GDK_NOTE (COLORMAP, g_print ("gdk_win32_erase_background: realized %p: %d colors\n",
GDK_NOTE (COLORMAP, g_print ("erase_background: realized %p: %d colors\n",
colormap_private->hpal, k));
}
while (window && GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
x_offset = y_offset = 0;
while (window && ((GdkWindowObject *) 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.)
*/
window = GDK_WINDOW (GDK_WINDOW_OBJECT (window)->parent);
x_offset += ((GdkWindowObject *) window)->x;
y_offset += ((GdkWindowObject *) window)->y;
window = GDK_WINDOW (((GdkWindowObject *) window)->parent);
}
if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
if (GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
{
GDK_NOTE (EVENTS, g_print ("no_bg on ancestor (?)\n"));
/* Improves scolling effect, e.g. main buttons of testgtk */
return;
}
if (GDK_WINDOW_OBJECT (window)->bg_pixmap == NULL)
GetClipBox (hdc, &rect);
GDK_NOTE (EVENTS, (hbr = GetStockObject (BLACK_BRUSH),
FillRect (hdc, &rect, hbr),
GdiFlush (),
Sleep (200)));
if (((GdkWindowObject *) window)->bg_pixmap == NULL)
{
bg = _gdk_win32_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap,
GDK_WINDOW_OBJECT (window)->bg_color.pixel);
bg = _gdk_win32_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->colormap,
((GdkWindowObject *) window)->bg_color.pixel);
GetClipBox (hdc, &rect);
GDK_NOTE (EVENTS,
g_print ("...%ldx%ld@+%ld+%ld bg %06lx\n",
rect.right - rect.left,
rect.bottom - rect.top,
rect.left, rect.top,
(gulong) bg));
GDK_NOTE (EVENTS, g_print ("...%s bg %06lx\n",
_gdk_win32_rect_to_string (&rect),
(gulong) bg));
if (!(hbr = CreateSolidBrush (bg)))
WIN32_GDI_FAILED ("CreateSolidBrush");
else if (!FillRect (hdc, &rect, hbr))
@ -1780,15 +1755,13 @@ erase_background (GdkWindow *window,
if (hbr != NULL)
DeleteObject (hbr);
}
else if (GDK_WINDOW_OBJECT (window)->bg_pixmap != NULL &&
GDK_WINDOW_OBJECT (window)->bg_pixmap != GDK_NO_BG)
else if (((GdkWindowObject *) window)->bg_pixmap != GDK_NO_BG)
{
GdkPixmap *pixmap = GDK_WINDOW_OBJECT (window)->bg_pixmap;
GdkPixmap *pixmap = ((GdkWindowObject *) window)->bg_pixmap;
GdkPixmapImplWin32 *pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
GetClipBox (hdc, &rect);
if (pixmap_impl->width <= 8 && pixmap_impl->height <= 8)
if (x_offset == 0 && y_offset == 0 &&
pixmap_impl->width <= 8 && pixmap_impl->height <= 8)
{
GDK_NOTE (EVENTS, g_print ("...small pixmap, using brush\n"));
if (!(hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (pixmap))))
@ -1804,12 +1777,10 @@ erase_background (GdkWindow *window,
GDK_NOTE (EVENTS,
g_print ("...blitting pixmap %p (%dx%d) "
"all over the place,\n"
"...clip box = %ldx%ld@+%ld+%ld\n",
" clip box = %s\n",
GDK_PIXMAP_HBITMAP (pixmap),
pixmap_impl->width, pixmap_impl->height,
rect.right - rect.left, rect.bottom - rect.top,
rect.left, rect.top));
_gdk_win32_rect_to_string (&rect)));
if (!(bgdc = CreateCompatibleDC (hdc)))
{
@ -1822,41 +1793,35 @@ erase_background (GdkWindow *window,
DeleteDC (bgdc);
return;
}
i = 0;
while (i < rect.right)
x = -x_offset;
while (x < rect.right)
{
j = 0;
while (j < rect.bottom)
if (x + pixmap_impl->width >= rect.left)
{
if (i + pixmap_impl->width >= rect.left
&& j + pixmap_impl->height >= rect.top)
y = -y_offset;
while (y < rect.bottom)
{
if (!BitBlt (hdc, i, j,
pixmap_impl->width, pixmap_impl->height,
bgdc, 0, 0, SRCCOPY))
if (y + pixmap_impl->height >= rect.top)
{
WIN32_GDI_FAILED ("BitBlt");
SelectObject (bgdc, oldbitmap);
DeleteDC (bgdc);
return;
if (!BitBlt (hdc, x, y,
pixmap_impl->width, pixmap_impl->height,
bgdc, 0, 0, SRCCOPY))
{
WIN32_GDI_FAILED ("BitBlt");
SelectObject (bgdc, oldbitmap);
DeleteDC (bgdc);
return;
}
}
y += pixmap_impl->height;
}
j += pixmap_impl->height;
}
i += pixmap_impl->width;
x += pixmap_impl->width;
}
SelectObject (bgdc, oldbitmap);
DeleteDC (bgdc);
}
}
else
{
GDK_NOTE (EVENTS, g_print ("...BLACK_BRUSH (?)\n"));
hbr = GetStockObject (BLACK_BRUSH);
GetClipBox (hdc, &rect);
if (!FillRect (hdc, &rect, hbr))
WIN32_GDI_FAILED ("FillRect");
}
}
static GdkRegion *
@ -1939,7 +1904,6 @@ gdk_event_translate (GdkDisplay *display,
static gint update_colors_counter = 0;
gint button;
gint k;
gchar buf[256];
gboolean return_val = FALSE;
@ -1974,10 +1938,10 @@ gdk_event_translate (GdkDisplay *display,
* removed it. Repost the same message to our queue so that
* we will get it later when we are prepared.
*/
GDK_NOTE (MISC, g_print("gdk_event_translate: %p %s posted.\n",
msg->hwnd,
msg->message == WM_MOVE ?
"WM_MOVE" : "WM_SIZE"));
GDK_NOTE (MISC, g_print ("gdk_event_translate: %p %s posted.\n",
msg->hwnd,
msg->message == WM_MOVE ?
"WM_MOVE" : "WM_SIZE"));
PostMessage (msg->hwnd, msg->message,
msg->wParam, msg->lParam);
@ -2002,7 +1966,7 @@ gdk_event_translate (GdkDisplay *display,
else
{
GDK_NOTE (EVENTS, g_print ("gdk_event_translate: %s for %p (NULL)\n",
gdk_win32_message_name(msg->message),
_gdk_win32_message_to_string (msg->message),
msg->hwnd));
}
#endif
@ -2076,7 +2040,7 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.direction = ((int) msg->wParam > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
event->scroll.window = window;
event->scroll.time = msg->time;
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->scroll.x = (gint16) pt.x + xoffset;
event->scroll.y = (gint16) pt.y + yoffset;
@ -2452,7 +2416,7 @@ gdk_event_translate (GdkDisplay *display,
event->key.type = ((msg->message == WM_KEYDOWN
|| msg->message == WM_SYSKEYDOWN) ?
GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->key.time = msg->time;
event->key.time = _gdk_win32_get_next_tick (msg->time);
event->key.state = 0;
if (GetKeyState (VK_SHIFT) < 0)
event->key.state |= GDK_SHIFT_MASK;
@ -2597,7 +2561,7 @@ gdk_event_translate (GdkDisplay *display,
p_grab_automatic = TRUE;
}
event->button.time = msg->time;
event->button.time = _gdk_win32_get_next_tick (msg->time);
if (window != orig_window)
translate_mouse_coords (orig_window, window, msg);
event->button.x = current_x = (gint16) LOWORD (msg->lParam);
@ -2654,7 +2618,7 @@ gdk_event_translate (GdkDisplay *display,
ASSIGN_WINDOW (window);
event->button.window = window;
event->button.time = msg->time;
event->button.time = _gdk_win32_get_next_tick (msg->time);
if (window != orig_window)
translate_mouse_coords (orig_window, window, msg);
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
@ -2717,7 +2681,7 @@ gdk_event_translate (GdkDisplay *display,
ASSIGN_WINDOW (window);
event->motion.window = window;
event->motion.time = msg->time;
event->motion.time = _gdk_win32_get_next_tick (msg->time);
if (window != orig_window)
translate_mouse_coords (orig_window, window, msg);
event->motion.x = current_x = (gint16) LOWORD (msg->lParam);
@ -2749,7 +2713,7 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = current_window;
event->crossing.subwindow = NULL;
event->crossing.time = msg->time;
event->crossing.time = _gdk_win32_get_next_tick (msg->time);
_gdk_windowing_window_get_offsets (current_window, &xoffset, &yoffset);
event->crossing.x = current_x + xoffset;
event->crossing.y = current_y + yoffset;
@ -2817,7 +2781,7 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
event->scroll.window = window;
event->scroll.time = msg->time;
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->scroll.x = (gint16) pt.x + xoffset;
event->scroll.y = (gint16) pt.y + yoffset;
@ -2839,7 +2803,7 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = window;
event->crossing.subwindow = NULL;
event->crossing.time = msg->time;
event->crossing.time = _gdk_win32_get_next_tick (msg->time);
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
event->crossing.x = current_x + xoffset;
event->crossing.y = current_y + yoffset;
@ -2919,8 +2883,8 @@ gdk_event_translate (GdkDisplay *display,
break;
case WM_ERASEBKGND:
GDK_NOTE (EVENTS, g_print ("WM_ERASEBKGND: %p dc %#x\n",
msg->hwnd, msg->wParam));
GDK_NOTE (EVENTS, g_print ("WM_ERASEBKGND: %p dc %p\n",
msg->hwnd, (HANDLE) msg->wParam));
if (GDK_WINDOW_DESTROYED (window))
break;
@ -2928,27 +2892,24 @@ gdk_event_translate (GdkDisplay *display,
erase_background (window, (HDC) msg->wParam);
*ret_val_flagp = TRUE; /* always claim as handled */
*ret_valp = 1;
break;
case WM_PAINT:
if (!GetUpdateRect (msg->hwnd, NULL, FALSE))
hrgn = CreateRectRgn (0, 0, 0, 0);
if (GetUpdateRgn (msg->hwnd, hrgn, FALSE) == ERROR)
{
GDK_NOTE (EVENTS, g_print ("WM_PAINT: %p no update rgn\n",
msg->hwnd));
WIN32_GDI_FAILED ("GetUpdateRgn");
break;
}
hdc = BeginPaint (msg->hwnd, &paintstruct);
GDK_NOTE (EVENTS,
g_print ("WM_PAINT: %p %ldx%ld@+%ld+%ld %s dc %p\n",
msg->hwnd,
paintstruct.rcPaint.right - paintstruct.rcPaint.left,
paintstruct.rcPaint.bottom - paintstruct.rcPaint.top,
paintstruct.rcPaint.left, paintstruct.rcPaint.top,
(paintstruct.fErase ? "erase" : ""),
hdc));
GDK_NOTE (EVENTS, g_print ("WM_PAINT: %p %s %s dc %p%s\n",
msg->hwnd,
_gdk_win32_rect_to_string (&paintstruct.rcPaint),
(paintstruct.fErase ? "erase" : ""),
hdc,
(return_exposes ? " return_exposes" : "")));
EndPaint (msg->hwnd, &paintstruct);
@ -2956,10 +2917,17 @@ gdk_event_translate (GdkDisplay *display,
* windows -> backing store now works!
*/
if (GDK_WINDOW_OBJECT (window)->input_only)
break;
{
DeleteObject (hrgn);
break;
}
if (!(private->event_mask & GDK_EXPOSURE_MASK))
break;
{
GDK_NOTE (EVENTS, g_print ("...ignored\n"));
DeleteObject (hrgn);
break;
}
#if 0 /* we need to process exposes even with GDK_NO_BG
* Otherwise The GIMP canvas update is broken ....
@ -2970,19 +2938,14 @@ gdk_event_translate (GdkDisplay *display,
if ((paintstruct.rcPaint.right == paintstruct.rcPaint.left)
|| (paintstruct.rcPaint.bottom == paintstruct.rcPaint.top))
break;
{
GDK_NOTE (EVENTS, g_print ("...empty paintstruct, ignored\n"));
DeleteObject (hrgn);
break;
}
if (return_exposes)
{
hrgn = CreateRectRgn (0, 0, 0, 0);
if ((k = GetUpdateRgn (msg->hwnd, hrgn, FALSE)) == ERROR)
WIN32_GDI_FAILED ("GetUpdateRgn");
else if (k == NULLREGION)
{
DeleteObject (hrgn);
break;
}
event->expose.type = GDK_EXPOSE;
event->expose.window = window;
event->expose.area.x = paintstruct.rcPaint.left;
@ -2992,37 +2955,34 @@ gdk_event_translate (GdkDisplay *display,
event->expose.region = _gdk_win32_hrgn_to_region (hrgn);
event->expose.count = 0;
DeleteObject (hrgn);
return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val)
{
GList *list = display->queued_events;
while (list != NULL )
{
if ((((GdkEvent *)list->data)->any.type == GDK_EXPOSE) &&
(((GdkEvent *)list->data)->any.window == window) &&
!(((GdkEventPrivate *)list->data)->flags & GDK_EVENT_PENDING))
((GdkEvent *)list->data)->expose.count++;
GdkEventPrivate *event = list->data;
if (event->event.any.type == GDK_EXPOSE &&
event->event.any.window == window &&
!(event->flags & GDK_EVENT_PENDING))
event->event.expose.count++;
list = list->next;
list = list->next;
}
}
}
else
{
GdkRectangle expose_rect;
GdkRegion *update_region = _gdk_win32_hrgn_to_region (hrgn);
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
expose_rect.x = paintstruct.rcPaint.left + xoffset;
expose_rect.y = paintstruct.rcPaint.top + yoffset;
expose_rect.width = paintstruct.rcPaint.right - paintstruct.rcPaint.left;
expose_rect.height = paintstruct.rcPaint.bottom - paintstruct.rcPaint.top;
_gdk_window_process_expose (window, msg->time, &expose_rect);
gdk_region_offset (update_region, xoffset, yoffset);
_gdk_window_process_expose (window, update_region);
gdk_region_destroy (update_region);
return_val = FALSE;
}
DeleteObject (hrgn);
break;
case WM_GETICON:
@ -3312,7 +3272,7 @@ gdk_event_translate (GdkDisplay *display,
}
event->selection.property = _gdk_selection_property;
event->selection.requestor = (guint32) msg->hwnd;
event->selection.time = msg->time;
event->selection.time = _gdk_win32_get_next_tick (msg->time);
return_val = !GDK_WINDOW_DESTROYED (window);
#else
/* Test code, to see if SetClipboardData works when called from
@ -3352,7 +3312,7 @@ gdk_event_translate (GdkDisplay *display,
return_val = window != NULL && !GDK_WINDOW_DESTROYED (window);
if ((window != NULL) && (gdk_root_window != msg->hwnd))
if ((window != NULL) && (_gdk_root_window != msg->hwnd))
gdk_window_destroy_notify (window);
break;
@ -3386,7 +3346,7 @@ gdk_event_translate (GdkDisplay *display,
default:
GDK_NOTE (EVENTS, g_print ("%s: %p %#x %#lx\n",
gdk_win32_message_name (msg->message),
_gdk_win32_message_to_string (msg->message),
msg->hwnd, msg->wParam, msg->lParam));
}
@ -3451,7 +3411,7 @@ gdk_event_prepare (GSource *source,
*timeout = -1;
retval = (_gdk_event_queue_find_first (display) != NULL)
|| PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
|| PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
GDK_THREADS_LEAVE ();
@ -3552,241 +3512,3 @@ gdk_display_sync (GdkDisplay * display)
DispatchMessage (&msg);
}
}
#ifdef G_ENABLE_DEBUG
gchar *
gdk_win32_message_name (UINT msg)
{
static gchar bfr[100];
switch (msg)
{
#define CASE(x) case x: return #x
CASE (WM_NULL);
CASE (WM_CREATE);
CASE (WM_DESTROY);
CASE (WM_MOVE);
CASE (WM_SIZE);
CASE (WM_ACTIVATE);
CASE (WM_SETFOCUS);
CASE (WM_KILLFOCUS);
CASE (WM_ENABLE);
CASE (WM_SETREDRAW);
CASE (WM_SETTEXT);
CASE (WM_GETTEXT);
CASE (WM_GETTEXTLENGTH);
CASE (WM_PAINT);
CASE (WM_CLOSE);
CASE (WM_QUERYENDSESSION);
CASE (WM_QUERYOPEN);
CASE (WM_ENDSESSION);
CASE (WM_QUIT);
CASE (WM_ERASEBKGND);
CASE (WM_SYSCOLORCHANGE);
CASE (WM_SHOWWINDOW);
CASE (WM_WININICHANGE);
CASE (WM_DEVMODECHANGE);
CASE (WM_ACTIVATEAPP);
CASE (WM_FONTCHANGE);
CASE (WM_TIMECHANGE);
CASE (WM_CANCELMODE);
CASE (WM_SETCURSOR);
CASE (WM_MOUSEACTIVATE);
CASE (WM_CHILDACTIVATE);
CASE (WM_QUEUESYNC);
CASE (WM_GETMINMAXINFO);
CASE (WM_PAINTICON);
CASE (WM_ICONERASEBKGND);
CASE (WM_NEXTDLGCTL);
CASE (WM_SPOOLERSTATUS);
CASE (WM_DRAWITEM);
CASE (WM_MEASUREITEM);
CASE (WM_DELETEITEM);
CASE (WM_VKEYTOITEM);
CASE (WM_CHARTOITEM);
CASE (WM_SETFONT);
CASE (WM_GETFONT);
CASE (WM_SETHOTKEY);
CASE (WM_GETHOTKEY);
CASE (WM_QUERYDRAGICON);
CASE (WM_COMPAREITEM);
CASE (WM_GETOBJECT);
CASE (WM_COMPACTING);
CASE (WM_WINDOWPOSCHANGING);
CASE (WM_WINDOWPOSCHANGED);
CASE (WM_POWER);
CASE (WM_COPYDATA);
CASE (WM_CANCELJOURNAL);
CASE (WM_NOTIFY);
CASE (WM_INPUTLANGCHANGEREQUEST);
CASE (WM_INPUTLANGCHANGE);
CASE (WM_TCARD);
CASE (WM_HELP);
CASE (WM_USERCHANGED);
CASE (WM_NOTIFYFORMAT);
CASE (WM_CONTEXTMENU);
CASE (WM_STYLECHANGING);
CASE (WM_STYLECHANGED);
CASE (WM_DISPLAYCHANGE);
CASE (WM_GETICON);
CASE (WM_SETICON);
CASE (WM_NCCREATE);
CASE (WM_NCDESTROY);
CASE (WM_NCCALCSIZE);
CASE (WM_NCHITTEST);
CASE (WM_NCPAINT);
CASE (WM_NCACTIVATE);
CASE (WM_GETDLGCODE);
CASE (WM_SYNCPAINT);
CASE (WM_NCMOUSEMOVE);
CASE (WM_NCLBUTTONDOWN);
CASE (WM_NCLBUTTONUP);
CASE (WM_NCLBUTTONDBLCLK);
CASE (WM_NCRBUTTONDOWN);
CASE (WM_NCRBUTTONUP);
CASE (WM_NCRBUTTONDBLCLK);
CASE (WM_NCMBUTTONDOWN);
CASE (WM_NCMBUTTONUP);
CASE (WM_NCMBUTTONDBLCLK);
CASE (WM_NCXBUTTONDOWN);
CASE (WM_NCXBUTTONUP);
CASE (WM_NCXBUTTONDBLCLK);
CASE (WM_KEYDOWN);
CASE (WM_KEYUP);
CASE (WM_CHAR);
CASE (WM_DEADCHAR);
CASE (WM_SYSKEYDOWN);
CASE (WM_SYSKEYUP);
CASE (WM_SYSCHAR);
CASE (WM_SYSDEADCHAR);
CASE (WM_KEYLAST);
CASE (WM_IME_STARTCOMPOSITION);
CASE (WM_IME_ENDCOMPOSITION);
CASE (WM_IME_COMPOSITION);
CASE (WM_INITDIALOG);
CASE (WM_COMMAND);
CASE (WM_SYSCOMMAND);
CASE (WM_TIMER);
CASE (WM_HSCROLL);
CASE (WM_VSCROLL);
CASE (WM_INITMENU);
CASE (WM_INITMENUPOPUP);
CASE (WM_MENUSELECT);
CASE (WM_MENUCHAR);
CASE (WM_ENTERIDLE);
CASE (WM_MENURBUTTONUP);
CASE (WM_MENUDRAG);
CASE (WM_MENUGETOBJECT);
CASE (WM_UNINITMENUPOPUP);
CASE (WM_MENUCOMMAND);
CASE (WM_CHANGEUISTATE);
CASE (WM_UPDATEUISTATE);
CASE (WM_QUERYUISTATE);
CASE (WM_CTLCOLORMSGBOX);
CASE (WM_CTLCOLOREDIT);
CASE (WM_CTLCOLORLISTBOX);
CASE (WM_CTLCOLORBTN);
CASE (WM_CTLCOLORDLG);
CASE (WM_CTLCOLORSCROLLBAR);
CASE (WM_CTLCOLORSTATIC);
CASE (WM_MOUSEMOVE);
CASE (WM_LBUTTONDOWN);
CASE (WM_LBUTTONUP);
CASE (WM_LBUTTONDBLCLK);
CASE (WM_RBUTTONDOWN);
CASE (WM_RBUTTONUP);
CASE (WM_RBUTTONDBLCLK);
CASE (WM_MBUTTONDOWN);
CASE (WM_MBUTTONUP);
CASE (WM_MBUTTONDBLCLK);
CASE (WM_MOUSEWHEEL);
CASE (WM_XBUTTONDOWN);
CASE (WM_XBUTTONUP);
CASE (WM_XBUTTONDBLCLK);
CASE (WM_PARENTNOTIFY);
CASE (WM_ENTERMENULOOP);
CASE (WM_EXITMENULOOP);
CASE (WM_NEXTMENU);
CASE (WM_SIZING);
CASE (WM_CAPTURECHANGED);
CASE (WM_MOVING);
CASE (WM_POWERBROADCAST);
CASE (WM_DEVICECHANGE);
CASE (WM_MDICREATE);
CASE (WM_MDIDESTROY);
CASE (WM_MDIACTIVATE);
CASE (WM_MDIRESTORE);
CASE (WM_MDINEXT);
CASE (WM_MDIMAXIMIZE);
CASE (WM_MDITILE);
CASE (WM_MDICASCADE);
CASE (WM_MDIICONARRANGE);
CASE (WM_MDIGETACTIVE);
CASE (WM_MDISETMENU);
CASE (WM_ENTERSIZEMOVE);
CASE (WM_EXITSIZEMOVE);
CASE (WM_DROPFILES);
CASE (WM_MDIREFRESHMENU);
CASE (WM_IME_SETCONTEXT);
CASE (WM_IME_NOTIFY);
CASE (WM_IME_CONTROL);
CASE (WM_IME_COMPOSITIONFULL);
CASE (WM_IME_SELECT);
CASE (WM_IME_CHAR);
CASE (WM_IME_REQUEST);
CASE (WM_IME_KEYDOWN);
CASE (WM_IME_KEYUP);
CASE (WM_MOUSEHOVER);
CASE (WM_MOUSELEAVE);
CASE (WM_NCMOUSEHOVER);
CASE (WM_NCMOUSELEAVE);
CASE (WM_CUT);
CASE (WM_COPY);
CASE (WM_PASTE);
CASE (WM_CLEAR);
CASE (WM_UNDO);
CASE (WM_RENDERFORMAT);
CASE (WM_RENDERALLFORMATS);
CASE (WM_DESTROYCLIPBOARD);
CASE (WM_DRAWCLIPBOARD);
CASE (WM_PAINTCLIPBOARD);
CASE (WM_VSCROLLCLIPBOARD);
CASE (WM_SIZECLIPBOARD);
CASE (WM_ASKCBFORMATNAME);
CASE (WM_CHANGECBCHAIN);
CASE (WM_HSCROLLCLIPBOARD);
CASE (WM_QUERYNEWPALETTE);
CASE (WM_PALETTEISCHANGING);
CASE (WM_PALETTECHANGED);
CASE (WM_HOTKEY);
CASE (WM_PRINT);
CASE (WM_PRINTCLIENT);
CASE (WM_APPCOMMAND);
CASE (WM_HANDHELDFIRST);
CASE (WM_HANDHELDLAST);
CASE (WM_AFXFIRST);
CASE (WM_AFXLAST);
CASE (WM_PENWINFIRST);
CASE (WM_PENWINLAST);
CASE (WM_APP);
#undef CASE
default:
if (msg >= WM_HANDHELDFIRST && msg <= WM_HANDHELDLAST)
sprintf (bfr, "WM_HANDHELDFIRST+%d", msg - WM_HANDHELDFIRST);
else if (msg >= WM_AFXFIRST && msg <= WM_AFXLAST)
sprintf (bfr, "WM_AFXFIRST+%d", msg - WM_AFXFIRST);
else if (msg >= WM_PENWINFIRST && msg <= WM_PENWINLAST)
sprintf (bfr, "WM_PENWINFIRST+%d", msg - WM_PENWINFIRST);
else if (msg >= WM_USER && msg <= 0x7FFF)
sprintf (bfr, "WM_USER+%d", msg - WM_USER);
else if (msg >= 0xC000 && msg <= 0xFFFF)
sprintf (bfr, "reg-%#x", msg);
else
sprintf (bfr, "unk-%#x", msg);
return bfr;
}
g_assert_not_reached ();
}
#endif /* G_ENABLE_DEBUG */

View File

@ -893,11 +893,11 @@ gdk_font_load_logfont (LOGFONT *lfp)
singlefont = g_new (GdkWin32SingleFont, 1);
singlefont->hfont = hfont;
GetObject (singlefont->hfont, sizeof (logfont), &logfont);
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
oldfont = SelectObject (_gdk_display_hdc, singlefont->hfont);
memset (&singlefont->fs, 0, sizeof (singlefont->fs));
singlefont->charset = GetTextCharsetInfo (gdk_display_hdc, &singlefont->fs, 0);
GetTextFace (gdk_display_hdc, sizeof (face), face);
SelectObject (gdk_display_hdc, oldfont);
singlefont->charset = GetTextCharsetInfo (_gdk_display_hdc, &singlefont->fs, 0);
GetTextFace (_gdk_display_hdc, sizeof (face), face);
SelectObject (_gdk_display_hdc, oldfont);
if (TranslateCharsetInfo ((DWORD *) singlefont->charset, &csi,
TCI_SRCCHARSET)
&& singlefont->charset != MAC_CHARSET)
@ -905,8 +905,8 @@ gdk_font_load_logfont (LOGFONT *lfp)
else
singlefont->codepage = 0;
GDK_NOTE (MISC, (g_print ("... = %#x %s cs %s cp%d\n",
(guint) singlefont->hfont, face,
GDK_NOTE (MISC, (g_print ("... = %p %s cs %s cp%d\n",
singlefont->hfont, face,
charset_name (singlefont->charset),
singlefont->codepage),
g_print ("... Unicode subranges:"),
@ -1011,7 +1011,7 @@ gdk_font_load_internal (const gchar *font_name)
return NULL;
}
logpixelsy = GetDeviceCaps (gdk_display_hdc, LOGPIXELSY);
logpixelsy = GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY);
if (strcmp (pixel_size, "*") == 0)
if (strcmp (point_size, "*") == 0)
@ -1177,9 +1177,9 @@ gdk_font_from_one_singlefont (GdkWin32SingleFont *singlefont)
* chars to work. (Yes, even Latin-1, as we use Unicode internally.)
*/
font->type = GDK_FONT_FONTSET;
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
GetTextMetrics (gdk_display_hdc, &textmetric);
SelectObject (gdk_display_hdc, oldfont);
oldfont = SelectObject (_gdk_display_hdc, singlefont->hfont);
GetTextMetrics (_gdk_display_hdc, &textmetric);
SelectObject (_gdk_display_hdc, oldfont);
font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent;
@ -1220,9 +1220,9 @@ gdk_font_load_for_display (GdkDisplay *display,
* chars to work. (Yes, even Latin-1, as we use Unicode internally.)
*/
font->type = GDK_FONT_FONTSET;
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
GetTextMetrics (gdk_display_hdc, &textmetric);
SelectObject (gdk_display_hdc, oldfont);
oldfont = SelectObject (_gdk_display_hdc, singlefont->hfont);
GetTextMetrics (_gdk_display_hdc, &textmetric);
SelectObject (_gdk_display_hdc, oldfont);
font->ascent = textmetric.tmAscent;
font->descent = textmetric.tmDescent;
@ -1309,9 +1309,9 @@ gdk_fontset_load (const gchar *fontset_name)
if (singlefont)
{
private->fonts = g_slist_append (private->fonts, singlefont);
oldfont = SelectObject (gdk_display_hdc, singlefont->hfont);
GetTextMetrics (gdk_display_hdc, &textmetric);
SelectObject (gdk_display_hdc, oldfont);
oldfont = SelectObject (_gdk_display_hdc, singlefont->hfont);
GetTextMetrics (_gdk_display_hdc, &textmetric);
SelectObject (_gdk_display_hdc, oldfont);
font->ascent = MAX (font->ascent, textmetric.tmAscent);
font->descent = MAX (font->descent, textmetric.tmDescent);
}
@ -1342,8 +1342,8 @@ _gdk_font_destroy (GdkFont *font)
GSList *list;
singlefont = (GdkWin32SingleFont *) private->fonts->data;
GDK_NOTE (MISC, g_print ("_gdk_font_destroy %#x\n",
(guint)singlefont->hfont));
GDK_NOTE (MISC, g_print ("_gdk_font_destroy %p\n",
singlefont->hfont));
gdk_font_hash_remove (font->type, font);
@ -1506,9 +1506,9 @@ _gdk_wchar_text_handle (GdkFont *font,
if (!list)
singlefont = NULL;
GDK_NOTE (MISC, g_print ("%d:%d:%d:%#x ",
GDK_NOTE (MISC, g_print ("%d:%d:%d:%p ",
start-wcstr, wcp-wcstr, block,
(singlefont ? (guint) singlefont->hfont : 0)));
(singlefont ? singlefont->hfont : 0)));
/* Call the callback function */
(*handler) (singlefont, start, wcp+1 - start, arg);
@ -1535,56 +1535,18 @@ gdk_text_size_handler (GdkWin32SingleFont *singlefont,
if (!singlefont)
return;
if ((oldfont = SelectObject (gdk_display_hdc, singlefont->hfont)) == NULL)
if ((oldfont = SelectObject (_gdk_display_hdc, singlefont->hfont)) == NULL)
{
WIN32_GDI_FAILED ("SelectObject");
return;
}
GetTextExtentPoint32W (gdk_display_hdc, wcstr, wclen, &this_size);
SelectObject (gdk_display_hdc, oldfont);
GetTextExtentPoint32W (_gdk_display_hdc, wcstr, wclen, &this_size);
SelectObject (_gdk_display_hdc, oldfont);
arg->total.cx += this_size.cx;
arg->total.cy = MAX (arg->total.cy, this_size.cy);
}
static gboolean
gdk_text_size (GdkFont *font,
const gchar *text,
gint text_length,
gdk_text_size_arg *arg)
{
gint wlen;
wchar_t *wcstr;
g_return_val_if_fail (font != NULL, FALSE);
g_return_val_if_fail (text != NULL, FALSE);
if (text_length == 0)
return 0;
g_assert (font->type == GDK_FONT_FONT || font->type == GDK_FONT_FONTSET);
wcstr = g_new (wchar_t, text_length);
if (text_length == 1)
{
/* For single characters, don't try to interpret as UTF-8.
*/
wcstr[0] = (guchar) text[0];
_gdk_wchar_text_handle (font, wcstr, 1, gdk_text_size_handler, arg);
}
else
{
if ((wlen = _gdk_utf8_to_ucs2 (wcstr, text, text_length, text_length)) == -1)
g_warning ("gdk_text_size: _gdk_utf8_to_ucs2 failed");
else
_gdk_wchar_text_handle (font, wcstr, wlen, gdk_text_size_handler, arg);
}
g_free (wcstr);
return TRUE;
}
gint
gdk_text_width (GdkFont *font,
const gchar *text,
@ -1605,6 +1567,7 @@ gdk_text_width_wc (GdkFont *font,
gint width = -1;
gdk_text_extents_wc (font, text, text_length, NULL, NULL, &width, NULL, NULL);
return width;
}

View File

@ -96,8 +96,8 @@ gdk_gc_win32_finalize (GObject *object)
{
GdkGCWin32 *win32_gc = GDK_GC_WIN32 (object);
if (win32_gc->clip_region)
gdk_region_destroy (win32_gc->clip_region);
if (win32_gc->hcliprgn != NULL)
DeleteObject (win32_gc->hcliprgn);
if (win32_gc->values_mask & GDK_GC_FONT)
gdk_font_unref (win32_gc->font);
@ -278,22 +278,12 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
if (mask & GDK_GC_CLIP_MASK)
{
if (win32_gc->clip_region != NULL)
{
gdk_region_destroy (win32_gc->clip_region);
win32_gc->clip_region = NULL;
}
if (win32_gc->hcliprgn != NULL)
{
DeleteObject (win32_gc->hcliprgn);
win32_gc->hcliprgn = NULL;
}
DeleteObject (win32_gc->hcliprgn);
if (values->clip_mask != NULL)
{
win32_gc->hcliprgn =
_gdk_win32_bitmap_to_region (values->clip_mask);
win32_gc->hcliprgn = _gdk_win32_bitmap_to_hrgn (values->clip_mask);
win32_gc->values_mask |= GDK_GC_CLIP_MASK;
}
else
@ -369,8 +359,6 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
win32_gc->pen_num_dashes = 0;
}
win32_gc->pen_style &= ~(PS_STYLE_MASK);
GDK_NOTE (GC, (g_print ("%sps|=LINE_SOLID", s),
s = ","));
win32_gc->pen_style |= PS_SOLID;
break;
case GDK_LINE_ON_OFF_DASH:
@ -382,12 +370,12 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
* line endings ? --hb
*/
win32_gc->pen_style &= ~(PS_STYLE_MASK);
GDK_NOTE (GC, (g_print ("%sps|=DASH", s),
s = ","));
win32_gc->pen_style |= PS_DASH;
win32_gc->pen_style |= PS_DASH;
}
break;
}
GDK_NOTE (GC, (g_print ("%sps|=PS_STYLE_%s", s, _gdk_win32_psstyle_to_string (win32_gc->pen_style)),
s = ","));
win32_gc->values_mask |= GDK_GC_LINE_STYLE;
}
@ -398,21 +386,17 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
{
case GDK_CAP_NOT_LAST: /* ??? */
case GDK_CAP_BUTT:
GDK_NOTE (GC, (g_print ("%sps|=ENDCAP_FLAT", s),
s = ","));
win32_gc->pen_style |= PS_ENDCAP_FLAT;
break;
case GDK_CAP_ROUND:
GDK_NOTE (GC, (g_print ("%sps|=ENDCAP_ROUND", s),
s = ","));
win32_gc->pen_style |= PS_ENDCAP_ROUND;
break;
case GDK_CAP_PROJECTING:
GDK_NOTE (GC, (g_print ("%sps|=ENDCAP_SQUARE", s),
s = ","));
win32_gc->pen_style |= PS_ENDCAP_SQUARE;
break;
}
GDK_NOTE (GC, (g_print ("%sps|=PS_ENDCAP_%s", s, _gdk_win32_psendcap_to_string (win32_gc->pen_style)),
s = ","));
win32_gc->values_mask |= GDK_GC_CAP_STYLE;
}
@ -422,21 +406,17 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
switch (values->join_style)
{
case GDK_JOIN_MITER:
GDK_NOTE (GC, (g_print ("%sps|=JOIN_MITER", s),
s = ","));
win32_gc->pen_style |= PS_JOIN_MITER;
break;
case GDK_JOIN_ROUND:
GDK_NOTE (GC, (g_print ("%sps|=JOIN_ROUND", s),
s = ","));
win32_gc->pen_style |= PS_JOIN_ROUND;
break;
case GDK_JOIN_BEVEL:
GDK_NOTE (GC, (g_print ("%sps|=JOIN_BEVEL", s),
s = ","));
win32_gc->pen_style |= PS_JOIN_BEVEL;
break;
}
GDK_NOTE (GC, (g_print ("%sps|=PS_JOIN_%s", s, _gdk_win32_psjoin_to_string (win32_gc->pen_style)),
s = ","));
win32_gc->values_mask |= GDK_GC_JOIN_STYLE;
}
GDK_NOTE (GC, g_print ("}\n"));
@ -458,8 +438,6 @@ _gdk_win32_gc_new (GdkDrawable *drawable,
gc = g_object_new (_gdk_gc_win32_get_type (), NULL);
win32_gc = GDK_GC_WIN32 (gc);
win32_gc->hdc = NULL;
win32_gc->clip_region = NULL;
win32_gc->hcliprgn = NULL;
/* Use the same default values as X11 does, even if they don't make
@ -482,6 +460,7 @@ _gdk_win32_gc_new (GdkDrawable *drawable,
GDK_NOTE (GC, g_print ("_gdk_win32_gc_new: "));
gdk_win32_gc_values_to_win32values (values, mask, win32_gc);
win32_gc->hdc = NULL;
win32_gc->hwnd = NULL;
GDK_NOTE (GC, g_print (" = %p\n", gc));
@ -624,36 +603,34 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
win32_gc = GDK_GC_WIN32 (gc);
if (win32_gc->hcliprgn)
{
DeleteObject (win32_gc->hcliprgn);
win32_gc->hcliprgn = NULL;
}
if (win32_gc->clip_region)
gdk_region_destroy (win32_gc->clip_region);
DeleteObject (win32_gc->hcliprgn);
if (rectangle)
{
GDK_NOTE (GC,
g_print ("gdk_gc_set_clip_rectangle: %dx%d@+%d+%d\n",
rectangle->width, rectangle->height,
rectangle->x, rectangle->y));
win32_gc->clip_region = gdk_region_rectangle (rectangle);
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_rectangle: %s\n",
_gdk_win32_gdkrectangle_to_string (rectangle)));
win32_gc->hcliprgn = CreateRectRgn (rectangle->x, rectangle->y,
rectangle->x + rectangle->width,
rectangle->y + rectangle->height);
win32_gc->values_mask |= GDK_GC_CLIP_MASK;
}
else
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_rectangle: NULL\n"));
win32_gc->clip_region = NULL;
win32_gc->hcliprgn = NULL;
win32_gc->values_mask &= ~GDK_GC_CLIP_MASK;
}
win32_gc->values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
win32_gc->values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
}
void
gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
gdk_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
{
GdkGCWin32 *win32_gc;
@ -661,30 +638,28 @@ gdk_gc_set_clip_region (GdkGC *gc,
win32_gc = GDK_GC_WIN32 (gc);
if (win32_gc->clip_region)
gdk_region_destroy (win32_gc->clip_region);
if (win32_gc->hcliprgn)
DeleteObject (win32_gc->hcliprgn);
if (region)
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: %dx%d+%d+%d\n",
region->extents.x2 - region->extents.x1,
region->extents.y2 - region->extents.y1,
region->extents.x1, region->extents.y1));
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: %s\n",
_gdk_win32_gdkregion_to_string (region)));
win32_gc->clip_region = gdk_region_copy (region);
win32_gc->hcliprgn = _gdk_win32_gdkregion_to_hrgn (region, 0, 0);
win32_gc->values_mask |= GDK_GC_CLIP_MASK;
}
else
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: NULL\n"));
win32_gc->clip_region = NULL;
win32_gc->hcliprgn = NULL;
win32_gc->values_mask &= ~GDK_GC_CLIP_MASK;
}
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
win32_gc->values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
}
@ -701,24 +676,29 @@ gdk_gc_copy (GdkGC *dst_gc,
dst_win32_gc = GDK_GC_WIN32 (dst_gc);
src_win32_gc = GDK_GC_WIN32 (src_gc);
if (dst_win32_gc->font != NULL)
gdk_font_unref (dst_win32_gc->font);
if (dst_win32_gc->tile != NULL)
gdk_drawable_unref (dst_win32_gc->tile);
if (dst_win32_gc->stipple != NULL)
gdk_drawable_unref (dst_win32_gc->stipple);
if (dst_win32_gc->clip_region != NULL)
gdk_region_destroy (dst_win32_gc->clip_region);
if (dst_gc->colormap)
g_object_unref (G_OBJECT (dst_gc->colormap));
if (dst_win32_gc->hcliprgn != NULL)
DeleteObject (dst_win32_gc->hcliprgn);
if (dst_win32_gc->font != NULL)
gdk_font_unref (dst_win32_gc->font);
if (dst_win32_gc->tile != NULL)
gdk_drawable_unref (dst_win32_gc->tile);
if (dst_win32_gc->stipple != NULL)
gdk_drawable_unref (dst_win32_gc->stipple);
if (dst_win32_gc->pen_dashes)
g_free (dst_win32_gc->pen_dashes);
*dst_win32_gc = *src_win32_gc;
if (dst_win32_gc->pen_dashes)
dst_win32_gc->pen_dashes = g_memdup (src_win32_gc->pen_dashes,
sizeof (DWORD) * src_win32_gc->pen_num_dashes);
if (dst_gc->colormap)
g_object_ref (G_OBJECT (dst_gc->colormap));
if (dst_win32_gc->hcliprgn)
{
/* create a new region, to copy to */
@ -727,14 +707,19 @@ gdk_gc_copy (GdkGC *dst_gc,
CombineRgn (dst_win32_gc->hcliprgn, src_win32_gc->hcliprgn,
NULL, RGN_COPY);
}
if (dst_win32_gc->clip_region != NULL)
dst_win32_gc->clip_region = gdk_region_copy (dst_win32_gc->clip_region);
if (dst_win32_gc->font != NULL)
gdk_font_ref (dst_win32_gc->font);
if (dst_win32_gc->tile != NULL)
gdk_drawable_ref (dst_win32_gc->tile);
if (dst_win32_gc->stipple != NULL)
gdk_drawable_ref (dst_win32_gc->stipple);
if (dst_win32_gc->pen_dashes)
dst_win32_gc->pen_dashes = g_memdup (src_win32_gc->pen_dashes,
sizeof (DWORD) * src_win32_gc->pen_num_dashes);
}
static guint bitmask[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
@ -900,7 +885,6 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
GdkGCWin32 *win32_gc = (GdkGCWin32 *) gc;
GdkDrawableImplWin32 *impl = NULL;
gboolean ok = TRUE;
int flag;
g_assert (win32_gc->hdc == NULL);
@ -954,164 +938,45 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
if (SetROP2 (win32_gc->hdc, win32_gc->rop2) == 0)
WIN32_GDI_FAILED ("SetROP2"), ok = FALSE;
if (win32_gc->values_mask & GDK_GC_CLIP_MASK)
g_assert ((win32_gc->clip_region != NULL) != (win32_gc->hcliprgn != NULL));
if (ok
&& (win32_gc->values_mask & GDK_GC_CLIP_MASK)
&& win32_gc->clip_region != NULL)
{
HRGN hrgn;
RGNDATA *rgndata;
RECT *rect;
GdkRegionBox *boxes = win32_gc->clip_region->rects;
guint nbytes =
sizeof (RGNDATAHEADER) + (sizeof (RECT) * win32_gc->clip_region->numRects);
int i;
rgndata = g_malloc (nbytes);
rgndata->rdh.dwSize = sizeof (RGNDATAHEADER);
rgndata->rdh.iType = RDH_RECTANGLES;
rgndata->rdh.nCount = rgndata->rdh.nRgnSize = 0;
SetRect (&rgndata->rdh.rcBound,
G_MAXSHORT, G_MAXSHORT, G_MINSHORT, G_MINSHORT);
for (i = 0; i < win32_gc->clip_region->numRects; i++)
{
rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++;
rect->left = CLAMP (boxes[i].x1 + gc->clip_x_origin,
G_MINSHORT, G_MAXSHORT);
rect->right = CLAMP (boxes[i].x2 + gc->clip_x_origin,
G_MINSHORT, G_MAXSHORT);
rect->top = CLAMP (boxes[i].y1 + gc->clip_y_origin,
G_MINSHORT, G_MAXSHORT);
rect->bottom = CLAMP (boxes[i].y2 + gc->clip_y_origin,
G_MINSHORT, G_MAXSHORT);
GDK_NOTE (GC, g_print ("clip rgn box %d: %ldx%ld@+%ld+%ld\n",
i,
rect->right-rect->left,
rect->bottom-rect->top,
rect->left, rect->top));
if (rect->left < rgndata->rdh.rcBound.left)
rgndata->rdh.rcBound.left = rect->left;
if (rect->right > rgndata->rdh.rcBound.right)
rgndata->rdh.rcBound.right = rect->right;
if (rect->top < rgndata->rdh.rcBound.top)
rgndata->rdh.rcBound.top = rect->top;
if (rect->bottom > rgndata->rdh.rcBound.bottom)
rgndata->rdh.rcBound.bottom = rect->bottom;
}
if ((hrgn = ExtCreateRegion (NULL, nbytes, rgndata)) == NULL)
WIN32_API_FAILED ("ExtCreateRegion"), ok = FALSE;
g_free (rgndata);
/*
* XXX: combine the fillmode-stipple with the clip region possibly
* this needs to be done with the hcliprgn below as well, but
* the test case here were check boxes and radio buttons ...
*/
if ( (win32_gc->values_mask & GDK_GC_STIPPLE)
&& (win32_gc->values_mask & GDK_GC_FILL) && (win32_gc->fill_style == GDK_STIPPLED))
{
HRGN hstipplergn = _gdk_win32_bitmap_to_region (win32_gc->stipple);
if (OffsetRgn (hstipplergn,
win32_gc->values_mask & GDK_GC_TS_X_ORIGIN ? gc->ts_x_origin : 0,
win32_gc->values_mask & GDK_GC_TS_Y_ORIGIN ? gc->ts_y_origin : 0) == ERROR)
WIN32_API_FAILED ("OffsetRgn"), ok = FALSE;
if (CombineRgn (hrgn, hrgn, hstipplergn, RGN_AND) == ERROR)
WIN32_API_FAILED ("CombineRgn"), ok = FALSE;
if (!DeleteObject (hstipplergn))
WIN32_API_FAILED ("DeleteObject");
}
if (ok && SelectClipRgn (win32_gc->hdc, hrgn) == ERROR)
WIN32_API_FAILED ("SelectClipRgn"), ok = FALSE;
if (hrgn != NULL)
DeleteObject (hrgn);
}
else if (ok
&& (win32_gc->values_mask & GDK_GC_CLIP_MASK)
&& win32_gc->hcliprgn != NULL)
if (ok &&
(win32_gc->values_mask & GDK_GC_CLIP_MASK) &&
win32_gc->hcliprgn != NULL)
{
if (SelectClipRgn (win32_gc->hdc, win32_gc->hcliprgn) == ERROR)
WIN32_API_FAILED ("SelectClipRgn"), ok = FALSE;
if (ok && !OffsetClipRgn (win32_gc->hdc,
win32_gc->values_mask & GDK_GC_CLIP_X_ORIGIN ? gc->clip_x_origin : 0,
win32_gc->values_mask & GDK_GC_CLIP_Y_ORIGIN ? gc->clip_y_origin : 0))
/* Combine the fillmode-stipple with the clip region */
if (ok &&
(win32_gc->values_mask & GDK_GC_STIPPLE) &&
(win32_gc->values_mask & GDK_GC_FILL) &&
(win32_gc->fill_style == GDK_STIPPLED))
{
HRGN hstipplergn;
if ((hstipplergn = _gdk_win32_bitmap_to_hrgn (win32_gc->stipple)) == NULL)
;
else if (win32_gc->values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN) &&
OffsetRgn (hstipplergn,
win32_gc->values_mask & GDK_GC_TS_X_ORIGIN ? gc->ts_x_origin : 0,
win32_gc->values_mask & GDK_GC_TS_Y_ORIGIN ? gc->ts_y_origin : 0) == ERROR)
WIN32_API_FAILED ("OffsetRgn");
else if (ExtSelectClipRgn (win32_gc->hdc, hstipplergn, RGN_AND) == ERROR)
WIN32_API_FAILED ("ExtSelectClipRgn");
if (hstipplergn != NULL && !DeleteObject (hstipplergn))
WIN32_API_FAILED ("DeleteObject");
}
if (ok && win32_gc->values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN) &&
OffsetClipRgn (win32_gc->hdc,
win32_gc->values_mask & GDK_GC_CLIP_X_ORIGIN ? gc->clip_x_origin : 0,
win32_gc->values_mask & GDK_GC_CLIP_Y_ORIGIN ? gc->clip_y_origin : 0) == ERROR)
WIN32_API_FAILED ("OffsetClipRgn"), ok = FALSE;
}
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_GC)
{
HGDIOBJ obj;
LOGBRUSH logbrush;
EXTLOGPEN extlogpen;
HRGN hrgn;
RECT rect;
g_print ("gdk_win32_hdc_get: %p\n", win32_gc->hdc);
obj = GetCurrentObject (win32_gc->hdc, OBJ_BRUSH);
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
g_print ("brush: style: %s color: %06lx hatch: %#lx\n",
(logbrush.lbStyle == BS_HOLLOW ? "HOLLOW" :
(logbrush.lbStyle == BS_PATTERN ? "PATTERN" :
(logbrush.lbStyle == BS_SOLID ? "SOLID" :
"???"))),
logbrush.lbColor,
logbrush.lbHatch);
obj = GetCurrentObject (win32_gc->hdc, OBJ_PEN);
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
g_print ("pen: type: %s style: %s endcap: %s join: %s width: %d brush: %s\n",
((extlogpen.elpPenStyle & PS_TYPE_MASK) ==
PS_GEOMETRIC ? "GEOMETRIC" : "COSMETIC"),
((extlogpen.elpPenStyle & PS_STYLE_MASK) ==
PS_NULL ? "NULL" :
((extlogpen.elpPenStyle & PS_STYLE_MASK) == PS_SOLID ? "SOLID" :
((extlogpen.elpPenStyle & PS_STYLE_MASK) == PS_DOT ? "DOT" :
((extlogpen.elpPenStyle & PS_STYLE_MASK) == PS_DASH ? "DASH" :
"???")))),
((extlogpen.elpPenStyle & PS_ENDCAP_MASK) ==
PS_ENDCAP_FLAT ? "FLAT" :
((extlogpen.elpPenStyle & PS_ENDCAP_MASK) ==
PS_ENDCAP_ROUND ? "ROUND" :
((extlogpen.elpPenStyle & PS_ENDCAP_MASK) ==
PS_ENDCAP_SQUARE ? "ROUND" :
((extlogpen.elpPenStyle & PS_ENDCAP_MASK) ==
PS_ENDCAP_SQUARE ? "ROUND" : "???")))),
((extlogpen.elpPenStyle & PS_JOIN_MASK) ==
PS_JOIN_BEVEL ? "BEVEL" :
((extlogpen.elpPenStyle & PS_JOIN_MASK) ==
PS_JOIN_MITER ? "MITER" :
((extlogpen.elpPenStyle & PS_JOIN_MASK) ==
PS_JOIN_ROUND ? "ROUND" : "???"))),
extlogpen.elpWidth,
(extlogpen.elpBrushStyle == BS_DIBPATTERN ? "DIBPATTERN" :
(extlogpen.elpBrushStyle == BS_DIBPATTERNPT ? "DIBPATTERNPT" :
(extlogpen.elpBrushStyle == BS_HATCHED ? "HATCHED" :
(extlogpen.elpBrushStyle == BS_HOLLOW ? "HOLLOW" :
(extlogpen.elpBrushStyle == BS_PATTERN ? "PATTERN" :
(extlogpen.elpBrushStyle == BS_SOLID ? "SOLID" : "???")))))));
hrgn = CreateRectRgn (0, 0, 0, 0);
if ((flag = GetClipRgn (win32_gc->hdc, hrgn)) == -1)
WIN32_API_FAILED ("GetClipRgn");
else if (flag == 0)
g_print ("no clip region\n");
else if (flag == 1)
{
GetRgnBox (hrgn, &rect);
g_print ("clip region bbox: %ldx%ld@+%ld+%ld\n",
rect.right - rect.left,
rect.bottom - rect.top,
rect.left, rect.top);
}
DeleteObject (hrgn);
}
#endif
GDK_NOTE (GC, (g_print ("gdk_win32_hdc_get: "),
_gdk_win32_print_dc (win32_gc->hdc)));
return win32_gc->hdc;
}
@ -1191,12 +1056,12 @@ gdk_win32_hdc_release (GdkDrawable *drawable,
* bitmaps (and not pixmaps), with zero pixels being transparent.
*/
/* _gdk_win32_bitmap_to_region : Create a region from the
/* _gdk_win32_bitmap_to_hrgn : Create a region from the
* "non-transparent" pixels of a bitmap.
*/
HRGN
_gdk_win32_bitmap_to_region (GdkPixmap *pixmap)
_gdk_win32_bitmap_to_hrgn (GdkPixmap *pixmap)
{
HRGN hRgn = NULL;
HRGN h;
@ -1302,100 +1167,52 @@ _gdk_win32_bitmap_to_region (GdkPixmap *pixmap)
return hRgn;
}
#ifdef G_ENABLE_DEBUG
gchar *
gdk_win32_cap_style_to_string (GdkCapStyle cap_style)
HRGN
_gdk_win32_gdkregion_to_hrgn (GdkRegion *region,
gint x_origin,
gint y_origin)
{
switch (cap_style)
{
#define CASE(x) case x: return #x + strlen ("GDK_CAP_")
CASE (GDK_CAP_NOT_LAST);
CASE (GDK_CAP_BUTT);
CASE (GDK_CAP_ROUND);
CASE (GDK_CAP_PROJECTING);
#undef CASE
default: return ("illegal GdkCapStyle value");
}
/* NOTREACHED */
return NULL;
}
HRGN hrgn;
RGNDATA *rgndata;
RECT *rect;
GdkRegionBox *boxes = region->rects;
guint nbytes =
sizeof (RGNDATAHEADER) + (sizeof (RECT) * region->numRects);
int i;
gchar *
gdk_win32_fill_style_to_string (GdkFill fill)
{
switch (fill)
{
#define CASE(x) case x: return #x + strlen ("GDK_")
CASE (GDK_SOLID);
CASE (GDK_TILED);
CASE (GDK_STIPPLED);
CASE (GDK_OPAQUE_STIPPLED);
#undef CASE
default: return ("illegal GdkFill value");
}
/* NOTREACHED */
return NULL;
}
rgndata = g_malloc (nbytes);
rgndata->rdh.dwSize = sizeof (RGNDATAHEADER);
rgndata->rdh.iType = RDH_RECTANGLES;
rgndata->rdh.nCount = rgndata->rdh.nRgnSize = 0;
SetRect (&rgndata->rdh.rcBound,
G_MAXSHORT, G_MAXSHORT, G_MINSHORT, G_MINSHORT);
gchar *
gdk_win32_function_to_string (GdkFunction function)
{
switch (function)
for (i = 0; i < region->numRects; i++)
{
#define CASE(x) case x: return #x + strlen ("GDK_")
CASE (GDK_COPY);
CASE (GDK_INVERT);
CASE (GDK_XOR);
CASE (GDK_CLEAR);
CASE (GDK_AND);
CASE (GDK_AND_REVERSE);
CASE (GDK_AND_INVERT);
CASE (GDK_NOOP);
CASE (GDK_OR);
CASE (GDK_EQUIV);
CASE (GDK_OR_REVERSE);
CASE (GDK_COPY_INVERT);
CASE (GDK_OR_INVERT);
CASE (GDK_NAND);
CASE (GDK_SET);
#undef CASE
default: return ("illegal GdkFunction value");
}
/* NOTREACHED */
return NULL;
}
rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++;
gchar *
gdk_win32_join_style_to_string (GdkJoinStyle join_style)
{
switch (join_style)
{
#define CASE(x) case x: return #x + strlen ("GDK_JOIN_")
CASE (GDK_JOIN_MITER);
CASE (GDK_JOIN_ROUND);
CASE (GDK_JOIN_BEVEL);
#undef CASE
default: return ("illegal GdkJoinStyle value");
}
/* NOTREACHED */
return NULL;
}
rect->left = CLAMP (boxes[i].x1 + x_origin,
G_MINSHORT, G_MAXSHORT);
rect->right = CLAMP (boxes[i].x2 + x_origin,
G_MINSHORT, G_MAXSHORT);
rect->top = CLAMP (boxes[i].y1 + y_origin,
G_MINSHORT, G_MAXSHORT);
rect->bottom = CLAMP (boxes[i].y2 + y_origin,
G_MINSHORT, G_MAXSHORT);
gchar *
gdk_win32_line_style_to_string (GdkLineStyle line_style)
{
switch (line_style)
{
#define CASE(x) case x: return #x + strlen ("GDK_LINE_")
CASE(GDK_LINE_SOLID);
CASE(GDK_LINE_ON_OFF_DASH);
CASE(GDK_LINE_DOUBLE_DASH);
#undef CASE
default: return ("illegal GdkLineStyle value");
if (rect->left < rgndata->rdh.rcBound.left)
rgndata->rdh.rcBound.left = rect->left;
if (rect->right > rgndata->rdh.rcBound.right)
rgndata->rdh.rcBound.right = rect->right;
if (rect->top < rgndata->rdh.rcBound.top)
rgndata->rdh.rcBound.top = rect->top;
if (rect->bottom > rgndata->rdh.rcBound.bottom)
rgndata->rdh.rcBound.bottom = rect->bottom;
}
/* NOTREACHED */
return NULL;
}
if ((hrgn = ExtCreateRegion (NULL, nbytes, rgndata)) == NULL)
WIN32_API_FAILED ("ExtCreateRegion");
#endif
g_free (rgndata);
return (hrgn);
}

View File

@ -39,6 +39,8 @@
typedef struct _GdkWindowQueueItem GdkWindowQueueItem;
typedef struct _GdkWindowParentPos GdkWindowParentPos;
#if 0
typedef enum {
GDK_WINDOW_QUEUE_TRANSLATE,
GDK_WINDOW_QUEUE_ANTIEXPOSE
@ -60,6 +62,8 @@ struct _GdkWindowQueueItem
} u;
};
#endif
struct _GdkWindowParentPos
{
gint x;
@ -69,11 +73,12 @@ struct _GdkWindowParentPos
GdkRectangle clip_rect;
};
static void gdk_window_compute_position (GdkWindowImplWin32 *window,
static void gdk_window_compute_position (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos,
GdkWin32PositionInfo *info);
static void gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_compute_parent_pos (GdkWindowImplWin32 *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_premove (GdkWindow *window,
GdkWindowParentPos *parent_pos);
static void gdk_window_postmove (GdkWindow *window,
@ -87,7 +92,9 @@ static void gdk_window_clip_changed (GdkWindow *window,
GdkRectangle *old_clip,
GdkRectangle *new_clip);
#if 0
static GSList *translate_queue = NULL;
#endif
void
_gdk_windowing_window_get_offsets (GdkWindow *window,
@ -121,35 +128,55 @@ gdk_window_copy_area_scroll (GdkWindow *window,
gint dx,
gint dy)
{
#if 0
GdkWindowObject *obj = GDK_WINDOW_OBJECT (window);
GList *tmp_list;
#endif
GDK_NOTE (MISC, g_print ("gdk_window_copy_area_scroll: %p %dx%d@+%d+%d %d,%d\n",
GDK_NOTE (MISC, g_print ("gdk_window_copy_area_scroll: %p %s %d,%d\n",
GDK_WINDOW_HWND (window),
dest_rect->width, dest_rect->height,
dest_rect->x, dest_rect->y,
_gdk_win32_gdkrectangle_to_string (dest_rect),
dx, dy));
if (dest_rect->width > 0 && dest_rect->height > 0)
{
RECT clipRect;
#ifdef G_ENABLE_DEBUG
RECT update_rect;
#endif
clipRect.left = dest_rect->x;
clipRect.top = dest_rect->y;
clipRect.right = clipRect.left + dest_rect->width;
clipRect.bottom = clipRect.top + dest_rect->height;
if (dx < 0)
clipRect.right -= dx;
else
clipRect.left -= dx;
if (dy < 0)
clipRect.bottom -= dy;
else
clipRect.top -= dy;
gdk_window_queue_translation (window, dx, dy);
if (!ScrollWindowEx (GDK_WINDOW_HWND (window),
dx, dy, /* in: scroll offsets */
NULL, /* in: scroll rect, NULL == entire client area */
&clipRect, /* in: restrict to */
NULL, /* out: update region */
NULL, /* in: update region */
NULL, /* out: update rect */
SW_INVALIDATE))
SW_INVALIDATE | SW_SCROLLCHILDREN))
WIN32_API_FAILED ("ScrollWindowEx");
GDK_NOTE (EVENTS,
(GetUpdateRect (GDK_WINDOW_HWND (window), &update_rect, FALSE),
g_print ("gdk_window_copy_area_scroll: post-scroll update rect: %s\n",
_gdk_win32_rect_to_string (&update_rect))));
}
#if 0 /* Not needed, ScrollWindowEx also scrolls the children. */
tmp_list = obj->children;
while (tmp_list)
{
@ -160,6 +187,7 @@ gdk_window_copy_area_scroll (GdkWindow *window,
tmp_list = tmp_list->next;
}
#endif
}
static void
@ -208,6 +236,8 @@ compute_intermediate_position (GdkWin32PositionInfo *position_info,
new_position->height = new_y1 - new_y0;
}
#if 0
static void
gdk_window_guffaw_scroll (GdkWindow *window,
gint dx,
@ -223,7 +253,7 @@ gdk_window_guffaw_scroll (GdkWindow *window,
GdkWindowParentPos parent_pos;
GList *tmp_list;
GDK_NOTE (EVENTS, g_print ("gdk_window_guffaw_scroll %p %d,%d\n",
GDK_NOTE (EVENTS, g_print ("gdk_window_guffaw_scroll: %p %d,%d\n",
GDK_WINDOW_HWND (window), dx, dy));
gdk_window_compute_parent_pos (impl, &parent_pos);
@ -250,7 +280,7 @@ gdk_window_guffaw_scroll (GdkWindow *window,
*/
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
new_position.x, new_position.y,
new_position.width, new_position.height,
new_position.width, new_position.height,
SWP_NOACTIVATE | SWP_NOZORDER))
WIN32_API_FAILED ("SetWindowPos");
@ -291,12 +321,16 @@ gdk_window_guffaw_scroll (GdkWindow *window,
}
}
#endif
void
gdk_window_scroll (GdkWindow *window,
gint dx,
gint dy)
{
#if 0
gboolean can_guffaw_scroll = FALSE;
#endif
GdkRegion *invalidate_region;
GdkWindowImplWin32 *impl;
GdkWindowObject *obj;
@ -307,7 +341,7 @@ gdk_window_scroll (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
GDK_NOTE (EVENTS, g_print ("gdk_window_scroll %p %d,%d\n",
GDK_NOTE (EVENTS, g_print ("gdk_window_scroll: %p %d,%d\n",
GDK_WINDOW_HWND (window), dx, dy));
obj = GDK_WINDOW_OBJECT (window);
@ -338,7 +372,7 @@ gdk_window_scroll (GdkWindow *window,
gdk_window_invalidate_region (window, invalidate_region, TRUE);
gdk_region_destroy (invalidate_region);
#if 0
/* We can guffaw scroll if we are a child window, and the parent
* does not extend beyond our edges. Otherwise, we use XCopyArea, then
* move any children later
@ -354,6 +388,9 @@ gdk_window_scroll (GdkWindow *window,
gdk_window_copy_area_scroll (window, &dest_rect, dx, dy);
else
gdk_window_guffaw_scroll (window, dx, dy);
#else
gdk_window_copy_area_scroll (window, &dest_rect, dx, dy);
#endif
}
void
@ -376,23 +413,28 @@ _gdk_window_move_resize_child (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %p %dx%d@+%d+%d\n",
GDK_WINDOW_HWND (window), width, height, x, y));
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@+%d+%d %dx%d@+%d+%d\n",
_gdk_win32_drawable_description (window),
obj->x, obj->y,
width, height, x, y));
dx = x - obj->x;
dy = y - obj->y;
is_move = dx != 0 || dy != 0;
is_resize = impl->width != width || impl->height != height;
GDK_NOTE (MISC, g_print ("...is_move:%d is_resize:%d\n", is_move, is_resize));
if (!is_move && !is_resize)
return;
{
GDK_NOTE (MISC, g_print ("...neither move or resize\n"));
return;
}
GDK_NOTE (MISC, g_print ("...%s%s\n", is_move ? "is_move " : "", is_resize ? "is_resize" : ""));
obj->x = x;
obj->y = y;
impl->width = width;
@ -426,10 +468,9 @@ _gdk_window_move_resize_child (GdkWindow *window,
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
&new_position);
GDK_NOTE (MISC, g_print ("...SetWindowPos(%p,%dx%d@+%d+%d)\n",
GDK_NOTE (MISC, g_print ("...SetWindowPos(%p,%s)\n",
GDK_WINDOW_HWND (window),
new_position.width, new_position.height,
new_position.x, new_position.y));
_gdk_win32_gdkrectangle_to_string (&new_position)));
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
new_position.x, new_position.y,
new_position.width, new_position.height,
@ -510,6 +551,7 @@ _gdk_window_move_resize_child (GdkWindow *window,
new_info.x, new_info.y,
new_info.width, new_info.height,
SWP_NOACTIVATE | SWP_NOZORDER |
(is_move ? 0 : SWP_NOMOVE) |
(is_resize ? 0 : SWP_NOSIZE)))
WIN32_API_FAILED ("SetWindowPos");
@ -561,9 +603,9 @@ gdk_window_compute_position (GdkWindowImplWin32 *window,
if (parent_pos->x + wrapper->x < -(SIZE_LIMIT/2))
{
if (parent_pos->x + wrapper->x + window->width < (SIZE_LIMIT/2))
info->x = parent_pos->x + wrapper->x + window->width - SIZE_LIMIT - parent_pos->win32_x;
info->x = parent_pos->x + wrapper->x + window->width - info->width - parent_pos->win32_x;
else
info->x = -(SIZE_LIMIT/2) - parent_pos->win32_y;
info->x = -(SIZE_LIMIT/2) - parent_pos->win32_x;
}
else
info->x = parent_pos->x + wrapper->x - parent_pos->win32_x;
@ -581,7 +623,7 @@ gdk_window_compute_position (GdkWindowImplWin32 *window,
if (parent_pos->y + wrapper->y < -(SIZE_LIMIT/2))
{
if (parent_pos->y + wrapper->y + window->height < (SIZE_LIMIT/2))
info->y = parent_pos->y + wrapper->y + window->height - SIZE_LIMIT - parent_pos->win32_y;
info->y = parent_pos->y + wrapper->y + window->height - info->height - parent_pos->win32_y;
else
info->y = -(SIZE_LIMIT/2) - parent_pos->win32_y;
}
@ -732,6 +774,12 @@ gdk_window_premove (GdkWindow *window,
compute_intermediate_position (&impl->position_info, &new_info, d_xoffset, d_yoffset,
&new_position);
GDK_NOTE (MISC, g_print ("gdk_window_premove: %s@+%d+%d\n"
"...SetWindowPos(%s)\n",
_gdk_win32_drawable_description (window),
obj->x, obj->y,
_gdk_win32_gdkrectangle_to_string (&new_position)));
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
new_position.x, new_position.y,
new_position.width, new_position.height,
@ -777,6 +825,13 @@ gdk_window_postmove (GdkWindow *window,
if (d_xoffset > 0 || d_yoffset > 0)
gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
GDK_NOTE (MISC, g_print ("gdk_window_postmove: %s@+%d+%d\n"
"...SetWindowPos(%dx%d@+%d+%d)\n",
_gdk_win32_drawable_description (window),
obj->x, obj->y,
new_info.width, new_info.height,
new_info.x, new_info.y));
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
new_info.x, new_info.y,
new_info.width, new_info.height,
@ -800,6 +855,8 @@ gdk_window_postmove (GdkWindow *window,
}
}
#if 0
static void
gdk_window_queue_append (GdkWindow *window,
GdkWindowQueueItem *item)
@ -809,93 +866,77 @@ gdk_window_queue_append (GdkWindow *window,
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
GDK_NOTE (EVENTS, g_print ("gdk_window_queue_append: length >= 128\n"));
_gdk_window_process_expose (window, GetCurrentTime (), &impl->position_info.clip_rect);
_gdk_window_process_expose (window, _gdk_win32_get_next_tick (0),
&impl->position_info.clip_rect);
}
item->window = window;
item->serial = GetTickCount ();
GDK_NOTE (EVENTS, (g_print ("gdk_window_queue_append: %s %p %ld ",
(item->type == GDK_WINDOW_QUEUE_TRANSLATE ?
"TRANSLATE" : "ANTIEXPOSE"),
GDK_WINDOW_HWND (window),
item->serial),
(item->type == GDK_WINDOW_QUEUE_TRANSLATE ?
g_print ("%d,%d\n",
item->u.translate.dx, item->u.translate.dy) :
g_print ("%s\n",
_gdk_win32_gdkregion_to_string (item->u.antiexpose.area)))));
gdk_drawable_ref (window);
translate_queue = g_slist_append (translate_queue, item) ;
}
#endif
static void
gdk_window_queue_translation (GdkWindow *window,
gint dx,
gint dy)
{
#if 0
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
item->window = window;
item->serial = GetMessageTime ();
item->type = GDK_WINDOW_QUEUE_TRANSLATE;
item->u.translate.dx = dx;
item->u.translate.dy = dy;
GDK_NOTE (EVENTS, g_print ("gdk_window_queue_translation %p %ld %d,%d\n",
GDK_WINDOW_HWND (window),
item->serial,
dx, dy));
gdk_drawable_ref (window);
gdk_window_queue_append (window, item);
#endif
}
gboolean
_gdk_windowing_window_queue_antiexpose (GdkWindow *window,
GdkRegion *area)
{
#if 1
GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
HRGN hrgn = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);
item->window = window;
item->serial = GetMessageTime ();
item->type = GDK_WINDOW_QUEUE_ANTIEXPOSE;
item->u.antiexpose.area = area;
GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose %p %ld %dx%d@+%d+%d\n",
GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose: ValidateRgn %p %s\n",
GDK_WINDOW_HWND (window),
item->serial,
area->extents.x2 - area->extents.x1,
area->extents.y2 - area->extents.y1,
area->extents.x1, area->extents.y1));
_gdk_win32_gdkregion_to_string (area)));
gdk_drawable_ref (window);
gdk_window_queue_append (window, item);
ValidateRgn (GDK_WINDOW_HWND (window), hrgn);
return TRUE;
#else
GdkRectangle r;
HRGN hrgn;
DeleteObject (hrgn);
gdk_region_get_clipbox (area, &r);
hrgn = CreateRectRgn(r.x, r.y, r.width+1, r.height+1);
g_return_val_if_fail (area != NULL, FALSE);
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_queue_antiexpose %p\n",
GDK_WINDOW_HWND (window)));
/* HB: not quite sure if this is the right thing to do.
* (Region not to be proceesed by next WM_PAINT)
*/
ValidateRgn(GDK_WINDOW_HWND (window), hrgn);
DeleteObject(hrgn);
return TRUE;
#endif
return FALSE;
}
void
_gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area)
GdkRegion *invalidate_region)
{
GdkWindowImplWin32 *impl;
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *clip_region;
#if 0
GSList *tmp_list = translate_queue;
#endif
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose %p %ld %dx%d@+%d+%d\n",
GDK_WINDOW_HWND (window), serial,
area->width, area->height, area->x, area->y));
GDK_NOTE (EVENTS, g_print ("_gdk_window_process_expose: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_gdkregion_to_string (invalidate_region)));
#if 0
while (tmp_list)
{
GdkWindowQueueItem *item = tmp_list->data;
@ -906,15 +947,33 @@ _gdk_window_process_expose (GdkWindow *window,
if (item->window == window)
{
if (item->type == GDK_WINDOW_QUEUE_TRANSLATE)
gdk_region_offset (invalidate_region, - item->u.translate.dx, - item->u.translate.dy);
{
GDK_NOTE (EVENTS, g_print ("...item %ld xlating region by %d,%d\n",
item->serial,
item->u.translate.dx, item->u.translate.dy));
gdk_region_offset (invalidate_region, - item->u.translate.dx, - item->u.translate.dy);
}
else /* anti-expose */
gdk_region_subtract (invalidate_region, item->u.antiexpose.area);
{
#ifdef G_ENABLE_DEBUG
GdkRectangle rect;
GDK_NOTE (EVENTS,
(gdk_region_get_clipbox (item->u.antiexpose.area, &rect),
g_print ("...item %ld antiexposing %s\n",
item->serial,
_gdk_win32_gdkrectangle_to_string (&rect))));
#endif
gdk_region_subtract (invalidate_region, item->u.antiexpose.area);
}
}
}
else
{
GSList *tmp_link = translate_queue;
GDK_NOTE (EVENTS, g_print ("...item %ld being removed\n", item->serial));
translate_queue = g_slist_remove_link (translate_queue, translate_queue);
gdk_drawable_unref (item->window);
@ -926,13 +985,14 @@ _gdk_window_process_expose (GdkWindow *window,
}
}
GDK_NOTE (EVENTS, g_print ("...queue length now %d\n", g_slist_length (translate_queue)));
#endif
clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
gdk_region_intersect (invalidate_region, clip_region);
if (!gdk_region_empty (invalidate_region))
gdk_window_invalidate_region (window, invalidate_region, FALSE);
gdk_region_destroy (invalidate_region);
gdk_region_destroy (clip_region);
}
@ -980,7 +1040,9 @@ gdk_window_tmp_reset_bg (GdkWindow *window)
}
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)
{
GdkWindowImplWin32 *impl;
GdkWindowObject *obj;
@ -1012,6 +1074,9 @@ gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle
if (!gdk_region_empty (new_clip_region))
{
gdk_window_tmp_unset_bg (window);
GDK_NOTE (EVENTS,
g_print ("gdk_window_clip_changed: invalidating region: %s\n",
_gdk_win32_gdkregion_to_string (new_clip_region)));
gdk_window_invalidate_region (window, new_clip_region, FALSE);
}

View File

@ -28,29 +28,29 @@
#include "gdktypes.h"
#include "gdkprivate-win32.h"
HWND gdk_root_window = NULL;
HDC gdk_display_hdc;
HINSTANCE gdk_dll_hinstance;
HINSTANCE gdk_app_hmodule;
HWND _gdk_root_window = NULL;
HDC _gdk_display_hdc;
HINSTANCE _gdk_dll_hinstance;
HINSTANCE _gdk_app_hmodule;
HKL _gdk_input_locale;
UINT _gdk_input_codepage;
WORD cf_rtf;
WORD cf_utf8_string;
WORD _cf_rtf;
WORD _cf_utf8_string;
GdkAtom utf8_string;
GdkAtom compound_text;
GdkAtom text_uri_list;
GdkAtom _utf8_string;
GdkAtom _compound_text;
GdkAtom _text_uri_list;
GdkAtom local_dnd;
GdkAtom gdk_win32_dropfiles;
GdkAtom gdk_ole2_dnd;
GdkAtom _local_dnd;
GdkAtom _gdk_win32_dropfiles;
GdkAtom _gdk_ole2_dnd;
GdkAtom _gdk_selection_property;
DWORD windows_version;
DWORD _windows_version;
gint gdk_input_ignore_wintab = FALSE;
gint gdk_event_func_from_window_proc = FALSE;
gint gdk_max_colors = 0;
gint _gdk_input_ignore_wintab = FALSE;
gint _gdk_event_func_from_window_proc = FALSE;
gint _gdk_max_colors = 0;

View File

@ -213,7 +213,7 @@ gdk_input_wintab_init (void)
_gdk_input_devices = NULL;
wintab_contexts = NULL;
if (!gdk_input_ignore_wintab &&
if (!_gdk_input_ignore_wintab &&
WTInfo (0, 0, NULL))
{
WTInfo (WTI_INTERFACE, IFC_SPECVERSION, &specversion);
@ -848,7 +848,7 @@ _gdk_input_other_event (GdkEvent *event,
if (event->any.type == GDK_BUTTON_PRESS
|| event->any.type == GDK_BUTTON_RELEASE)
{
event->button.time = msg->time;
event->button.time = _gdk_win32_get_next_tick (msg->time);
event->button.device = &gdkdev->info;
#if 0
@ -877,7 +877,7 @@ _gdk_input_other_event (GdkEvent *event,
}
else
{
event->motion.time = msg->time;
event->motion.time = _gdk_win32_get_next_tick (msg->time);
event->motion.is_hint = FALSE;
event->motion.device = &gdkdev->info;
@ -946,7 +946,7 @@ _gdk_input_other_event (GdkEvent *event,
event->proximity.type = GDK_PROXIMITY_IN;
_gdk_input_ignore_core = TRUE;
}
event->proximity.time = msg->time;
event->proximity.time = _gdk_win32_get_next_tick (msg->time);
event->proximity.device = &gdkdev->info;
GDK_NOTE (EVENTS_OR_INPUT,

View File

@ -34,6 +34,7 @@
#include <io.h>
#include "gdk.h"
#include "gdkregion-generic.h"
#include "gdkkeysyms.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
@ -41,27 +42,35 @@
#include <objbase.h>
#if defined (__GNUC__) && defined (HAVE_DIMM_H)
/* The w32api imm.h clashes a bit with the IE5.5 dimm.h */
# define IMEMENUITEMINFOA hidden_IMEMENUITEMINFOA
# define IMEMENUITEMINFOW hidden_IMEMENUITEMINFOW
#endif
#include <imm.h>
static gboolean gdk_synchronize = FALSE;
GdkArgDesc _gdk_windowing_args[] = {
{ "sync", GDK_ARG_BOOL, &gdk_synchronize, (GdkArgFunc) NULL},
{ "no-wintab", GDK_ARG_BOOL, &gdk_input_ignore_wintab,
{ "no-wintab", GDK_ARG_BOOL, &_gdk_input_ignore_wintab,
(GdkArgFunc) NULL},
{ "ignore-wintab", GDK_ARG_BOOL, &gdk_input_ignore_wintab,
{ "ignore-wintab", GDK_ARG_BOOL, &_gdk_input_ignore_wintab,
(GdkArgFunc) NULL},
{ "event-func-from-window-proc",
GDK_ARG_BOOL, &gdk_event_func_from_window_proc,
GDK_ARG_BOOL, &_gdk_event_func_from_window_proc,
(GdkArgFunc) NULL},
{ "max-colors", GDK_ARG_INT, &gdk_max_colors, (GdkArgFunc) NULL},
{ "max-colors", GDK_ARG_INT, &_gdk_max_colors, (GdkArgFunc) NULL},
{ NULL }
};
int __stdcall
DllMain(HINSTANCE hinstDLL,
DWORD dwReason,
LPVOID reserved)
DllMain (HINSTANCE hinstDLL,
DWORD dwReason,
LPVOID reserved)
{
gdk_dll_hinstance = hinstDLL;
_gdk_dll_hinstance = hinstDLL;
return TRUE;
}
@ -74,39 +83,39 @@ _gdk_windowing_init (gint *argc,
#ifdef HAVE_WINTAB
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
gdk_input_ignore_wintab = TRUE;
_gdk_input_ignore_wintab = TRUE;
#endif
if (getenv ("GDK_EVENT_FUNC_FROM_WINDOW_PROC") != NULL)
gdk_event_func_from_window_proc = TRUE;
_gdk_event_func_from_window_proc = TRUE;
if (gdk_synchronize)
GdiSetBatchLimit (1);
gdk_app_hmodule = GetModuleHandle (NULL);
gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
gdk_root_window = GetDesktopWindow ();
windows_version = GetVersion ();
_gdk_app_hmodule = GetModuleHandle (NULL);
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
_gdk_root_window = GetDesktopWindow ();
_windows_version = GetVersion ();
_gdk_input_locale = GetKeyboardLayout (0);
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
buf, sizeof (buf));
_gdk_input_codepage = atoi (buf);
GDK_NOTE (MISC, g_print ("input_locale: %p, codepage:%d\n",
_gdk_input_locale, _gdk_input_codepage));
GDK_NOTE (EVENTS, g_print ("input_locale: %p, codepage:%d\n",
_gdk_input_locale, _gdk_input_codepage));
CoInitialize (NULL);
cf_rtf = RegisterClipboardFormat ("Rich Text Format");
cf_utf8_string = RegisterClipboardFormat ("UTF8_STRING");
_cf_rtf = RegisterClipboardFormat ("Rich Text Format");
_cf_utf8_string = RegisterClipboardFormat ("UTF8_STRING");
utf8_string = gdk_atom_intern ("UTF8_STRING", FALSE);
compound_text = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
text_uri_list = gdk_atom_intern ("text/uri-list", FALSE);
_utf8_string = gdk_atom_intern ("UTF8_STRING", FALSE);
_compound_text = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
_text_uri_list = gdk_atom_intern ("text/uri-list", FALSE);
local_dnd = gdk_atom_intern ("LocalDndSelection", FALSE);
gdk_win32_dropfiles = gdk_atom_intern ("DROPFILES_DND", FALSE);
gdk_ole2_dnd = gdk_atom_intern ("OLE2_DND", FALSE);
_local_dnd = gdk_atom_intern ("LocalDndSelection", FALSE);
_gdk_win32_dropfiles = gdk_atom_intern ("DROPFILES_DND", FALSE);
_gdk_ole2_dnd = gdk_atom_intern ("OLE2_DND", FALSE);
_gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE);
@ -114,7 +123,7 @@ _gdk_windowing_init (gint *argc,
}
void
gdk_win32_api_failed (const gchar *where,
_gdk_win32_api_failed (const gchar *where,
gint line,
const gchar *api)
{
@ -124,7 +133,7 @@ gdk_win32_api_failed (const gchar *where,
}
void
gdk_other_api_failed (const gchar *where,
_gdk_other_api_failed (const gchar *where,
gint line,
const gchar *api)
{
@ -132,7 +141,7 @@ gdk_other_api_failed (const gchar *where,
}
void
gdk_win32_gdi_failed (const gchar *where,
_gdk_win32_gdi_failed (const gchar *where,
gint line,
const gchar *api)
{
@ -140,9 +149,9 @@ gdk_win32_gdi_failed (const gchar *where,
* don't set the 32-bit error code, sigh.
*/
if (IS_WIN_NT ())
gdk_win32_api_failed (where, line, api);
_gdk_win32_api_failed (where, line, api);
else
gdk_other_api_failed (where, line, api);
_gdk_other_api_failed (where, line, api);
}
void
@ -171,13 +180,13 @@ gdk_screen_get_height (GdkScreen *screen)
gint
gdk_screen_get_width_mm (GdkScreen *screen)
{
return (double) GetDeviceCaps (gdk_display_hdc, HORZRES) / GetDeviceCaps (gdk_display_hdc, LOGPIXELSX) * 25.4;
return (double) GetDeviceCaps (_gdk_display_hdc, HORZRES) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
}
gint
gdk_screen_get_height_mm (GdkScreen *screen)
{
return (double) GetDeviceCaps (gdk_display_hdc, VERTRES) / GetDeviceCaps (gdk_display_hdc, LOGPIXELSY) * 25.4;
return (double) GetDeviceCaps (_gdk_display_hdc, VERTRES) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
}
void
@ -199,8 +208,8 @@ _gdk_windowing_exit (void)
{
_gdk_win32_dnd_exit ();
CoUninitialize ();
DeleteDC (gdk_display_hdc);
gdk_display_hdc = NULL;
DeleteDC (_gdk_display_hdc);
_gdk_display_hdc = NULL;
}
void
@ -218,3 +227,616 @@ void
gdk_notify_startup_complete (void)
{
}
#ifdef G_ENABLE_DEBUG
/*
* Like g_strdup_printf, but to a static buffer. Return value does not
* have to be g_free()d. The buffer is of bounded size and reused
* cyclically. Thus the return value is valid only until that part of
* the buffer happens to get reused. This doesn't matter as this
* function's return value is used in debugging output right after the call,
* and the return value isn't used after that.
*/
static gchar *
static_printf (const gchar *format,
...)
{
static gchar buf[10000];
gchar *msg;
static gchar *bufp = buf;
gchar *retval;
va_list args;
va_start (args, format);
msg = g_strdup_vprintf (format, args);
va_end (args);
g_assert (strlen (msg) < sizeof (buf));
if (bufp + strlen (msg) + 1 > buf + sizeof (buf))
bufp = buf;
retval = bufp;
strcpy (bufp, msg);
bufp += strlen (msg) + 1;
g_free (msg);
return retval;
}
gchar *
_gdk_win32_color_to_string (const GdkColor *color)
{
return static_printf ("(%.04x,%.04x,%.04x):%.06x",
color->red, color->green,
color->blue, color->pixel);
}
void
_gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
const int nentries)
{
char buf[20];
int i;
for (i = 0; i < nentries; i++)
g_print (" %3d %02x: %02x %02x %02x%s\n",
i, i,
pep[i].peRed, pep[i].peGreen, pep[i].peBlue,
(pep[i].peFlags == 0 ? "" :
(pep[i].peFlags == PC_EXPLICIT ? " PC_EXPLICIT" :
(pep[i].peFlags == PC_NOCOLLAPSE ? " PC_NOCOLLAPSE" :
(pep[i].peFlags == PC_RESERVED ? " PC_RESERVED" :
(sprintf (buf, " %d", pep[i].peFlags), buf))))));
}
void
_gdk_win32_print_system_palette (void)
{
PALETTEENTRY *pe;
int k;
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, 0, NULL);
pe = g_new (PALETTEENTRY, k);
k = GetSystemPaletteEntries (_gdk_display_hdc, 0, k, pe);
if (!k)
g_print ("GetSystemPaletteEntries failed: %s\n",
g_win32_error_message (GetLastError ()));
else
{
g_print ("System palette: %d entries\n", k);
_gdk_win32_print_paletteentries (pe, k);
}
g_free (pe);
}
static gint
palette_size (HPALETTE hpal)
{
WORD npal = 0;
if (!GetObject (hpal, sizeof (npal), &npal))
WIN32_GDI_FAILED ("GetObject (HPALETTE)");
return npal;
}
void
_gdk_win32_print_hpalette (HPALETTE hpal)
{
PALETTEENTRY *pe;
gint n, npal;
npal = palette_size (hpal);
pe = g_new (PALETTEENTRY, npal);
n = GetPaletteEntries (hpal, 0, npal, pe);
if (!n)
g_print ("HPALETTE %p: GetPaletteEntries failed: %s\n",
hpal, g_win32_error_message (GetLastError ()));
else
{
g_print ("HPALETTE %p: %d (%d) entries\n", hpal, n, npal);
_gdk_win32_print_paletteentries (pe, n);
}
g_free (pe);
}
void
_gdk_win32_print_dc (HDC hdc)
{
HGDIOBJ obj;
LOGBRUSH logbrush;
EXTLOGPEN extlogpen;
HRGN hrgn;
RECT rect;
int flag;
g_print ("%p\n", hdc);
obj = GetCurrentObject (hdc, OBJ_BRUSH);
GetObject (obj, sizeof (LOGBRUSH), &logbrush);
g_print ("brush: style: %s color: %06lx hatch: %#lx\n",
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
logbrush.lbColor, logbrush.lbHatch);
obj = GetCurrentObject (hdc, OBJ_PEN);
GetObject (obj, sizeof (EXTLOGPEN), &extlogpen);
g_print ("pen: type: %s style: %s endcap: %s join: %s width: %d brush: %s\n",
_gdk_win32_pstype_to_string (extlogpen.elpPenStyle),
_gdk_win32_psstyle_to_string (extlogpen.elpPenStyle),
_gdk_win32_psendcap_to_string (extlogpen.elpPenStyle),
_gdk_win32_psjoin_to_string (extlogpen.elpPenStyle),
extlogpen.elpWidth,
_gdk_win32_lbstyle_to_string (extlogpen.elpBrushStyle));
hrgn = CreateRectRgn (0, 0, 0, 0);
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
WIN32_API_FAILED ("GetClipRgn");
else if (flag == 0)
g_print ("no clip region\n");
else if (flag == 1)
{
GetRgnBox (hrgn, &rect);
g_print ("clip region: %p bbox: %ldx%ld@+%ld+%ld\n",
hrgn,
rect.right - rect.left,
rect.bottom - rect.top,
rect.left, rect.top);
}
DeleteObject (hrgn);
}
gchar *
_gdk_win32_cap_style_to_string (GdkCapStyle cap_style)
{
switch (cap_style)
{
#define CASE(x) case GDK_CAP_##x: return #x
CASE (NOT_LAST);
CASE (BUTT);
CASE (ROUND);
CASE (PROJECTING);
#undef CASE
default: return static_printf ("illegal_%d", cap_style);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_fill_style_to_string (GdkFill fill)
{
switch (fill)
{
#define CASE(x) case GDK_##x: return #x
CASE (SOLID);
CASE (TILED);
CASE (STIPPLED);
CASE (OPAQUE_STIPPLED);
#undef CASE
default: return static_printf ("illegal_%d", fill);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_function_to_string (GdkFunction function)
{
switch (function)
{
#define CASE(x) case GDK_##x: return #x
CASE (COPY);
CASE (INVERT);
CASE (XOR);
CASE (CLEAR);
CASE (AND);
CASE (AND_REVERSE);
CASE (AND_INVERT);
CASE (NOOP);
CASE (OR);
CASE (EQUIV);
CASE (OR_REVERSE);
CASE (COPY_INVERT);
CASE (OR_INVERT);
CASE (NAND);
CASE (SET);
#undef CASE
default: return static_printf ("illegal_%d", function);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_join_style_to_string (GdkJoinStyle join_style)
{
switch (join_style)
{
#define CASE(x) case GDK_JOIN_##x: return #x
CASE (MITER);
CASE (ROUND);
CASE (BEVEL);
#undef CASE
default: return static_printf ("illegal_%d", join_style);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_line_style_to_string (GdkLineStyle line_style)
{
switch (line_style)
{
#define CASE(x) case GDK_LINE_##x: return #x
CASE(SOLID);
CASE(ON_OFF_DASH);
CASE(DOUBLE_DASH);
#undef CASE
default: return static_printf ("illegal_%d", line_style);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_lbstyle_to_string (UINT brush_style)
{
switch (brush_style)
{
#define CASE(x) case BS_##x: return #x
CASE (DIBPATTERN);
CASE (DIBPATTERNPT);
CASE (HATCHED);
CASE (HOLLOW);
CASE (PATTERN);
CASE (SOLID);
#undef CASE
default: return static_printf ("illegal_%d", brush_style);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_pstype_to_string (DWORD pen_style)
{
switch (pen_style & PS_TYPE_MASK)
{
case PS_GEOMETRIC: return "GEOMETRIC";
case PS_COSMETIC: return "COSMETIC";
default: return static_printf ("illegal_%d", pen_style & PS_TYPE_MASK);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_psstyle_to_string (DWORD pen_style)
{
switch (pen_style & PS_STYLE_MASK)
{
#define CASE(x) case PS_##x: return #x
CASE (DASH);
CASE (DASHDOT);
CASE (DASHDOTDOT);
CASE (DOT);
CASE (INSIDEFRAME);
CASE (NULL);
CASE (SOLID);
CASE (USERSTYLE);
#undef CASE
default: return static_printf ("illegal_%d", pen_style & PS_STYLE_MASK);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_psendcap_to_string (DWORD pen_style)
{
switch (pen_style & PS_ENDCAP_MASK)
{
#define CASE(x) case PS_ENDCAP_##x: return #x
CASE (FLAT);
CASE (ROUND);
CASE (SQUARE);
#undef CASE
default: return static_printf ("illegal_%d", pen_style & PS_ENDCAP_MASK);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_psjoin_to_string (DWORD pen_style)
{
switch (pen_style & PS_JOIN_MASK)
{
#define CASE(x) case PS_JOIN_##x: return #x
CASE (BEVEL);
CASE (MITER);
CASE (ROUND);
#undef CASE
default: return static_printf ("illegal_%d", pen_style & PS_JOIN_MASK);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_message_to_string (UINT msg)
{
switch (msg)
{
#define CASE(x) case x: return #x
CASE (WM_NULL);
CASE (WM_CREATE);
CASE (WM_DESTROY);
CASE (WM_MOVE);
CASE (WM_SIZE);
CASE (WM_ACTIVATE);
CASE (WM_SETFOCUS);
CASE (WM_KILLFOCUS);
CASE (WM_ENABLE);
CASE (WM_SETREDRAW);
CASE (WM_SETTEXT);
CASE (WM_GETTEXT);
CASE (WM_GETTEXTLENGTH);
CASE (WM_PAINT);
CASE (WM_CLOSE);
CASE (WM_QUERYENDSESSION);
CASE (WM_QUERYOPEN);
CASE (WM_ENDSESSION);
CASE (WM_QUIT);
CASE (WM_ERASEBKGND);
CASE (WM_SYSCOLORCHANGE);
CASE (WM_SHOWWINDOW);
CASE (WM_WININICHANGE);
CASE (WM_DEVMODECHANGE);
CASE (WM_ACTIVATEAPP);
CASE (WM_FONTCHANGE);
CASE (WM_TIMECHANGE);
CASE (WM_CANCELMODE);
CASE (WM_SETCURSOR);
CASE (WM_MOUSEACTIVATE);
CASE (WM_CHILDACTIVATE);
CASE (WM_QUEUESYNC);
CASE (WM_GETMINMAXINFO);
CASE (WM_PAINTICON);
CASE (WM_ICONERASEBKGND);
CASE (WM_NEXTDLGCTL);
CASE (WM_SPOOLERSTATUS);
CASE (WM_DRAWITEM);
CASE (WM_MEASUREITEM);
CASE (WM_DELETEITEM);
CASE (WM_VKEYTOITEM);
CASE (WM_CHARTOITEM);
CASE (WM_SETFONT);
CASE (WM_GETFONT);
CASE (WM_SETHOTKEY);
CASE (WM_GETHOTKEY);
CASE (WM_QUERYDRAGICON);
CASE (WM_COMPAREITEM);
CASE (WM_GETOBJECT);
CASE (WM_COMPACTING);
CASE (WM_WINDOWPOSCHANGING);
CASE (WM_WINDOWPOSCHANGED);
CASE (WM_POWER);
CASE (WM_COPYDATA);
CASE (WM_CANCELJOURNAL);
CASE (WM_NOTIFY);
CASE (WM_INPUTLANGCHANGEREQUEST);
CASE (WM_INPUTLANGCHANGE);
CASE (WM_TCARD);
CASE (WM_HELP);
CASE (WM_USERCHANGED);
CASE (WM_NOTIFYFORMAT);
CASE (WM_CONTEXTMENU);
CASE (WM_STYLECHANGING);
CASE (WM_STYLECHANGED);
CASE (WM_DISPLAYCHANGE);
CASE (WM_GETICON);
CASE (WM_SETICON);
CASE (WM_NCCREATE);
CASE (WM_NCDESTROY);
CASE (WM_NCCALCSIZE);
CASE (WM_NCHITTEST);
CASE (WM_NCPAINT);
CASE (WM_NCACTIVATE);
CASE (WM_GETDLGCODE);
CASE (WM_SYNCPAINT);
CASE (WM_NCMOUSEMOVE);
CASE (WM_NCLBUTTONDOWN);
CASE (WM_NCLBUTTONUP);
CASE (WM_NCLBUTTONDBLCLK);
CASE (WM_NCRBUTTONDOWN);
CASE (WM_NCRBUTTONUP);
CASE (WM_NCRBUTTONDBLCLK);
CASE (WM_NCMBUTTONDOWN);
CASE (WM_NCMBUTTONUP);
CASE (WM_NCMBUTTONDBLCLK);
CASE (WM_NCXBUTTONDOWN);
CASE (WM_NCXBUTTONUP);
CASE (WM_NCXBUTTONDBLCLK);
CASE (WM_KEYDOWN);
CASE (WM_KEYUP);
CASE (WM_CHAR);
CASE (WM_DEADCHAR);
CASE (WM_SYSKEYDOWN);
CASE (WM_SYSKEYUP);
CASE (WM_SYSCHAR);
CASE (WM_SYSDEADCHAR);
CASE (WM_KEYLAST);
CASE (WM_IME_STARTCOMPOSITION);
CASE (WM_IME_ENDCOMPOSITION);
CASE (WM_IME_COMPOSITION);
CASE (WM_INITDIALOG);
CASE (WM_COMMAND);
CASE (WM_SYSCOMMAND);
CASE (WM_TIMER);
CASE (WM_HSCROLL);
CASE (WM_VSCROLL);
CASE (WM_INITMENU);
CASE (WM_INITMENUPOPUP);
CASE (WM_MENUSELECT);
CASE (WM_MENUCHAR);
CASE (WM_ENTERIDLE);
CASE (WM_MENURBUTTONUP);
CASE (WM_MENUDRAG);
CASE (WM_MENUGETOBJECT);
CASE (WM_UNINITMENUPOPUP);
CASE (WM_MENUCOMMAND);
CASE (WM_CHANGEUISTATE);
CASE (WM_UPDATEUISTATE);
CASE (WM_QUERYUISTATE);
CASE (WM_CTLCOLORMSGBOX);
CASE (WM_CTLCOLOREDIT);
CASE (WM_CTLCOLORLISTBOX);
CASE (WM_CTLCOLORBTN);
CASE (WM_CTLCOLORDLG);
CASE (WM_CTLCOLORSCROLLBAR);
CASE (WM_CTLCOLORSTATIC);
CASE (WM_MOUSEMOVE);
CASE (WM_LBUTTONDOWN);
CASE (WM_LBUTTONUP);
CASE (WM_LBUTTONDBLCLK);
CASE (WM_RBUTTONDOWN);
CASE (WM_RBUTTONUP);
CASE (WM_RBUTTONDBLCLK);
CASE (WM_MBUTTONDOWN);
CASE (WM_MBUTTONUP);
CASE (WM_MBUTTONDBLCLK);
CASE (WM_MOUSEWHEEL);
CASE (WM_XBUTTONDOWN);
CASE (WM_XBUTTONUP);
CASE (WM_XBUTTONDBLCLK);
CASE (WM_PARENTNOTIFY);
CASE (WM_ENTERMENULOOP);
CASE (WM_EXITMENULOOP);
CASE (WM_NEXTMENU);
CASE (WM_SIZING);
CASE (WM_CAPTURECHANGED);
CASE (WM_MOVING);
CASE (WM_POWERBROADCAST);
CASE (WM_DEVICECHANGE);
CASE (WM_MDICREATE);
CASE (WM_MDIDESTROY);
CASE (WM_MDIACTIVATE);
CASE (WM_MDIRESTORE);
CASE (WM_MDINEXT);
CASE (WM_MDIMAXIMIZE);
CASE (WM_MDITILE);
CASE (WM_MDICASCADE);
CASE (WM_MDIICONARRANGE);
CASE (WM_MDIGETACTIVE);
CASE (WM_MDISETMENU);
CASE (WM_ENTERSIZEMOVE);
CASE (WM_EXITSIZEMOVE);
CASE (WM_DROPFILES);
CASE (WM_MDIREFRESHMENU);
CASE (WM_IME_SETCONTEXT);
CASE (WM_IME_NOTIFY);
CASE (WM_IME_CONTROL);
CASE (WM_IME_COMPOSITIONFULL);
CASE (WM_IME_SELECT);
CASE (WM_IME_CHAR);
CASE (WM_IME_REQUEST);
CASE (WM_IME_KEYDOWN);
CASE (WM_IME_KEYUP);
CASE (WM_MOUSEHOVER);
CASE (WM_MOUSELEAVE);
CASE (WM_NCMOUSEHOVER);
CASE (WM_NCMOUSELEAVE);
CASE (WM_CUT);
CASE (WM_COPY);
CASE (WM_PASTE);
CASE (WM_CLEAR);
CASE (WM_UNDO);
CASE (WM_RENDERFORMAT);
CASE (WM_RENDERALLFORMATS);
CASE (WM_DESTROYCLIPBOARD);
CASE (WM_DRAWCLIPBOARD);
CASE (WM_PAINTCLIPBOARD);
CASE (WM_VSCROLLCLIPBOARD);
CASE (WM_SIZECLIPBOARD);
CASE (WM_ASKCBFORMATNAME);
CASE (WM_CHANGECBCHAIN);
CASE (WM_HSCROLLCLIPBOARD);
CASE (WM_QUERYNEWPALETTE);
CASE (WM_PALETTEISCHANGING);
CASE (WM_PALETTECHANGED);
CASE (WM_HOTKEY);
CASE (WM_PRINT);
CASE (WM_PRINTCLIENT);
CASE (WM_APPCOMMAND);
CASE (WM_HANDHELDFIRST);
CASE (WM_HANDHELDLAST);
CASE (WM_AFXFIRST);
CASE (WM_AFXLAST);
CASE (WM_PENWINFIRST);
CASE (WM_PENWINLAST);
CASE (WM_APP);
#undef CASE
default:
if (msg >= WM_HANDHELDFIRST && msg <= WM_HANDHELDLAST)
return static_printf ("WM_HANDHELDFIRST+%d", msg - WM_HANDHELDFIRST);
else if (msg >= WM_AFXFIRST && msg <= WM_AFXLAST)
return static_printf ("WM_AFXFIRST+%d", msg - WM_AFXFIRST);
else if (msg >= WM_PENWINFIRST && msg <= WM_PENWINLAST)
return static_printf ("WM_PENWINFIRST+%d", msg - WM_PENWINFIRST);
else if (msg >= WM_USER && msg <= 0x7FFF)
return static_printf ("WM_USER+%d", msg - WM_USER);
else if (msg >= 0xC000 && msg <= 0xFFFF)
return static_printf ("reg-%#x", msg);
else
return static_printf ("unk-%#x", msg);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_rect_to_string (const RECT *rect)
{
return static_printf ("%ldx%ld@+%ld+%ld",
(rect->right - rect->left), (rect->bottom - rect->top),
rect->left, rect->top);
}
gchar *
_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect)
{
return static_printf ("%dx%d@+%d+%d",
rect->width, rect->height,
rect->x, rect->y);
}
gchar *
_gdk_win32_gdkregion_to_string (const GdkRegion *rgn)
{
return static_printf ("%dx%d@+%d+%d",
(rgn->extents.x2 - rgn->extents.x1),
(rgn->extents.y2 - rgn->extents.y1),
rgn->extents.x1, rgn->extents.y1);
}
gchar *
_gdk_win32_drawable_description (GdkDrawable *d)
{
GdkVisual *v;
gint width, height;
gdk_drawable_get_size (d, &width, &height);
return static_printf
("%s:%p:%dx%dx%d",
G_OBJECT_TYPE_NAME (d),
GDK_DRAWABLE_HANDLE (d),
width, height,
(GDK_IS_PIXMAP (d) ? GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (d)->impl)->image->depth
: ((v = gdk_drawable_get_visual (d)) ? v->depth : gdk_visual_get_system ()->depth)));
}
#endif /* G_ENABLE_DEBUG */

View File

@ -263,11 +263,7 @@ struct _GdkGCWin32
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HDC hdc;
int saved_dc;
GdkRegion *clip_region;
HRGN hcliprgn;
GdkGCValuesMask values_mask;
@ -286,8 +282,13 @@ struct _GdkGCWin32
DWORD pen_style;
DWORD *pen_dashes; /* use for PS_USERSTYLE or step-by-step rendering */
gint pen_num_dashes;
HANDLE hwnd; /* If a HDC is allocated, for which window,
* or what bitmap is selected into it
/* Following fields are valid while the GC exists as a Windows DC */
HDC hdc;
int saved_dc;
HANDLE hwnd; /* For which window, or what bitmap is
* selected into it
*/
HPALETTE holdpal;
};
@ -299,25 +300,16 @@ struct _GdkGCWin32Class
GType _gdk_gc_win32_get_type (void);
/* Routines from gdkgeometry-win32.c */
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
void _gdk_window_init_position (GdkWindow *window);
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
gint y,
gint width,
gint height);
void _gdk_window_process_expose (GdkWindow *window,
gulong serial,
GdkRectangle *area);
/* gdkdrawable-win32.c, background draw helper */
void _gdk_win32_draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
GdkPixmap *tile,
gint x,
gint y,
gint width,
gint height);
void _gdk_window_process_expose (GdkWindow *window,
GdkRegion *invalidate_region);
void _gdk_win32_selection_init (void);
void _gdk_win32_dnd_exit (void);
@ -372,9 +364,11 @@ void _gdk_win32_blit (gboolean use_fg_bg,
COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
gulong pixel);
HRGN _gdk_win32_bitmap_to_region (GdkPixmap *bitmap);
HRGN _gdk_win32_bitmap_to_hrgn (GdkPixmap *bitmap);
gchar *gdk_font_full_name_get (GdkFont *font);
HRGN _gdk_win32_gdkregion_to_hrgn (GdkRegion *region,
gint x_origin,
gint y_origin);
void _gdk_selection_property_store (GdkWindow *owner,
GdkAtom type,
@ -404,48 +398,62 @@ void _gdk_wchar_text_handle (GdkFont *font,
void *arg);
#ifdef G_ENABLE_DEBUG
gchar *gdk_win32_color_to_string (const GdkColor *color);
gchar *gdk_win32_cap_style_to_string (GdkCapStyle cap_style);
gchar *gdk_win32_fill_style_to_string (GdkFill fill);
gchar *gdk_win32_function_to_string (GdkFunction function);
gchar *gdk_win32_join_style_to_string (GdkJoinStyle join_style);
gchar *gdk_win32_line_style_to_string (GdkLineStyle line_style);
gchar *gdk_win32_message_name (UINT msg);
gchar *_gdk_win32_color_to_string (const GdkColor *color);
void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
const int nentries);
void _gdk_win32_print_system_palette (void);
void _gdk_win32_print_hpalette (HPALETTE hpal);
void _gdk_win32_print_dc (HDC hdc);
gchar *_gdk_win32_cap_style_to_string (GdkCapStyle cap_style);
gchar *_gdk_win32_fill_style_to_string (GdkFill fill);
gchar *_gdk_win32_function_to_string (GdkFunction function);
gchar *_gdk_win32_join_style_to_string (GdkJoinStyle join_style);
gchar *_gdk_win32_line_style_to_string (GdkLineStyle line_style);
gchar *_gdk_win32_drawable_description (GdkDrawable *d);
gchar *_gdk_win32_lbstyle_to_string (UINT brush_style);
gchar *_gdk_win32_pstype_to_string (DWORD pen_style);
gchar *_gdk_win32_psstyle_to_string (DWORD pen_style);
gchar *_gdk_win32_psendcap_to_string (DWORD pen_style);
gchar *_gdk_win32_psjoin_to_string (DWORD pen_style);
gchar *_gdk_win32_message_to_string (UINT msg);
gchar *_gdk_win32_rect_to_string (const RECT *rect);
gchar *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
gchar *_gdk_win32_gdkregion_to_string (const GdkRegion *box);
#define PING() printf(G_STRLOC),fflush(stdout)
#else
#define PING()
#endif
gchar *gdk_win32_last_error_string (void);
void gdk_win32_api_failed (const gchar *where,
gchar *_gdk_win32_last_error_string (void);
void _gdk_win32_api_failed (const gchar *where,
gint line,
const gchar *api);
void gdk_other_api_failed (const gchar *where,
void _gdk_other_api_failed (const gchar *where,
gint line,
const gchar *api);
void gdk_win32_gdi_failed (const gchar *where,
void _gdk_win32_gdi_failed (const gchar *where,
gint line,
const gchar *api);
#ifdef __GNUC__
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define WIN32_API_FAILED(api) _gdk_win32_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define WIN32_GDI_FAILED(api) _gdk_win32_gdi_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#define OTHER_API_FAILED(api) _gdk_other_api_failed (__FILE__ ":" __PRETTY_FUNCTION__, __LINE__, api)
#else
#define WIN32_API_FAILED(api) gdk_win32_api_failed (__FILE__, __LINE__, api)
#define WIN32_GDI_FAILED(api) gdk_win32_gdi_failed (__FILE__, __LINE__, api)
#define OTHER_API_FAILED(api) gdk_other_api_failed (__FILE__, __LINE__, api)
#define WIN32_API_FAILED(api) _gdk_win32_api_failed (__FILE__, __LINE__, api)
#define WIN32_GDI_FAILED(api) _gdk_win32_gdi_failed (__FILE__, __LINE__, api)
#define OTHER_API_FAILED(api) _gdk_other_api_failed (__FILE__, __LINE__, api)
#endif
extern LRESULT CALLBACK _gdk_win32_window_procedure (HWND, UINT, WPARAM, LPARAM);
extern HWND gdk_root_window;
extern HWND _gdk_root_window;
extern GdkWindow *_gdk_parent_root;
extern HDC gdk_display_hdc;
extern HINSTANCE gdk_dll_hinstance;
extern HINSTANCE gdk_app_hmodule;
extern HDC _gdk_display_hdc;
extern HINSTANCE _gdk_dll_hinstance;
extern HINSTANCE _gdk_app_hmodule;
/* These are thread specific, but GDK/win32 works OK only when invoked
* from a single thread anyway.
@ -456,28 +464,28 @@ extern UINT _gdk_input_codepage;
extern guint _gdk_keymap_serial;
/* Registered clipboard formats */
extern WORD cf_rtf;
extern WORD cf_utf8_string;
extern WORD _cf_rtf;
extern WORD _cf_utf8_string;
/* GdkAtoms: Targets */
extern GdkAtom utf8_string;
extern GdkAtom compound_text;
extern GdkAtom text_uri_list;
extern GdkAtom _utf8_string;
extern GdkAtom _compound_text;
extern GdkAtom _text_uri_list;
/* DND selections */
extern GdkAtom local_dnd;
extern GdkAtom gdk_win32_dropfiles;
extern GdkAtom gdk_ole2_dnd;
extern GdkAtom _local_dnd;
extern GdkAtom _gdk_win32_dropfiles;
extern GdkAtom _gdk_ole2_dnd;
extern GdkAtom _gdk_selection_property;
extern DWORD windows_version;
#define IS_WIN_NT() (windows_version < 0x80000000)
extern DWORD _windows_version;
#define IS_WIN_NT() (_windows_version < 0x80000000)
/* Options */
extern gboolean gdk_input_ignore_wintab;
extern gboolean gdk_event_func_from_window_proc;
extern gint gdk_max_colors;
extern gboolean _gdk_input_ignore_wintab;
extern gboolean _gdk_event_func_from_window_proc;
extern gint _gdk_max_colors;
#define GDK_WIN32_COLORMAP_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data)

View File

@ -425,7 +425,7 @@ gdk_property_change (GdkWindow *window,
break;
case RICH_TEXT:
cf = cf_rtf;
cf = _cf_rtf;
memmove (ucptr, rtf->str, size);
g_string_free (rtf, TRUE);
@ -439,7 +439,7 @@ gdk_property_change (GdkWindow *window,
guchar *utf8ptr = GlobalLock (hutf8);
memmove (utf8ptr, data, nelements);
GlobalUnlock (hutf8);
if (!SetClipboardData (cf_utf8_string, hutf8))
if (!SetClipboardData (_cf_utf8_string, hutf8))
WIN32_API_FAILED ("SetClipboardData (UTF8_STRING)");
}
break;

View File

@ -82,8 +82,8 @@ gdk_screen_get_number (GdkScreen *screen)
}
gchar *
_gdk_windowing_substitute_screen_number (gchar *display_name,
int screen_number)
_gdk_windowing_substitute_screen_number (const gchar *display_name,
int screen_number)
{
return g_strdup (display_name);
}

View File

@ -95,7 +95,7 @@ _gdk_dropfiles_store (gchar *data)
dropfiles_prop->data = data;
dropfiles_prop->length = strlen (data);
dropfiles_prop->format = 8;
dropfiles_prop->type = text_uri_list;
dropfiles_prop->type = _text_uri_list;
}
else
{
@ -280,7 +280,7 @@ gdk_selection_convert (GdkWindow *requestor,
}
if (IsClipboardFormatAvailable (CF_UNICODETEXT) ||
IsClipboardFormatAvailable (cf_utf8_string) ||
IsClipboardFormatAvailable (_cf_utf8_string) ||
IsClipboardFormatAvailable (CF_TEXT))
{
GdkAtom *data = g_new (GdkAtom, 1);
@ -292,7 +292,7 @@ gdk_selection_convert (GdkWindow *requestor,
property = GDK_NONE;
}
else if (selection == GDK_SELECTION_CLIPBOARD &&
(target == compound_text ||
(target == _compound_text ||
target == GDK_TARGET_STRING))
{
/* Converting the CLIPBOARD selection means he wants the
@ -342,7 +342,7 @@ gdk_selection_convert (GdkWindow *requestor,
GlobalUnlock (hdata);
}
}
else if ((hdata = GetClipboardData (cf_utf8_string)) != NULL)
else if ((hdata = GetClipboardData (_cf_utf8_string)) != NULL)
{
/* UTF8_STRING is a format we store ourselves when necessary */
guchar *ptr;
@ -426,7 +426,7 @@ gdk_selection_convert (GdkWindow *requestor,
CloseClipboard ();
}
else if (selection == gdk_win32_dropfiles)
else if (selection == _gdk_win32_dropfiles)
{
/* This means he wants the names of the dropped files.
* gdk_dropfiles_filter already has stored the text/uri-list
@ -609,7 +609,7 @@ gdk_string_to_compound_text_for_display (GdkDisplay *display,
GDK_NOTE (DND, g_print ("gdk_string_to_compound_text: %.20s\n", str));
if (encoding)
*encoding = compound_text;
*encoding = _compound_text;
if (format)
*format = 8;
@ -720,7 +720,7 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
{
return make_list ((gchar *)text, length, TRUE, list);
}
else if (encoding == utf8_string)
else if (encoding == _utf8_string)
{
return make_list ((gchar *)text, length, FALSE, list);
}

View File

@ -95,16 +95,16 @@ _gdk_visual_init (void)
} bmi;
HBITMAP hbm;
const gint rastercaps = GetDeviceCaps (gdk_display_hdc, RASTERCAPS);
gint bitspixel = GetDeviceCaps (gdk_display_hdc, BITSPIXEL);
const gint rastercaps = GetDeviceCaps (_gdk_display_hdc, RASTERCAPS);
gint bitspixel = GetDeviceCaps (_gdk_display_hdc, BITSPIXEL);
gint map_entries = 0;
system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
if (rastercaps & RC_PALETTE)
{
const int sizepalette = GetDeviceCaps (gdk_display_hdc, SIZEPALETTE);
const int numcolors = GetDeviceCaps (gdk_display_hdc, NUMCOLORS);
const int sizepalette = GetDeviceCaps (_gdk_display_hdc, SIZEPALETTE);
const int numcolors = GetDeviceCaps (_gdk_display_hdc, NUMCOLORS);
gchar *max_colors = getenv ("GDK_WIN32_MAX_COLORS");
system_visual->type = GDK_VISUAL_PSEUDO_COLOR;
@ -113,9 +113,9 @@ _gdk_visual_init (void)
g_assert (sizepalette == 256);
if (max_colors != NULL)
gdk_max_colors = atoi (max_colors);
_gdk_max_colors = atoi (max_colors);
map_entries = gdk_max_colors;
map_entries = _gdk_max_colors;
if (map_entries >= 16 && map_entries < sizepalette)
{
@ -179,10 +179,10 @@ _gdk_visual_init (void)
memset (&bmi, 0, sizeof (bmi));
bmi.bi.biSize = sizeof (bmi.bi);
hbm = CreateCompatibleBitmap (gdk_display_hdc, 1, 1);
GetDIBits (gdk_display_hdc, hbm, 0, 1, NULL,
hbm = CreateCompatibleBitmap (_gdk_display_hdc, 1, 1);
GetDIBits (_gdk_display_hdc, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
GetDIBits (gdk_display_hdc, hbm, 0, 1, NULL,
GetDIBits (_gdk_display_hdc, hbm, 0, 1, NULL,
(BITMAPINFO *) &bmi, DIB_RGB_COLORS);
DeleteObject (hbm);

View File

@ -35,10 +35,6 @@
#include "gdkprivate-win32.h"
#include "gdkinput-win32.h"
static gboolean gdk_window_gravity_works (void);
static void gdk_window_set_static_win_gravity (GdkWindow *window,
gboolean on);
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
GdkColormap *cmap);
@ -240,7 +236,7 @@ _gdk_windowing_window_init (void)
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
draw_impl->handle = gdk_root_window;
draw_impl->handle = _gdk_root_window;
draw_impl->wrapper = GDK_DRAWABLE (private);
draw_impl->colormap = gdk_colormap_get_system ();
gdk_colormap_ref (draw_impl->colormap);
@ -250,7 +246,22 @@ _gdk_windowing_window_init (void)
impl->width = width;
impl->height = height;
gdk_win32_handle_table_insert (&gdk_root_window, _gdk_parent_root);
_gdk_window_init_position (GDK_WINDOW (private));
gdk_win32_handle_table_insert (&_gdk_root_window, _gdk_parent_root);
}
static const gchar *
get_default_title (void)
{
const char *title;
#if 0 /* So that we can build with GLib 2.0... */
title = g_get_application_name ();
if (!title)
#endif
title = g_get_prgname ();
return title;
}
/* The Win API function AdjustWindowRect may return negative values
@ -305,20 +316,20 @@ RegisterGdkClass (GdkWindowType wtype)
wcl.lpfnWndProc = _gdk_win32_window_procedure;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = gdk_app_hmodule;
wcl.hInstance = _gdk_app_hmodule;
wcl.hIcon = 0;
/* initialize once! */
if (0 == hAppIcon)
{
gchar sLoc [MAX_PATH+1];
if (0 != GetModuleFileName (gdk_app_hmodule, sLoc, MAX_PATH))
if (0 != GetModuleFileName (_gdk_app_hmodule, sLoc, MAX_PATH))
{
hAppIcon = ExtractIcon (gdk_app_hmodule, sLoc, 0);
hAppIcon = ExtractIcon (_gdk_app_hmodule, sLoc, 0);
if (0 == hAppIcon)
{
if (0 != GetModuleFileName (gdk_dll_hinstance, sLoc, MAX_PATH))
hAppIcon = ExtractIcon (gdk_dll_hinstance, sLoc, 0);
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
hAppIcon = ExtractIcon (_gdk_dll_hinstance, sLoc, 0);
}
}
if (0 == hAppIcon)
@ -484,7 +495,7 @@ gdk_window_new (GdkWindow *parent,
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
title = g_get_prgname ();
title = get_default_title ();
if (!title || !*title)
title = "GDK client window";
@ -529,7 +540,7 @@ gdk_window_new (GdkWindow *parent,
{
case GDK_WINDOW_TOPLEVEL:
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
hparent = gdk_root_window;
hparent = _gdk_root_window;
break;
case GDK_WINDOW_CHILD:
@ -541,7 +552,7 @@ gdk_window_new (GdkWindow *parent,
#if 0
dwExStyle |= WS_EX_TOPMOST; /* //HB: want this? */
#endif
hparent = gdk_root_window;
hparent = _gdk_root_window;
break;
case GDK_WINDOW_TEMP:
@ -601,7 +612,7 @@ gdk_window_new (GdkWindow *parent,
impl->position_info.width, impl->position_info.height,
hparent,
NULL,
gdk_app_hmodule,
_gdk_app_hmodule,
NULL);
#else
{
@ -614,7 +625,7 @@ gdk_window_new (GdkWindow *parent,
impl->position_info.width, impl->position_info.height,
hparent,
NULL,
gdk_app_hmodule,
_gdk_app_hmodule,
window);
if (GDK_WINDOW_HWND (window) != hwndNew)
{
@ -703,7 +714,7 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
point.x = rect.left;
point.y = rect.right;
ClientToScreen ((HWND) anid, &point);
if (parent != gdk_root_window)
if (parent != _gdk_root_window)
ScreenToClient (parent, &point);
private->x = point.x;
private->y = point.y;
@ -718,6 +729,8 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
private->state |= GDK_WINDOW_STATE_WITHDRAWN;
private->depth = gdk_visual_get_system ()->depth;
_gdk_window_init_position (GDK_WINDOW (private));
gdk_drawable_ref (window);
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
@ -1111,11 +1124,13 @@ gdk_window_reparent (GdkWindow *window,
old_parent_private->children =
g_list_remove (old_parent_private->children, window);
#if 0
if ((old_parent_private &&
(!old_parent_private->guffaw_gravity != !parent_private->guffaw_gravity)) ||
(!old_parent_private && parent_private->guffaw_gravity))
gdk_window_set_static_win_gravity (window, parent_private->guffaw_gravity);
#endif
parent_private->children = g_list_prepend (parent_private->children, window);
_gdk_window_init_position (GDK_WINDOW (window_private));
}
@ -1546,7 +1561,7 @@ gdk_window_set_background (GdkWindow *window,
GDK_NOTE (MISC, g_print ("gdk_window_set_background: %p %s\n",
GDK_WINDOW_HWND (window),
gdk_win32_color_to_string (color)));
_gdk_win32_color_to_string (color)));
private->bg_color = *color;
@ -1705,6 +1720,26 @@ gdk_window_get_geometry (GdkWindow *window,
if (!GetClientRect (GDK_WINDOW_HWND (window), &rect))
WIN32_API_FAILED ("GetClientRect");
if (window != _gdk_parent_root)
{
POINT pt;
GdkWindow *parent = gdk_window_get_parent (window);
pt.x = rect.left;
pt.y = rect.top;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
rect.left = pt.x;
rect.top = pt.y;
pt.x = rect.right;
pt.y = rect.bottom;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
rect.right = pt.x;
rect.bottom = pt.y;
}
if (x)
*x = rect.left;
if (y)
@ -1823,7 +1858,8 @@ gdk_window_get_frame_extents (GdkWindow *window,
}
GdkWindow*
_gdk_windowing_window_get_pointer (GdkWindow *window,
_gdk_windowing_window_get_pointer (GdkDisplay *display,
GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask)
@ -1894,10 +1930,10 @@ _gdk_windowing_get_pointer (GdkDisplay *display,
GdkModifierType *mask)
{
GdkScreen *default_screen = gdk_display_get_default_screen (display);
GdkWindow *root_window = gdk_screen_get_root_window (screen);
GdkWindow *root_window = gdk_screen_get_root_window (default_screen);
*screen = default_screen;
_gdk_windowing_window_get_pointer (root_window, x, y, mask);
_gdk_windowing_window_get_pointer (display, root_window, x, y, mask);
}
GdkWindow*
@ -1998,7 +2034,7 @@ gdk_window_shape_combine_mask (GdkWindow *window,
RECT rect;
/* Convert mask bitmap to region */
hrgn = _gdk_win32_bitmap_to_region (mask);
hrgn = _gdk_win32_bitmap_to_hrgn (mask);
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %p %p\n",
GDK_WINDOW_HWND (window),
@ -2249,6 +2285,7 @@ gdk_propagate_shapes (HANDLE win,
}
}
SetWindowRgn (win, region, TRUE);
g_free (list);
}
else
DeleteObject (region);
@ -2278,91 +2315,11 @@ gdk_window_merge_child_shapes (GdkWindow *window)
gdk_propagate_shapes (GDK_WINDOW_HWND (window), TRUE);
}
/* Support for windows that can be guffaw-scrolled
* (See http://www.gtk.org/~otaylor/whitepapers/guffaw-scrolling.txt)
*/
static gboolean
gdk_window_gravity_works (void)
{
enum { UNKNOWN, NO, YES };
static gint gravity_works = UNKNOWN;
if (gravity_works == UNKNOWN)
{
GdkWindowAttr attr;
GdkWindow *parent;
GdkWindow *child;
gint y;
attr.window_type = GDK_WINDOW_TEMP;
attr.wclass = GDK_INPUT_OUTPUT;
attr.x = 0;
attr.y = 0;
attr.width = 100;
attr.height = 100;
attr.event_mask = 0;
parent = gdk_window_new (NULL, &attr, GDK_WA_X | GDK_WA_Y);
attr.window_type = GDK_WINDOW_CHILD;
child = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y);
gdk_window_set_static_win_gravity (child, TRUE);
gdk_window_resize (parent, 100, 110);
gdk_window_move (parent, 0, -10);
gdk_window_move_resize (parent, 0, 0, 100, 100);
gdk_window_resize (parent, 100, 110);
gdk_window_move (parent, 0, -10);
gdk_window_move_resize (parent, 0, 0, 100, 100);
gdk_window_get_geometry (child, NULL, &y, NULL, NULL, NULL);
gdk_window_destroy (parent);
gdk_window_destroy (child);
gravity_works = ((y == -20) ? YES : NO);
}
return (gravity_works == YES);
}
static void
gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on)
{
g_return_if_fail (window != NULL);
GDK_NOTE (MISC, g_print ("gdk_window_set_static_bit_gravity: Not implemented\n"));
}
static void
gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on)
{
g_return_if_fail (window != NULL);
GDK_NOTE (MISC, g_print ("gdk_window_set_static_win_gravity: Not implemented\n"));
}
/*************************************************************
* gdk_window_set_static_gravities:
* Set the bit gravity of the given window to static,
* and flag it so all children get static subwindow
* gravity.
* arguments:
* window: window for which to set static gravity
* use_static: Whether to turn static gravity on or off.
* results:
* Does the XServer support static gravity?
*************************************************************/
gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GList *tmp_list;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@ -2370,24 +2327,11 @@ gdk_window_set_static_gravities (GdkWindow *window,
if (!use_static == !private->guffaw_gravity)
return TRUE;
if (use_static && !gdk_window_gravity_works ())
if (use_static)
return FALSE;
private->guffaw_gravity = use_static;
if (!GDK_WINDOW_DESTROYED (window))
{
gdk_window_set_static_bit_gravity (window, use_static);
tmp_list = private->children;
while (tmp_list)
{
gdk_window_set_static_win_gravity (window, use_static);
tmp_list = tmp_list->next;
}
}
return TRUE;
}
@ -2579,7 +2523,7 @@ gdk_window_set_type_hint (GdkWindow *window,
/*
* XXX ???
*/
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint (%p)\n",
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint: %p\n",
GDK_WINDOW_HWND (window)));
}

View File

@ -19,7 +19,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "FileDescription", "GIMP Drawing Kit"
VALUE "FileVersion", "@GTK_VERSION@.BUILDNUMBER"
VALUE "InternalName", "libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2001."
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2002."
VALUE "OriginalFilename", "libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
VALUE "ProductName", "GTK+"
VALUE "ProductVersion", "@GTK_VERSION@"