Reflect recent renamings and removals of functions.

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

	* gdk/gdk.def: Reflect recent renamings and removals of functions.

	Merge from stable:

	Start implementing all fill styles (i.e. tiled, stippled, and
	opaque stippled in addition to the plain solid style) in the Win32
	backend in an elegant and generic way. For now only did the
	draw_rectangle() and draw_glyphs() methods. The rest will
	follow. Previously some of the drawing methods implemented opaque
	stippling, but not tiles or non-opaque stippling.

	Seems to work fine, now the check marks show up in check buttons,
	the stippled background and stippled text in gtk-demo's Text
	Widget look as they should, and GtkText's line wrap arrow shows
	correctly instead of an ugly rectangle. [This refers to the stable
	branch, haven't actually checked HEAD.]

	The implementation does do a lot of pixmap handling and blitting
	back and forth, especially on Win9x. But performance is hopefully
	not an issue. I don't think many applications do a lot of tiled or
	stippled drawing.

	* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
	calls a GDI function and prints a warning if it failed. Also
	API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
	WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
	GDI_CALL (BlaBla, ()). Declare new functions.

	* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.

	(generic_draw): New function that handles all the blitting
	necessary to implement tiles and stipples. A function that
	actually draws stuff is passed as a parameter to
	generic_draw(). If the fill style is solid, it is called
	directly, to draw on the destination drawable. Otherwise it is
	called to draw on a temporary mask bitmap, which then is used in
	blitting operations. The tiles and/or stipples are rendered into
	another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
	it is used, otherwise a sequence of BitBlt() is used to do the
	final composition onto the destination drawable.

	(draw_tiles_lowlevel, draw_tiles): Some renaming and code
	reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().

	(rop2_to_rop3): New function, does binary->ternary rop mapping.

	(blit_from_pixmap, blit_inside_window, blit_from_window): Use
	rop2_to_rop3(). Previously used SRCCOPY always...

	(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
	gdk_win32_draw_glyphs): Split functionality into two functions,
	with generic_draw() doing its magic inbetween.

	* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
	was ifdeffed out and wouldn't have done anything even if
	enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
	have any effect any more anyway after all the changes GTK+ has
	gone through in the last years. Remove some #if 0 code.

	* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
	to NULL in case a GC is copied while it has a Windows DC active.

	* gdk/win32/gdkprivate-win32.h
	* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.

	* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
	option. If there is a PRETEND_WIN9X envvar, set windows_version as
	if on Win9x.

	* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
	gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
	used or exported. Make a bit more like the X11 version. Hopefully
	I didn't break the fragile palettized display ("pseudocolor")
	code.

	* gdk/win32/gdkgc-win32.c: Various debugging output improvements.

	(predraw_set_foreground): Check whether
	tile/stipple origins are valid when calling SetBrushOrgEx().

	(gdk_win32_hdc_get): Ifdef out code that tries to handle the
	stipple by converting it into a region, and combining the clip
	region with that. A stipple shouldn't work like that, it should
	replicate in x and y directions. Stipples are now handled by
	generic_draw() in gdkdrawable-win32.c.

	* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
	gdk_win32_rop2_to_string): New debugging functions.

	(gdk_win32_print_dc): Print also DC's rop2 and text color.
This commit is contained in:
Tor Lillqvist 2002-11-16 01:12:10 +00:00 committed by Tor Lillqvist
parent 21636d2c76
commit fda3e29611
14 changed files with 1262 additions and 300 deletions

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -1,3 +1,96 @@
2002-11-15 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def: Reflect recent renamings and removals of functions.
Merge from stable:
Start implementing all fill styles (i.e. tiled, stippled, and
opaque stippled in addition to the plain solid style) in the Win32
backend in an elegant and generic way. For now only did the
draw_rectangle() and draw_glyphs() methods. The rest will
follow. Previously some of the drawing methods implemented opaque
stippling, but not tiles or non-opaque stippling.
Seems to work fine, now the check marks show up in check buttons,
the stippled background and stippled text in gtk-demo's Text
Widget look as they should, and GtkText's line wrap arrow shows
correctly instead of an ugly rectangle. [This refers to the stable
branch, haven't actually checked HEAD.]
The implementation does do a lot of pixmap handling and blitting
back and forth, especially on Win9x. But performance is hopefully
not an issue. I don't think many applications do a lot of tiled or
stippled drawing.
* gdk/win32/gdkprivate-win32.h: Define a new macro, GDI_CALL, that
calls a GDI function and prints a warning if it failed. Also
API_CALL for non-GDI calls. Cleans all the the if (!BlaBla())
WIN32_GDI_FAILED ("BlaBla") snippets, these can now be written
GDI_CALL (BlaBla, ()). Declare new functions.
* gdk/win32/gdkdrawable-win32.c: Use GDI_CALL macro in lots of places.
(generic_draw): New function that handles all the blitting
necessary to implement tiles and stipples. A function that
actually draws stuff is passed as a parameter to
generic_draw(). If the fill style is solid, it is called
directly, to draw on the destination drawable. Otherwise it is
called to draw on a temporary mask bitmap, which then is used in
blitting operations. The tiles and/or stipples are rendered into
another temporary pixmap. If MaskBlt() is available (on NT/2k/XP),
it is used, otherwise a sequence of BitBlt() is used to do the
final composition onto the destination drawable.
(draw_tiles_lowlevel, draw_tiles): Some renaming and code
reorg. Use BitBlt() to blit each tile, not gdk_draw_drawable().
(rop2_to_rop3): New function, does binary->ternary rop mapping.
(blit_from_pixmap, blit_inside_window, blit_from_window): Use
rop2_to_rop3(). Previously used SRCCOPY always...
(draw_rectangle, gdk_win32_draw_rectangle, draw_glyphs,
gdk_win32_draw_glyphs): Split functionality into two functions,
with generic_draw() doing its magic inbetween.
* gdk/win32/gdkevents-win32.c: Remove the TrackMouseEvent code, it
was ifdeffed out and wouldn't have done anything even if
enabled. Remove the GDK_EVENT_FUNC_FROM_WINDOW_PROC code, didn't
have any effect any more anyway after all the changes GTK+ has
gone through in the last years. Remove some #if 0 code.
* gdk/win32/gdkgc-win32.c (gdk_gc_copy): Set the copy's hdc field
to NULL in case a GC is copied while it has a Windows DC active.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: Remove gdk_event_func_from_window_proc.
* gdk/win32/gdkmain-win32.c: Remove -event-func-from-window-proc
option. If there is a PRETEND_WIN9X envvar, set windows_version as
if on Win9x.
* gdk/win32/gdkpixmap-win32.c (_gdk_win32_pixmap_new,
gdk_pixmap_new): Combine these two, _gdk_win32_pixmap_new() wasn't
used or exported. Make a bit more like the X11 version. Hopefully
I didn't break the fragile palettized display ("pseudocolor")
code.
* gdk/win32/gdkgc-win32.c: Various debugging output improvements.
(predraw_set_foreground): Check whether
tile/stipple origins are valid when calling SetBrushOrgEx().
(gdk_win32_hdc_get): Ifdef out code that tries to handle the
stipple by converting it into a region, and combining the clip
region with that. A stipple shouldn't work like that, it should
replicate in x and y directions. Stipples are now handled by
generic_draw() in gdkdrawable-win32.c.
* gdk/win32/gdkmain-win32.c: (gdk_win32_gcvalues_mask_to_string,
gdk_win32_rop2_to_string): New debugging functions.
(gdk_win32_print_dc): Print also DC's rop2 and text color.
Thu Nov 14 14:58:21 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_name):

View File

@ -38,10 +38,10 @@ EXPORTS
gdk_colors_free
gdk_colors_store
gdk_crossing_mode_get_type
gdk_cursor_get_screen
gdk_cursor_get_display
gdk_cursor_get_type
gdk_cursor_new
gdk_cursor_new_for_screen
gdk_cursor_new_for_display
gdk_cursor_new_from_pixmap
gdk_cursor_ref
gdk_cursor_type_get_type
@ -58,12 +58,14 @@ EXPORTS
gdk_device_set_source
gdk_devices_list
gdk_display_beep
gdk_display_get_default
gdk_display_get_default_screen
gdk_display_get_n_screens
gdk_display_get_screen
gdk_display_get_type
gdk_display_get_window_at_pointer
gdk_display_keyboard_ungrab
gdk_display_open
gdk_display_pointer_is_grabbed
gdk_display_pointer_ungrab
gdk_display_sync
@ -194,10 +196,7 @@ EXPORTS
gdk_gc_set_values
gdk_gc_unref
gdk_gc_values_mask_get_type
gdk_get_default_display
gdk_get_default_root_window
gdk_get_default_screen
; gdk_get_display
gdk_get_display_arg_name
gdk_get_program_class
gdk_get_show_events
@ -225,7 +224,6 @@ EXPORTS
gdk_input_remove
gdk_input_set_extension_events
gdk_input_source_get_type
gdk_input_window_destroy
gdk_join_style_get_type
gdk_keyboard_grab
gdk_keyboard_grab_info_libgtk_only
@ -251,7 +249,6 @@ EXPORTS
gdk_mbstowcs
gdk_modifier_type_get_type
gdk_notify_type_get_type
gdk_open_display
gdk_overlap_type_get_type
gdk_pango_attr_embossed_new
gdk_pango_attr_stipple_new
@ -323,6 +320,7 @@ EXPORTS
gdk_rgb_set_min_colors
gdk_rgb_set_verbose
gdk_rgb_xpixel_from_rgb
gdk_screen_get_default
gdk_screen_get_default_colormap
gdk_screen_get_display
gdk_screen_get_height

View File

@ -25,6 +25,8 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#define USE_GENERIC_DRAW
#include <math.h>
#include <stdio.h>
#include <glib.h>
@ -32,8 +34,13 @@
#include <pango/pangowin32.h>
#include "gdkscreen.h" /* gdk_screen_get_default() */
#include "gdkregion-generic.h"
#include "gdkprivate-win32.h"
#define ROP3_D 0x00AA0029
#define ROP3_DPSao 0x00EA02E9
#define ROP3_DSna 0x00220326
static void gdk_win32_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
gboolean filled,
@ -243,14 +250,10 @@ render_line_horizontal (HDC hdc,
len = x2 - x1;
if (n % 2 == 0)
if (!PatBlt (hdc,
x1, y - pen_width / 2,
len, pen_width,
PATCOPY))
{
WIN32_GDI_FAILED ("PatBlt");
return FALSE;
}
if (!GDI_CALL (PatBlt, (hdc, x1, y - pen_width / 2,
len, pen_width,
PATCOPY)))
return FALSE;
x1 += dashes[n % num_dashes];
}
@ -275,14 +278,11 @@ render_line_vertical (HDC hdc,
if (y1 + len > y2)
len = y2 - y1;
if (n % 2 == 0)
if (!PatBlt (hdc,
x - pen_width / 2, y1,
pen_width, len,
PATCOPY))
{
WIN32_GDI_FAILED ("PatBlt");
return FALSE;
}
if (!GDI_CALL (PatBlt, (hdc, x - pen_width / 2, y1,
pen_width, len,
PATCOPY)))
return FALSE;
y1 += dashes[n % num_dashes];
}
@ -290,28 +290,27 @@ render_line_vertical (HDC hdc,
}
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)
draw_tiles_lowlevel (HDC dest,
HDC tile,
int rop3,
gint dest_x,
gint dest_y,
gint tile_x_origin,
gint tile_y_origin,
gint width,
gint height,
gint tile_width,
gint tile_height)
{
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),
GDK_NOTE (MISC, g_print ("draw_tiles_lowlevel: %p +%d+%d tile=%p:%dx%d@+%d+%d %dx%d\n",
dest,
dest_x, dest_y,
_gdk_win32_drawable_description (tile),
tile, tile_width, tile_height,
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;
@ -329,11 +328,13 @@ _gdk_win32_draw_tiles (GdkDrawable *drawable,
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)));
if (!GDI_CALL (BitBlt, (dest, x + src_x, y + src_y,
MIN (tile_width, dest_x + width - (x + src_x)),
MIN (tile_height, dest_y + height - (y + src_y)),
tile,
src_x, src_y,
rop3)))
return;
}
x += tile_width;
}
@ -342,6 +343,344 @@ _gdk_win32_draw_tiles (GdkDrawable *drawable,
}
}
static void
draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
int rop3,
GdkPixmap *tile,
gint dest_x,
gint dest_y,
gint tile_x_origin,
gint tile_y_origin,
gint width,
gint height)
{
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
gint tile_width, tile_height;
GdkGC *gc_copy;
HDC dest_hdc, tile_hdc;
gc_copy = gdk_gc_new (tile);
gdk_gc_copy (gc_copy, gc);
dest_hdc = gdk_win32_hdc_get (drawable, gc, mask);
tile_hdc = gdk_win32_hdc_get (tile, gc_copy, mask);
gdk_drawable_get_size (tile, &tile_width, &tile_height);
draw_tiles_lowlevel (dest_hdc, tile_hdc, rop3,
dest_x, dest_y, tile_x_origin, tile_y_origin,
width, height, tile_width, tile_height);
gdk_win32_hdc_release (drawable, gc, mask);
gdk_win32_hdc_release (tile, gc_copy, mask);
gdk_gc_unref (gc_copy);
}
static int
rop2_to_rop3 (int rop2)
{
switch (rop2)
{
/* Oh, Microsoft's silly names for binary and ternary rops. */
#define CASE(rop2,rop3) case R2_##rop2: return rop3
CASE (BLACK, BLACKNESS);
CASE (NOTMERGEPEN, NOTSRCERASE);
CASE (MASKNOTPEN, 0x00220326);
CASE (NOTCOPYPEN, NOTSRCCOPY);
CASE (MASKPENNOT, SRCERASE);
CASE (NOT, DSTINVERT);
CASE (XORPEN, SRCINVERT);
CASE (NOTMASKPEN, 0x007700E6);
CASE (MASKPEN, SRCAND);
CASE (NOTXORPEN, 0x00990066);
CASE (NOP, 0x00AA0029);
CASE (MERGENOTPEN, MERGEPAINT);
CASE (COPYPEN, SRCCOPY);
CASE (MERGEPENNOT, 0x00DD0228);
CASE (MERGEPEN, SRCPAINT);
CASE (WHITE, WHITENESS);
#undef CASE
default: return SRCCOPY;
}
}
static void
generic_draw (GdkDrawable *drawable,
GdkGC *gc,
GdkGCValuesMask mask,
void (*function) (GdkGCWin32 *, HDC, gint, gint, va_list),
const GdkRegion *region,
...)
{
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
HDC hdc = gdk_win32_hdc_get (drawable, gc, mask);
va_list args;
va_start (args, region);
/* If tiled or stippled, draw to a temp pixmap and do blitting magic.
*/
if (gcwin32->values_mask & GDK_GC_FILL &&
((gcwin32->fill_style == GDK_TILED &&
gcwin32->values_mask & GDK_GC_TILE &&
gcwin32->tile != NULL)
||
((gcwin32->fill_style == GDK_OPAQUE_STIPPLED ||
gcwin32->fill_style == GDK_STIPPLED) &&
gcwin32->values_mask & GDK_GC_STIPPLE &&
gcwin32->stipple != NULL)))
{
gint ts_x_origin = 0, ts_y_origin = 0;
gint width = region->extents.x2 - region->extents.x1;
gint height = region->extents.y2 - region->extents.y1;
GdkPixmap *mask_pixmap =
gdk_pixmap_new (drawable, width, height, 1);
GdkPixmap *tile_pixmap =
gdk_pixmap_new (drawable, width, height, -1);
GdkPixmap *stipple_bitmap = NULL;
GdkColor fg;
GdkGC *mask_gc = gdk_gc_new (mask_pixmap);
GdkGC *tile_gc = gdk_gc_new (tile_pixmap);
HDC mask_hdc;
HDC tile_hdc = CreateCompatibleDC (hdc);
HGDIOBJ old_mask_hbm;
HGDIOBJ old_tile_hbm;
if (gcwin32->values_mask & GDK_GC_TS_X_ORIGIN)
ts_x_origin = gc->ts_x_origin;
if (gcwin32->values_mask & GDK_GC_TS_Y_ORIGIN)
ts_y_origin = gc->ts_y_origin;
ts_x_origin -= region->extents.x1;
ts_y_origin -= region->extents.y1;
/* Fill mask bitmap with zeros */
gdk_gc_set_function (mask_gc, GDK_CLEAR);
gdk_draw_rectangle (mask_pixmap, mask_gc, TRUE,
0, 0, width, height);
/* Paint into mask bitmap, drawing ones */
gdk_gc_set_function (mask_gc, GDK_COPY);
fg.pixel = 1;
gdk_gc_set_foreground (mask_gc, &fg);
mask_hdc = gdk_win32_hdc_get (mask_pixmap, mask_gc, GDK_GC_FOREGROUND);
(*function) (GDK_GC_WIN32 (mask_gc), mask_hdc,
region->extents.x1, region->extents.y1, args);
gdk_win32_hdc_release (mask_pixmap, mask_gc, GDK_GC_FOREGROUND);
if (gcwin32->fill_style == GDK_TILED)
{
/* Tile pixmap with tile */
draw_tiles (tile_pixmap, tile_gc, SRCCOPY,
gcwin32->tile,
0, 0, ts_x_origin, ts_y_origin,
width, height);
}
else
{
/* Tile with stipple */
GdkGC *stipple_gc;
stipple_bitmap = gdk_pixmap_new (NULL, width, height, 1);
stipple_gc = gdk_gc_new (stipple_bitmap);
/* Tile stipple bitmap */
draw_tiles (stipple_bitmap, stipple_gc, SRCCOPY,
gcwin32->stipple,
0, 0, ts_x_origin, ts_y_origin,
width, height);
if (gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
/* Fill tile pixmap with background */
fg.pixel = gcwin32->background;
gdk_gc_set_foreground (tile_gc, &fg);
gdk_draw_rectangle (tile_pixmap, tile_gc, TRUE,
0, 0, width, height);
}
}
gdk_gc_unref (mask_gc);
gdk_gc_unref (tile_gc);
mask_hdc = CreateCompatibleDC (hdc);
if ((old_mask_hbm = SelectObject (mask_hdc, GDK_PIXMAP_HBITMAP (mask_pixmap))) == NULL)
WIN32_GDI_FAILED ("SelectObject");
if ((old_tile_hbm = SelectObject (tile_hdc, GDK_PIXMAP_HBITMAP (tile_pixmap))) == NULL)
WIN32_GDI_FAILED ("SelectObject");
if (gcwin32->fill_style == GDK_STIPPLED ||
gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
HDC stipple_hdc = CreateCompatibleDC (hdc);
HGDIOBJ old_stipple_hbm = SelectObject (stipple_hdc, GDK_PIXMAP_HBITMAP (stipple_bitmap));
HBRUSH fg_brush = CreateSolidBrush
(_gdk_win32_colormap_color (impl->colormap, gcwin32->foreground));
HGDIOBJ old_tile_brush = SelectObject (tile_hdc, fg_brush);
/* Paint tile with foreround where stipple is one */
GDI_CALL (BitBlt, (tile_hdc, 0, 0, width, height,
stipple_hdc, 0, 0, ROP3_DPSao));
if (gcwin32->fill_style == GDK_STIPPLED)
{
/* Punch holes in mask where stipple bitmap is zero */
GDI_CALL (BitBlt, (mask_hdc, 0, 0, width, height,
stipple_hdc, 0, 0, SRCAND));
}
GDI_CALL (SelectObject, (tile_hdc, old_tile_brush));
GDI_CALL (DeleteObject, (fg_brush));
GDI_CALL (SelectObject, (stipple_hdc, old_stipple_hbm));
GDI_CALL (DeleteDC, (stipple_hdc));
gdk_drawable_unref (stipple_bitmap);
}
/* Tile pixmap now contains the pattern that we should paint in
* the areas where mask is one. (It is filled with said pattern.)
*/
if (IS_WIN_NT ())
{
GDI_CALL (MaskBlt, (hdc, region->extents.x1, region->extents.y1,
width, height,
tile_hdc, 0, 0,
GDK_PIXMAP_HBITMAP (mask_pixmap), 0, 0,
MAKEROP4 (rop2_to_rop3 (gcwin32->rop2), ROP3_D)));
}
else
{
GdkPixmap *temp1_pixmap =
gdk_pixmap_new (drawable, width, height, -1);
GdkPixmap *temp2_pixmap =
gdk_pixmap_new (drawable, width, height, -1);
HDC temp1_hdc = CreateCompatibleDC (hdc);
HDC temp2_hdc = CreateCompatibleDC (hdc);
HGDIOBJ old_temp1_hbm =
SelectObject (temp1_hdc, GDK_PIXMAP_HBITMAP (temp1_pixmap));
HGDIOBJ old_temp2_hbm =
SelectObject (temp2_hdc, GDK_PIXMAP_HBITMAP (temp2_pixmap));
/* Grab copy of dest region to temp1 */
GDI_CALL (BitBlt,(temp1_hdc, 0, 0, width, height,
hdc, region->extents.x1, region->extents.y1, SRCCOPY));
/* Paint tile to temp1 using correct function */
GDI_CALL (BitBlt, (temp1_hdc, 0, 0, width, height,
tile_hdc, 0, 0, rop2_to_rop3 (gcwin32->rop2)));
/* Mask out temp1 where function didn't paint */
GDI_CALL (BitBlt, (temp1_hdc, 0, 0, width, height,
mask_hdc, 0, 0, SRCAND));
/* Grab another copy of dest region to temp2 */
GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
hdc, region->extents.x1, region->extents.y1, SRCCOPY));
/* Mask out temp2 where function did paint */
GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
mask_hdc, 0, 0, ROP3_DSna));
/* Combine temp1 with temp2 */
GDI_CALL (BitBlt, (temp2_hdc, 0, 0, width, height,
temp1_hdc, 0, 0, SRCPAINT));
/* Blit back */
GDI_CALL (BitBlt, (hdc, region->extents.x1, region->extents.y1, width, height,
temp2_hdc, 0, 0, SRCCOPY));
/* Cleanup */
GDI_CALL (SelectObject, (temp1_hdc, old_temp1_hbm));
GDI_CALL (SelectObject, (temp2_hdc, old_temp2_hbm));
GDI_CALL (DeleteDC, (temp1_hdc));
GDI_CALL (DeleteDC, (temp2_hdc));
gdk_drawable_unref (temp1_pixmap);
gdk_drawable_unref (temp2_pixmap);
}
/* Cleanup */
GDI_CALL (SelectObject, (mask_hdc, old_mask_hbm));
GDI_CALL (SelectObject, (tile_hdc, old_tile_hbm));
GDI_CALL (DeleteDC, (mask_hdc));
GDI_CALL (DeleteDC, (tile_hdc));
gdk_drawable_unref (mask_pixmap);
gdk_drawable_unref (tile_pixmap);
}
else
(*function) (gcwin32, hdc, 0, 0, args);
va_end (args);
gdk_win32_hdc_release (drawable, gc, mask);
}
static void
draw_rectangle (GdkGCWin32 *gcwin32,
HDC hdc,
gint x_offset,
gint y_offset,
va_list args)
{
HGDIOBJ old_pen_or_brush;
gint filled;
gint x;
gint y;
gint width;
gint height;
filled = va_arg (args, gint);
x = va_arg (args, gint);
y = va_arg (args, gint);
width = va_arg (args, gint);
height = va_arg (args, gint);
x -= x_offset;
y -= y_offset;
if (!filled && gcwin32->pen_dashes && !IS_WIN_NT ())
{
render_line_vertical (hdc, x, y, y+height+1,
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes) &&
render_line_horizontal (hdc, x, x+width+1, y,
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes) &&
render_line_vertical (hdc, x+width+1, y, y+height+1,
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes) &&
render_line_horizontal (hdc, x, x+width+1, y+height+1,
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else
{
if (filled)
old_pen_or_brush = SelectObject (hdc, GetStockObject (NULL_PEN));
else
old_pen_or_brush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH));
if (old_pen_or_brush == NULL)
WIN32_GDI_FAILED ("SelectObject");
else
GDI_CALL (Rectangle, (hdc, x, y, x+width+1, y+height+1));
if (old_pen_or_brush != NULL)
GDI_CALL (SelectObject, (hdc, old_pen_or_brush));
}
}
static void
gdk_win32_draw_rectangle (GdkDrawable *drawable,
GdkGC *gc,
@ -351,7 +690,36 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
gint width,
gint height)
{
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
#ifdef USE_GENERIC_DRAW
GdkRectangle bounds;
GdkRegion *region;
gint pen_width;
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %s (%p) %s%dx%d@+%d+%d\n",
_gdk_win32_drawable_description (drawable),
gc,
(filled ? "fill " : ""),
width, height, x, y));
pen_width = GDK_GC_WIN32 (gc)->pen_width;
if (pen_width == 0)
pen_width = 1;
bounds.x = x - pen_width;
bounds.y = y - pen_width;
bounds.width = width + 2 * pen_width;
bounds.height = height + 2 * pen_width;
region = gdk_region_rectangle (&bounds);
generic_draw (drawable, gc, GDK_GC_FOREGROUND|GDK_GC_BACKGROUND,
draw_rectangle, region, filled, x, y, width, height);
gdk_region_destroy (region);
#else /* !USE_GENERIC_DRAW */
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc;
HGDIOBJ old_pen_or_brush;
@ -360,27 +728,28 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
GDK_NOTE (MISC, g_print ("gdk_win32_draw_rectangle: %s (%p) %s%dx%d@+%d+%d\n",
_gdk_win32_drawable_description (drawable),
gc_private,
gcwin32,
(filled ? "fill " : ""),
width, height, x, y));
if (filled
&& (gc_private->values_mask & GDK_GC_TILE)
&& (gc_private->tile)
&& (gc_private->values_mask & GDK_GC_FILL)
&& (gc_private->fill_style == GDK_TILED))
&& (gcwin32->values_mask & GDK_GC_TILE)
&& (gcwin32->tile)
&& (gcwin32->values_mask & GDK_GC_FILL)
&& (gcwin32->fill_style == GDK_TILED))
{
_gdk_win32_draw_tiles (drawable, gc, gc_private->tile,
x, y,
gc->ts_x_origin,
gc->ts_y_origin,
width, height);
draw_tiles (drawable, gc, SRCCOPY,
gcwin32->tile,
x, y,
gc->ts_x_origin,
gc->ts_y_origin,
width, height);
return;
}
hdc = gdk_win32_hdc_get (drawable, gc, mask);
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
if (gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
@ -419,24 +788,24 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
}
else
{
if (!filled && gc_private->pen_dashes && !IS_WIN_NT ())
if (!filled && gcwin32->pen_dashes && !IS_WIN_NT ())
{
ok = ok && render_line_vertical (hdc, x, y, y+height+1,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
ok = ok && render_line_horizontal (hdc, x, x+width+1, y,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
ok = ok && render_line_vertical (hdc, x+width+1, y, y+height+1,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
ok = ok && render_line_horizontal (hdc, x, x+width+1, y+height+1,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else
{
@ -454,6 +823,8 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
}
gdk_win32_hdc_release (drawable, gc, mask);
#endif /* !USE_GENERIC_DRAW */
}
static void
@ -535,7 +906,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc;
POINT *pts;
@ -544,7 +915,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
GDK_NOTE (MISC, g_print ("gdk_win32_draw_polygon: %s (%p) %d\n",
_gdk_win32_drawable_description (drawable),
gc_private,
gcwin32,
npoints));
if (npoints < 2)
@ -559,7 +930,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
pts[i].y = points[i].y;
}
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
if (gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
@ -764,13 +1135,13 @@ gdk_win32_draw_points (GdkDrawable *drawable,
{
HDC hdc;
COLORREF fg;
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
int i;
hdc = gdk_win32_hdc_get (drawable, gc, 0);
fg = _gdk_win32_colormap_color (impl->colormap, gc_private->foreground);
fg = _gdk_win32_colormap_color (impl->colormap, gcwin32->foreground);
GDK_NOTE (MISC, g_print ("gdk_draw_points: %s %dx%.06x\n",
_gdk_win32_drawable_description (drawable),
@ -788,7 +1159,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
GdkSegment *segs,
gint nsegs)
{
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc;
gboolean ok = TRUE;
@ -799,7 +1170,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
hdc = gdk_win32_hdc_get (drawable, gc, mask);
if (gc_private->fill_style == GDK_OPAQUE_STIPPLED)
if (gcwin32->fill_style == GDK_OPAQUE_STIPPLED)
{
if (!BeginPath (hdc))
WIN32_GDI_FAILED ("BeginPath"), ok = FALSE;
@ -812,7 +1183,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
/* Draw end pixel */
if (ok && gc_private->pen_width <= 1)
if (ok && gcwin32->pen_width <= 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
}
@ -828,7 +1199,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
}
else
{
if (gc_private->pen_dashes && !IS_WIN_NT ())
if (gcwin32->pen_dashes && !IS_WIN_NT ())
{
/* code very similar to the IMHO questionable optimization
* below. This one draws dashed vertical/horizontal lines
@ -847,9 +1218,9 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
ok = render_line_vertical (hdc,
segs[i].x1, y1, y2,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else if (segs[i].y1 == segs[i].y2)
{
@ -862,9 +1233,9 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
ok = render_line_horizontal (hdc,
x1, x2, segs[i].y1,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else
{
@ -874,7 +1245,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
/* Draw end pixel */
if (ok && gc_private->pen_width <= 1)
if (ok && gcwin32->pen_width <= 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
}
@ -883,9 +1254,9 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
else
{
const gboolean maybe_patblt =
gc_private->rop2 == R2_COPYPEN &&
gc_private->pen_width <= 1 &&
(gc_private->pen_style & PS_STYLE_MASK) == PS_SOLID;
gcwin32->rop2 == R2_COPYPEN &&
gcwin32->pen_width <= 1 &&
(gcwin32->pen_style & PS_STYLE_MASK) == PS_SOLID;
for (i = 0; ok && i < nsegs; i++)
{
@ -928,7 +1299,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
/* Draw end pixel */
if (ok && gc_private->pen_width <= 1)
if (ok && gcwin32->pen_width <= 1)
if (!LineTo (hdc, segs[i].x2 + 1, segs[i].y2))
WIN32_GDI_FAILED ("LineTo"), ok = FALSE;
}
@ -944,7 +1315,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
GdkPoint *points,
gint npoints)
{
GdkGCWin32 *gc_private = GDK_GC_WIN32 (gc);
GdkGCWin32 *gcwin32 = GDK_GC_WIN32 (gc);
const GdkGCValuesMask mask = GDK_GC_FOREGROUND|GDK_GC_BACKGROUND;
HDC hdc;
POINT *pts;
@ -956,7 +1327,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
hdc = gdk_win32_hdc_get (drawable, gc, mask);
if (gc_private->pen_dashes && !IS_WIN_NT ())
if (gcwin32->pen_dashes && !IS_WIN_NT ())
{
for (i = 0; i < npoints - 1; i++)
{
@ -969,9 +1340,9 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
y1 = points[i].y, y2 = points[i+1].y;
render_line_vertical (hdc, points[i].x, y1, y2,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else if (points[i].y == points[i+1].y)
{
@ -982,9 +1353,9 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
x1 = points[i].x, x2 = points[i+1].x;
render_line_horizontal (hdc, x1, x2, points[i].y,
gc_private->pen_width,
gc_private->pen_dashes,
gc_private->pen_num_dashes);
gcwin32->pen_width,
gcwin32->pen_dashes,
gcwin32->pen_num_dashes);
}
else
{
@ -1011,7 +1382,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
g_free (pts);
/* Draw end pixel */
if (ok && gc_private->pen_width <= 1)
if (ok && gcwin32->pen_width <= 1)
{
MoveToEx (hdc, points[npoints-1].x, points[npoints-1].y, NULL);
if (!LineTo (hdc, points[npoints-1].x + 1, points[npoints-1].y))
@ -1022,6 +1393,36 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
gdk_win32_hdc_release (drawable, gc, mask);
}
static void
draw_glyphs (GdkGCWin32 *gcwin32,
HDC hdc,
gint x_offset,
gint y_offset,
va_list args)
{
PangoFont *font;
gint x;
gint y;
PangoGlyphString *glyphs;
font = va_arg (args, PangoFont *);
x = va_arg (args, gint);
y = va_arg (args, gint);
glyphs = va_arg (args, PangoGlyphString *);
x -= x_offset;
y -= y_offset;
/* HB: Maybe there should be a GDK_GC_PANGO flag for hdc_get */
/* default write mode is transparent (leave background) */
GDI_CALL (SetBkMode, (hdc, TRANSPARENT));
if (GDI_ERROR == SetTextAlign (hdc, TA_LEFT|TA_BASELINE|TA_NOUPDATECP))
WIN32_GDI_FAILED ("SetTextAlign");
pango_win32_render (hdc, font, glyphs, x, y);
}
static void
gdk_win32_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
@ -1030,6 +1431,27 @@ gdk_win32_draw_glyphs (GdkDrawable *drawable,
gint y,
PangoGlyphString *glyphs)
{
#ifdef USE_GENERIC_DRAW
GdkRectangle bounds;
GdkRegion *region;
PangoRectangle ink_rect;
pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
bounds.x = x + PANGO_PIXELS (ink_rect.x) - 1;
bounds.y = y + PANGO_PIXELS (ink_rect.y) - 1;
bounds.width = PANGO_PIXELS (ink_rect.width) + 2;
bounds.height = PANGO_PIXELS (ink_rect.height) + 2;
region = gdk_region_rectangle (&bounds);
generic_draw (drawable, gc, GDK_GC_FOREGROUND,
draw_glyphs, region, font, x, y, glyphs);
gdk_region_destroy (region);
#else
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
HDC hdc;
@ -1046,6 +1468,8 @@ gdk_win32_draw_glyphs (GdkDrawable *drawable,
pango_win32_render (hdc, font, glyphs, x, y);
gdk_win32_hdc_release (drawable, gc, mask);
#endif
}
static void
@ -1113,9 +1537,9 @@ blit_from_pixmap (gboolean use_fg_bg,
* case of gdk_image_put(), cf. XPutImage()), or 0
* and 1 to index the palette.
*/
if (!GetDIBColorTable (hdc, bgix, 1, newtable) ||
!GetDIBColorTable (hdc, fgix, 1, newtable+1))
WIN32_GDI_FAILED ("GetDIBColorTable"), ok = FALSE;
if (!GDI_CALL (GetDIBColorTable, (hdc, bgix, 1, newtable)) ||
!GDI_CALL (GetDIBColorTable, (hdc, fgix, 1, newtable+1)))
ok = FALSE;
}
else
{
@ -1160,14 +1584,14 @@ blit_from_pixmap (gboolean use_fg_bg,
g_print ("blit_from_pixmap: set color table"
" hdc=%p count=%d\n",
srcdc, newtable_size));
if (!SetDIBColorTable (srcdc, 0, newtable_size, newtable))
WIN32_GDI_FAILED ("SetDIBColorTable"), ok = FALSE;
if (!GDI_CALL (SetDIBColorTable, (srcdc, 0, newtable_size, newtable)))
ok = FALSE;
}
}
if (ok && !BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
if (ok)
GDI_CALL (BitBlt, (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, rop2_to_rop3 (gcwin32->rop2)));
/* Restore source's color table if necessary */
if (ok && newtable_size > 0 && oldtable_size > 0)
@ -1176,37 +1600,34 @@ blit_from_pixmap (gboolean use_fg_bg,
g_print ("blit_from_pixmap: reset color table"
" hdc=%p count=%d\n",
srcdc, oldtable_size));
if (!SetDIBColorTable (srcdc, 0, oldtable_size, oldtable))
WIN32_GDI_FAILED ("SetDIBColorTable");
GDI_CALL (SetDIBColorTable, (srcdc, 0, oldtable_size, oldtable));
}
if (!SelectObject (srcdc, holdbitmap))
WIN32_GDI_FAILED ("SelectObject");
GDI_CALL (SelectObject, (srcdc, holdbitmap));
}
if (!DeleteDC (srcdc))
WIN32_GDI_FAILED ("DeleteDC");
GDI_CALL (DeleteDC, (srcdc));
}
static void
blit_inside_window (GdkDrawableImplWin32 *window,
HDC hdc,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
blit_inside_window (HDC hdc,
GdkGCWin32 *gcwin32,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
GDK_NOTE (MISC, g_print ("blit_inside_window\n"));
if (!BitBlt (hdc, xdest, ydest, width, height,
hdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
GDI_CALL (BitBlt, (hdc, xdest, ydest, width, height,
hdc, xsrc, ysrc, rop2_to_rop3 (gcwin32->rop2)));
}
static void
blit_from_window (HDC hdc,
GdkGCWin32 *gcwin32,
GdkDrawableImplWin32 *src,
gint xsrc,
gint ysrc,
@ -1241,15 +1662,13 @@ blit_from_window (HDC hdc,
g_print ("blit_from_window: realized %d\n", k));
}
if (!BitBlt (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, SRCCOPY))
WIN32_GDI_FAILED ("BitBlt");
GDI_CALL (BitBlt, (hdc, xdest, ydest, width, height,
srcdc, xsrc, ysrc, rop2_to_rop3 (gcwin32->rop2)));
if (holdpal != NULL)
SelectPalette (srcdc, holdpal, FALSE);
GDI_CALL (SelectPalette, (srcdc, holdpal, FALSE));
if (!ReleaseDC (src->handle, srcdc))
WIN32_GDI_FAILED ("ReleaseDC");
GDI_CALL (ReleaseDC, (src->handle, srcdc));
}
void
@ -1327,7 +1746,7 @@ _gdk_win32_blit (gboolean use_fg_bg,
r.left, r.top)));
InvalidateRgn (draw_impl->handle, outside_rgn, TRUE);
}
DeleteObject (outside_rgn);
GDI_CALL (DeleteObject, (outside_rgn));
}
#if 1 /* Don't know if this is necessary XXX */
@ -1352,8 +1771,8 @@ _gdk_win32_blit (gboolean use_fg_bg,
}
#endif
DeleteObject (src_rgn);
DeleteObject (draw_rgn);
GDI_CALL (DeleteObject, (src_rgn));
GDI_CALL (DeleteObject, (draw_rgn));
}
if (GDK_IS_PIXMAP_IMPL_WIN32 (src_impl))
@ -1361,9 +1780,9 @@ _gdk_win32_blit (gboolean use_fg_bg,
(GdkPixmapImplWin32 *) src_impl, GDK_GC_WIN32 (gc),
xsrc, ysrc, xdest, ydest, width, height);
else if (draw_impl->handle == src_impl->handle)
blit_inside_window (src_impl, hdc, xsrc, ysrc, xdest, ydest, width, height);
blit_inside_window (hdc, GDK_GC_WIN32 (gc), xsrc, ysrc, xdest, ydest, width, height);
else
blit_from_window (hdc, src_impl, xsrc, ysrc, xdest, ydest, width, height);
blit_from_window (hdc, GDK_GC_WIN32 (gc), src_impl, xsrc, ysrc, xdest, ydest, width, height);
gdk_win32_hdc_release ((GdkDrawable *) drawable, gc, GDK_GC_FOREGROUND);
}

View File

@ -32,7 +32,6 @@
* GDK_LEAVE_NOTIFY events, which would help get rid of those pesky
* tooltips sometimes popping up in the wrong place.
*/
/* define USE_TRACKMOUSEEVENT */
/* Do use SetCapture, it works now. Thanks to jpe@archaeopteryx.com */
#define USE_SETCAPTURE 1
@ -130,9 +129,6 @@ static IActiveIMMApp *active_imm_app = NULL;
static IActiveIMMMessagePumpOwner *active_imm_msgpump_owner = NULL;
#endif
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
static PFN_TrackMouseEvent track_mouse_event = NULL;
static gboolean use_ime_composition = FALSE;
static HKL latin_locale = NULL;
@ -182,32 +178,14 @@ real_window_procedure (HWND hwnd,
{
((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
* don't want it as default. Set the
* GDK_EVENT_FUNC_FROM_WINDOW_PROC env var to get this
* behaviour.
*/
if (_gdk_event_func_from_window_proc && _gdk_event_func)
{
GDK_THREADS_ENTER ();
(*_gdk_event_func) (event, _gdk_event_data);
gdk_event_free (event);
GDK_THREADS_LEAVE ();
}
else
{
_gdk_event_queue_append (display, event);
_gdk_event_queue_append (display, event);
if (event->type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
if (event->type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
#if 1
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
#endif
}
if (ret_val_flag)
return ret_val;
@ -258,10 +236,6 @@ _gdk_events_init (void)
GSource *source;
#ifdef HAVE_DIMM_H
HRESULT hres;
#endif
#ifdef USE_TRACKMOUSEEVENT
HMODULE user32, imm32;
HINSTANCE commctrl32;
#endif
int i, j, n;
@ -387,17 +361,6 @@ _gdk_events_init (void)
}
#endif
#ifdef USE_TRACKMOUSEEVENT
user32 = GetModuleHandle ("user32.dll");
if ((track_mouse_event = GetProcAddress (user32, "TrackMouseEvent")) == NULL)
{
if ((commctrl32 = LoadLibrary ("commctrl32.dll")) != NULL)
track_mouse_event = (PFN_TrackMouseEvent)
GetProcAddress (commctrl32, "_TrackMouseEvent");
}
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)
{
/* On Win2k (Beta 3, at least) WM_IME_CHAR doesn't seem to work
@ -461,10 +424,6 @@ gdk_event_get_graphics_expose (GdkWindow *window)
GDK_NOTE (EVENTS, g_print ("gdk_event_get_graphics_expose\n"));
#if 0 /* ??? */
/* Some nasty bugs here, just return NULL for now. */
return NULL;
#else
if (PeekMessage (&msg, GDK_WINDOW_HWND (window), WM_PAINT, WM_PAINT, PM_REMOVE))
{
event = gdk_event_new (GDK_NOTHING);
@ -481,7 +440,6 @@ gdk_event_get_graphics_expose (GdkWindow *window)
GDK_NOTE (EVENTS, g_print ("gdk_event_get_graphics_expose: nope\n"));
return NULL;
#endif
}
static char *
@ -2704,8 +2662,7 @@ gdk_event_translate (GdkDisplay *display,
g_print ("WM_NCMOUSEMOVE: %p x,y: %d %d\n",
msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (track_mouse_event == NULL
&& current_window != NULL
if (current_window != NULL
&& (GDK_WINDOW_OBJECT (current_window)->event_mask & GDK_LEAVE_NOTIFY_MASK))
{
GDK_NOTE (EVENTS, g_print ("...synthesizing LEAVE_NOTIFY event\n"));
@ -2793,45 +2750,6 @@ gdk_event_translate (GdkDisplay *display,
break;
#ifdef USE_TRACKMOUSEEVENT
case WM_MOUSELEAVE:
GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %p\n", msg->hwnd));
if (!(private->event_mask & GDK_LEAVE_NOTIFY_MASK))
break;
event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = window;
event->crossing.subwindow = NULL;
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;
event->crossing.x_root = current_x_root;
event->crossing.y_root = current_y_root;
event->crossing.mode = GDK_CROSSING_NORMAL;
if (current_window
&& IsChild (GDK_WINDOW_HWND (current_window), GDK_WINDOW_HWND (window)))
event->crossing.detail = GDK_NOTIFY_INFERIOR;
else if (current_window
&& IsChild (GDK_WINDOW_HWND (window), GDK_WINDOW_HWND (current_window)))
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
else
event->crossing.detail = GDK_NOTIFY_NONLINEAR;
event->crossing.focus = TRUE; /* ??? */
event->crossing.state = 0; /* ??? */
if (current_window)
{
gdk_drawable_unref (current_window);
current_window = NULL;
}
return_val = !GDK_WINDOW_DESTROYED (window);
break;
#endif
case WM_QUERYNEWPALETTE:
GDK_NOTE (EVENTS_OR_COLORMAP, g_print ("WM_QUERYNEWPALETTE: %p\n",
msg->hwnd));

View File

@ -193,7 +193,8 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
{
win32_gc->fill_style = values->fill;
win32_gc->values_mask |= GDK_GC_FILL;
GDK_NOTE (GC, (g_print ("%sfill=%d", s, win32_gc->fill_style),
GDK_NOTE (GC, (g_print ("%sfill=%s", s,
_gdk_win32_fill_style_to_string (win32_gc->fill_style)),
s = ","));
}
@ -419,7 +420,7 @@ gdk_win32_gc_values_to_win32values (GdkGCValues *values,
s = ","));
win32_gc->values_mask |= GDK_GC_JOIN_STYLE;
}
GDK_NOTE (GC, g_print ("}\n"));
GDK_NOTE (GC, g_print ("} mask=(%s)", _gdk_win32_gcvalues_mask_to_string (win32_gc->values_mask)));
}
GdkGC*
@ -457,14 +458,13 @@ _gdk_win32_gc_new (GdkDrawable *drawable,
win32_gc->values_mask = GDK_GC_FUNCTION | GDK_GC_FILL;
GDK_NOTE (GC, g_print ("_gdk_win32_gc_new: "));
GDK_NOTE (GC, g_print ("_gdk_win32_gc_new: %p: ", win32_gc));
gdk_win32_gc_values_to_win32values (values, mask, win32_gc);
GDK_NOTE (GC, g_print ("\n"));
win32_gc->hdc = NULL;
win32_gc->hwnd = NULL;
GDK_NOTE (GC, g_print (" = %p\n", gc));
return gc;
}
@ -561,9 +561,9 @@ gdk_win32_gc_set_values (GdkGC *gc,
{
g_return_if_fail (GDK_IS_GC (gc));
GDK_NOTE (GC, g_print ("gdk_win32_gc_set_values: "));
GDK_NOTE (GC, g_print ("gdk_win32_gc_set_values: %p: ", GDK_GC_WIN32 (gc)));
gdk_win32_gc_values_to_win32values (values, mask, GDK_GC_WIN32 (gc));
GDK_NOTE (GC, g_print ("\n"));
}
static void
@ -607,7 +607,8 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
if (rectangle)
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_rectangle: %s\n",
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_rectangle: %p: %s\n",
win32_gc,
_gdk_win32_gdkrectangle_to_string (rectangle)));
win32_gc->hcliprgn = CreateRectRgn (rectangle->x, rectangle->y,
rectangle->x + rectangle->width,
@ -643,7 +644,8 @@ gdk_gc_set_clip_region (GdkGC *gc,
if (region)
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: %s\n",
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: %p: %s\n",
win32_gc,
_gdk_win32_gdkregion_to_string (region)));
win32_gc->hcliprgn = _gdk_win32_gdkregion_to_hrgn (region, 0, 0);
@ -676,6 +678,8 @@ gdk_gc_copy (GdkGC *dst_gc,
dst_win32_gc = GDK_GC_WIN32 (dst_gc);
src_win32_gc = GDK_GC_WIN32 (src_gc);
GDK_NOTE (GC, g_print ("gdk_gc_copy: %p := %p\n", dst_win32_gc, src_win32_gc));
if (dst_gc->colormap)
g_object_unref (G_OBJECT (dst_gc->colormap));
@ -695,6 +699,7 @@ gdk_gc_copy (GdkGC *dst_gc,
g_free (dst_win32_gc->pen_dashes);
*dst_win32_gc = *src_win32_gc;
dst_win32_gc->hdc = NULL;
if (dst_gc->colormap)
g_object_ref (G_OBJECT (dst_gc->colormap));
@ -836,8 +841,11 @@ predraw_set_foreground (GdkGC *gc,
case GDK_OPAQUE_STIPPLED:
if (*ok && (hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (win32_gc->stipple))) == NULL)
WIN32_GDI_FAILED ("CreatePatternBrush"), *ok = FALSE;
if (*ok && !SetBrushOrgEx(win32_gc->hdc, gc->ts_x_origin,
gc->ts_y_origin, NULL))
if (*ok && win32_gc->values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN) &&
!SetBrushOrgEx(win32_gc->hdc,
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,
NULL))
WIN32_GDI_FAILED ("SetBrushOrgEx"), *ok = FALSE;
break;
@ -848,6 +856,7 @@ predraw_set_foreground (GdkGC *gc,
WIN32_GDI_FAILED ("CreateSolidBrush"), *ok = FALSE;
break;
}
if (*ok)
{
HBRUSH old_hbr = SelectObject (win32_gc->hdc, hbr);
@ -945,6 +954,10 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
if (SelectClipRgn (win32_gc->hdc, win32_gc->hcliprgn) == ERROR)
WIN32_API_FAILED ("SelectClipRgn"), ok = FALSE;
#if 0 /* No, this is totally bogus. The stipple should replicate in x
* and y directions, not be just one copy of the bitmap. We must
* handle stipples elsewhere.
*/
/* Combine the fillmode-stipple with the clip region */
if (ok &&
(win32_gc->values_mask & GDK_GC_STIPPLE) &&
@ -966,6 +979,7 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
if (hstipplergn != NULL && !DeleteObject (hstipplergn))
WIN32_API_FAILED ("DeleteObject");
}
#endif
if (ok && win32_gc->values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN) &&
OffsetClipRgn (win32_gc->hdc,
@ -974,7 +988,8 @@ gdk_win32_hdc_get (GdkDrawable *drawable,
WIN32_API_FAILED ("OffsetClipRgn"), ok = FALSE;
}
GDK_NOTE (GC, (g_print ("gdk_win32_hdc_get: "),
GDK_NOTE (GC, (g_print ("gdk_win32_hdc_get: %p (%s): ",
win32_gc, _gdk_win32_gcvalues_mask_to_string (usage)),
_gdk_win32_print_dc (win32_gc->hdc)));
return win32_gc->hdc;
@ -990,7 +1005,9 @@ gdk_win32_hdc_release (GdkDrawable *drawable,
HGDIOBJ hpen = NULL;
HGDIOBJ hbr = NULL;
GDK_NOTE (GC, g_print ("gdk_win32_hdc_release: %p\n", win32_gc->hdc));
GDK_NOTE (GC, g_print ("gdk_win32_hdc_release: %p: %p (%s)\n",
win32_gc, win32_gc->hdc,
_gdk_win32_gcvalues_mask_to_string (usage)));
if (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable))
impl = GDK_DRAWABLE_IMPL_WIN32(drawable);

View File

@ -52,5 +52,4 @@ GdkAtom _gdk_selection_property;
DWORD _windows_version;
gint _gdk_input_ignore_wintab = FALSE;
gint _gdk_event_func_from_window_proc = FALSE;
gint _gdk_max_colors = 0;

View File

@ -58,9 +58,6 @@ GdkArgDesc _gdk_windowing_args[] = {
(GdkArgFunc) NULL},
{ "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,
(GdkArgFunc) NULL},
{ "max-colors", GDK_ARG_INT, &_gdk_max_colors, (GdkArgFunc) NULL},
{ NULL }
};
@ -85,8 +82,6 @@ _gdk_windowing_init (gint *argc,
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
_gdk_input_ignore_wintab = TRUE;
#endif
if (getenv ("GDK_EVENT_FUNC_FROM_WINDOW_PROC") != NULL)
_gdk_event_func_from_window_proc = TRUE;
if (gdk_synchronize)
GdiSetBatchLimit (1);
@ -96,12 +91,17 @@ _gdk_windowing_init (gint *argc,
_gdk_root_window = GetDesktopWindow ();
_windows_version = GetVersion ();
if (getenv ("PRETEND_WIN9X"))
_windows_version = 0x80000004;
GDK_NOTE (MISC, g_print ("Windows version: %08x\n", (guint) _windows_version));
_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 (EVENTS, g_print ("input_locale: %p, codepage:%d\n",
GDK_NOTE (EVENTS, g_print ("input_locale:%p, codepage:%d\n",
_gdk_input_locale, _gdk_input_codepage));
CoInitialize (NULL);
@ -357,18 +357,21 @@ _gdk_win32_print_dc (HDC hdc)
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",
g_print ("brush: %s color=%06lx hatch=%p\n",
_gdk_win32_lbstyle_to_string (logbrush.lbStyle),
logbrush.lbColor, logbrush.lbHatch);
logbrush.lbColor, (gpointer) 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",
g_print ("pen: %s %s %s %s w=%d %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));
g_print ("rop2: %s textcolor=%06lx\n",
_gdk_win32_rop2_to_string (GetROP2 (hdc)),
GetTextColor (hdc));
hrgn = CreateRectRgn (0, 0, 0, 0);
if ((flag = GetClipRgn (hdc, hrgn)) == -1)
WIN32_API_FAILED ("GetClipRgn");
@ -377,11 +380,8 @@ _gdk_win32_print_dc (HDC hdc)
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);
g_print ("clip region: %p bbox: %s\n",
hrgn, _gdk_win32_rect_to_string (&rect));
}
DeleteObject (hrgn);
}
@ -480,6 +480,69 @@ _gdk_win32_line_style_to_string (GdkLineStyle line_style)
return NULL;
}
gchar *
_gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask)
{
gchar buf[400];
gchar *bufp = buf;
gchar *s = "";
#define BIT(x) \
if (mask & GDK_GC_##x) \
(bufp += sprintf (bufp, "%s" #x, s), s = "|")
BIT (FOREGROUND);
BIT (BACKGROUND);
BIT (FONT);
BIT (FUNCTION);
BIT (FILL);
BIT (TILE);
BIT (STIPPLE);
BIT (CLIP_MASK);
BIT (SUBWINDOW);
BIT (TS_X_ORIGIN);
BIT (TS_Y_ORIGIN);
BIT (CLIP_X_ORIGIN);
BIT (CLIP_Y_ORIGIN);
BIT (EXPOSURES);
BIT (LINE_WIDTH);
BIT (LINE_STYLE);
BIT (CAP_STYLE);
BIT (JOIN_STYLE);
#undef BIT
return static_printf ("%s", buf);
}
gchar *
_gdk_win32_rop2_to_string (int rop2)
{
switch (rop2)
{
#define CASE(x) case R2_##x: return #x
CASE (BLACK);
CASE (COPYPEN);
CASE (MASKNOTPEN);
CASE (MASKPEN);
CASE (MASKPENNOT);
CASE (MERGENOTPEN);
CASE (MERGEPEN);
CASE (MERGEPENNOT);
CASE (NOP);
CASE (NOT);
CASE (NOTCOPYPEN);
CASE (NOTMASKPEN);
CASE (NOTMERGEPEN);
CASE (NOTXORPEN);
CASE (WHITE);
CASE (XORPEN);
#undef CASE
default: return static_printf ("illegal_%x", rop2);
}
/* NOTREACHED */
return NULL;
}
gchar *
_gdk_win32_lbstyle_to_string (UINT brush_style)
{

View File

@ -129,11 +129,10 @@ gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable,
}
GdkPixmap*
_gdk_win32_pixmap_new (GdkWindow *window,
GdkVisual *visual,
gint width,
gint height,
gint depth)
gdk_pixmap_new (GdkWindow *window,
gint width,
gint height,
gint depth)
{
struct {
BITMAPINFOHEADER bmiHeader;
@ -145,38 +144,33 @@ _gdk_win32_pixmap_new (GdkWindow *window,
} bmi;
UINT iUsage;
HDC hdc;
HWND hwnd;
HPALETTE holdpal = NULL;
HBITMAP hbitmap;
GdkPixmap *pixmap;
GdkDrawableImplWin32 *drawable_impl;
GdkPixmapImplWin32 *pixmap_impl;
GdkColormap *cmap;
guchar *bits;
gint i;
gint window_depth;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (window == NULL || GDK_IS_DRAWABLE (window), NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = _gdk_parent_root;
if (GDK_WINDOW_DESTROYED (window))
if (GDK_IS_WINDOW (window) && GDK_WINDOW_DESTROYED (window))
return NULL;
if (!visual)
{
if (window)
visual = gdk_drawable_get_visual (window);
else
visual = gdk_visual_get_system ();
}
window_depth = gdk_drawable_get_depth (GDK_DRAWABLE (window));
if (depth == -1)
depth = visual->depth;
depth = window_depth;
GDK_NOTE (PIXMAP, g_print ("_gdk_win32_pixmap_new: %dx%dx%d "
"window=%p visual=%p\n",
width, height, depth, window, visual));
GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_new: %dx%dx%d window=%p\n",
width, height, depth, window));
pixmap = g_object_new (gdk_pixmap_get_type (), NULL);
drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
@ -188,7 +182,18 @@ _gdk_win32_pixmap_new (GdkWindow *window,
pixmap_impl->height = height;
GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
if ((hdc = GetDC (GDK_WINDOW_HWND (window))) == NULL)
if (depth == window_depth)
{
cmap = gdk_drawable_get_colormap (window);
if (cmap)
gdk_drawable_set_colormap (pixmap, cmap);
}
if (GDK_IS_WINDOW (window))
hwnd = GDK_WINDOW_HWND (window);
else
hwnd = GDK_WINDOW_HWND (_gdk_parent_root);
if ((hdc = GetDC (hwnd)) == NULL)
{
WIN32_GDI_FAILED ("GetDC");
g_object_unref ((GObject *) pixmap);
@ -251,21 +256,10 @@ _gdk_win32_pixmap_new (GdkWindow *window,
bmi.u.bmiColors[1].rgbGreen =
bmi.u.bmiColors[1].rgbRed = 0xFF;
bmi.u.bmiColors[1].rgbReserved = 0x00;
drawable_impl->colormap = NULL;
}
else
{
if (depth > 8 && depth != visual->depth)
g_warning ("_gdk_win32_pixmap_new: depth %d doesn't match display depth %d",
depth, visual->depth);
drawable_impl->colormap = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap;
if (drawable_impl->colormap == NULL)
drawable_impl->colormap = gdk_colormap_get_system ();
gdk_colormap_ref (drawable_impl->colormap);
if (depth <= 8)
if (depth <= 8 && drawable_impl->colormap != NULL)
{
GdkColormapPrivateWin32 *cmapp =
GDK_WIN32_COLORMAP_DATA (drawable_impl->colormap);
@ -285,6 +279,8 @@ _gdk_win32_pixmap_new (GdkWindow *window,
}
else if (bmi.bmiHeader.biBitCount == 16)
{
GdkVisual *visual = gdk_visual_get_system ();
bmi.u.bmiMasks[0] = visual->red_mask;
bmi.u.bmiMasks[1] = visual->green_mask;
bmi.u.bmiMasks[2] = visual->blue_mask;
@ -296,15 +292,14 @@ _gdk_win32_pixmap_new (GdkWindow *window,
if (holdpal != NULL)
SelectPalette (hdc, holdpal, FALSE);
if (!ReleaseDC (GDK_WINDOW_HWND (window), hdc))
if (!ReleaseDC (hwnd, hdc))
WIN32_GDI_FAILED ("ReleaseDC");
GDK_NOTE (PIXMAP, g_print ("...=%p bits=%p\n", hbitmap, bits));
GDK_NOTE (PIXMAP, g_print ("...=%p bits=%p pixmap=%p\n", hbitmap, bits, pixmap));
if (hbitmap == NULL)
{
WIN32_GDI_FAILED ("CreateDIBSection");
ReleaseDC (GDK_WINDOW_HWND (window), hdc);
g_object_unref ((GObject *) pixmap);
return NULL;
}
@ -319,15 +314,6 @@ _gdk_win32_pixmap_new (GdkWindow *window,
return pixmap;
}
GdkPixmap*
gdk_pixmap_new (GdkWindow *window,
gint width,
gint height,
gint depth)
{
return _gdk_win32_pixmap_new (window, NULL, width, height, depth);
}
static unsigned char mirror[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,

View File

@ -337,12 +337,6 @@ GdkImage *_gdk_win32_copy_to_image (GdkDrawable *drawable,
gint width,
gint height);
GdkPixmap *_gdk_win32_pixmap_new (GdkWindow *window,
GdkVisual *visual,
gint width,
gint height,
gint depth);
GdkImage *_gdk_win32_setup_pixmap_image (GdkPixmap *pixmap,
GdkWindow *window,
gint width,
@ -410,8 +404,10 @@ 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_gcvalues_mask_to_string (GdkGCValuesMask mask);
gchar *_gdk_win32_drawable_description (GdkDrawable *d);
gchar *_gdk_win32_rop2_to_string (int rop2);
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);
@ -446,6 +442,15 @@ void _gdk_win32_gdi_failed (const gchar *where,
#define OTHER_API_FAILED(api) _gdk_other_api_failed (__FILE__, __LINE__, api)
#endif
/* These two macros call a GDI or other Win32 API and if the return
* value is zero or NULL, print a warning message. The majority of GDI
* calls return zero or NULL on failure. The value of the macros is nonzero
* if the call succeeded, zero otherwise.
*/
#define GDI_CALL(api, arglist) (api arglist ? 1 : (WIN32_GDI_FAILED (#api), 0))
#define API_CALL(api, arglist) (api arglist ? 1 : (WIN32_API_FAILED (#api), 0))
extern LRESULT CALLBACK _gdk_win32_window_procedure (HWND, UINT, WPARAM, LPARAM);
extern HWND _gdk_root_window;
@ -484,7 +489,6 @@ extern DWORD _windows_version;
/* Options */
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)