gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and

2003-07-25  Tor Lillqvist  <tml@iki.fi>

	* gdk/win32/gdkprivate-win32.h
	* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
	and _gdk_keyboard_has_altgr.

	* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
	ones detailled here.

	Code that has been ifdeffed out for a long time removed. Remove
	some really old doc comments that were left behind for some public
	functions, the official ones are in the X11 backend anyway. Change
	GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
	multi-line boolean expressions to have the operators at ends of
	lines.

	As mouse capture with SetCapture() indeed seems to work OK, no
	need to have the correspoinding macro USE_SETCAPTURE and ifdefs.

	Ifdef out the gdk-ping-msg stuff. I don't remember why it was
	needed at some time, and things seem to work fine now without
	(knock on wood).

	Ifdef out the search for some Latin locale keyboard layout being
	loaded. Not used currently, but might be needed after all, if we
	decide that we want to be able to generate ASCII control character
	events with a non-Latin keyboard.

	(assign_object): New helper function, handles the g_object_ref()
	and unref() calls when assigning GObject pointers.

	(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
	enter event when the pointer has moved to an ancestor window. Was
	left out by mistake.

	(gdk_window_is_ancestor): Renamed from gdk_window_is_child().

	(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
	functionality, using ClipCursor().

	(find_window_for_mouse_event): Splice part of code into new
	function find_real_window_for_grabbed_mouse_event().

	(fixup_event, append_event, apply_filters): New functions, code
	refactored out from elsewhere.

	(synthesize_enter_or_leave_event, synthesize_leave_event,
	synthesize_enter_event,
	synthesize_leave_events,synthesize_enter_events): Also take a
	GdkCrossingMode parameter, in preparation to generating
	GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.

	(fixup_event, append_event, fill_key_event_string): New functions,
	code refactoring.

	(vk_from_char, build_keypress_event, build_keyrelease_event):
	Removed as part of dropping WM_CHAR handling.

	(build_key_event_state,gdk_event_translate): Call
	GetKeyboardState(), once, for each keyboard message, instead of
	several calls to GetKeyState() here and there.

	(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
	at it, do some major refactoring, and some fixes for potential
	problems noticed while going through the code.

	Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
	WM_KEYUP. Don't need the state variables related to whether to
	wait for WM_CHAR or not, and whether the current key is
	AltGr. Remove lots of complexity. Thus don't need the
	use_ime_composition flag.

	Not handling WM_CHAR means dead key handling will have to be taken
	care of by GTK, but that seems to work fine, so no worry.

	Another side-effect is that Alt+keypad digits don't work any
	longer, but it's better to learn to use GTK's ISO14755 support is
	anyway.

	Be more careful in checking whether AltGr is involved. Only
	attempt to handle it if the keyboard actually has it. And
	explicitly check for *left* Control plus *right* Alt being
	pressed. Still, allow (left) Alt and/or (right) Control with AltGr
	chars.

	Handle keys using similar code as in the X11 backend. As we have
	built a keymap in gdkkeys-win32.c anyway, use it by calling
	gdk_keymap_translate_keyboard_state() to look up the keysym from
	the virtual key code and keyboard state. Build the key event
	string in exactly the same way as the X11 backend.

	If an IME is being used, don't generate GDK events for keys
	between receiving WM_IME_STARTCOMPOSITION and
	WM_IME_ENDCOMPOSITION, as those keys are for the IME.

	For WM_IME_COMPOSITION, handle all the Unicode chars returned from
	the IME, not just the first one.

	gdk_event_translate() is still quite complex, could split the
	message handler cases out into separate functions.

	On mouse events, when the mouse is grabbed, use
	find_real_window_for_grabbed_mouse_event() in order to be able to
	generate correct crossing events.

	No longer take a pre-allocated GdkEvent as parameter. Instead,
	allocate events as needed and append them to the queue. (This is
	different from how gdk_event_translate() in the X11 backend
	works.) This change made the code much clearer, especially in the
	cases where we have to generate several GDK events for one Windows
	message.  Return FALSE if DefWindowProc() should be called, TRUE
	if not. If DefWindowProc() should not be called, also return the
	value to be returned from the window procedure.

	(Previously, the interaction with gdk_event_translate()'s caller
	was much more complex, when we had to indicate whether the
	already-queued event should be left in the queue or removed, and
	in addition also had to indicate whether to call DefWindowProc()
	or not, and what value to return from the window procedure if
	not.)

	Don't use a separate "private" variable required to be pointing to
	the GdkWindowObject of the "window" variable at all times. Just
	use casts, even if looks a bit uglier.

	Notice destroyed windows as early as possible, and break out of
	the messsage switch.

	Use _gdk_pointer_root as current_window when the pointer is
	outside GDK's top-level windows.

	On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
	appropriate, based on ImmIsIME().

	(gdk_event_translate, gdk_event_send_client_message_for_display,
	gdk_screen_broadcast_client_message): Implement client messages.
	Use a registered Windows message to pass GDK client messages. Note
	that the amount of user data is restricted to four bytes, as it is
	carried in the LPARAM. (The WPARAM is used for the message type
	"atom".)

	(real_window_procedure): Adapt for new gdk_event_translate()
	interface.

	* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
	_gdk_input_locale_is_ime initially.

	* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
	of g_colormap_ref()/unref().

	(gdk_window_new): Made code a bit more like the X11 one, pretend
	to handle screens (although we just have one for now).

	* gdk/x11/gdkevents-x11.c
	(gdk_event_send_client_message_for_display,
	gdk_screen_broadcast_client_message): Document the user data
	limitation on Win32.

	* gdk/win32/gdkevents-win32.c (print_event): More complete enter
	and leave notify detail output.

	* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
	visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
	for those, so that the GtkIMContextCimple compose tables will
	work. Deduce if the keyboard layout has the AltGr key, and set the
	above flag accordingly.
This commit is contained in:
Tor Lillqvist 2003-07-26 01:54:59 +00:00 committed by Tor Lillqvist
parent 98e5b6e608
commit 63f745738d
12 changed files with 1903 additions and 1393 deletions

167
ChangeLog
View File

@ -1,3 +1,170 @@
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c: Document DND signals.

View File

@ -1,3 +1,170 @@
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c: Document DND signals.

View File

@ -1,3 +1,170 @@
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c: Document DND signals.

View File

@ -1,3 +1,170 @@
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c: Document DND signals.

View File

@ -1,3 +1,170 @@
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 Matthias Clasen <maclas@gmx.de>
* gtk/gtkwidget.c: Document DND signals.

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,7 @@ HINSTANCE _gdk_dll_hinstance;
HINSTANCE _gdk_app_hmodule;
HKL _gdk_input_locale;
gboolean _gdk_input_locale_is_ime;
UINT _gdk_input_codepage;
WORD _cf_rtf;

View File

@ -39,6 +39,7 @@
#include "config.h"
guint _gdk_keymap_serial = 0;
gboolean _gdk_keyboard_has_altgr = FALSE;
static GdkKeymap *default_keymap = NULL;
@ -50,7 +51,7 @@ print_keysym_tab (void)
{
gint vk;
g_print ("keymap:\n");
g_print ("keymap:%s\n", _gdk_keyboard_has_altgr ? " (uses AltGr)" : "");
for (vk = 0; vk < 256; vk++)
{
gint state;
@ -72,7 +73,8 @@ static void
update_keymap (void)
{
static guint current_serial = 0;
guchar key_state[256];
guchar key_state[256], temp_key_state[256];
wchar_t wcs[1];
guint scancode;
guint vk;
@ -86,6 +88,8 @@ update_keymap (void)
memset (key_state, 0, sizeof (key_state));
_gdk_keyboard_has_altgr = FALSE;
for (vk = 0; vk < 256; vk++)
{
if ((scancode = MapVirtualKey (vk, 0)) == 0)
@ -95,15 +99,15 @@ update_keymap (void)
keysym_tab[vk*4+3] = GDK_VoidSymbol;
else
{
gint i, k;
gint shift;
key_state[vk] = 0x80;
for (i = 0; i < 4; i++)
for (shift = 0; shift < 4; shift++)
{
guint *ksymp = keysym_tab + vk*4 + i;
guint *ksymp = keysym_tab + vk*4 + shift;
guchar chars[2];
switch (i)
switch (shift)
{
case 0:
key_state[VK_SHIFT] = 0;
@ -137,7 +141,7 @@ update_keymap (void)
case VK_BACK:
*ksymp = GDK_BackSpace; break;
case VK_TAB:
if (i & 1)
if (shift & 0x1)
*ksymp = GDK_ISO_Left_Tab;
else
*ksymp = GDK_Tab;
@ -264,27 +268,121 @@ update_keymap (void)
}
if (*ksymp == 0)
{
if ((k = ToAsciiEx (vk, scancode, key_state,
(LPWORD) chars, 0,
_gdk_input_locale)) == 1)
gint k = ToAsciiEx (vk, scancode, key_state,
(LPWORD) chars, 0, _gdk_input_locale);
#if 0
g_print ("ToAsciiEx(%02x: %d: %d: %d, %02x%02x\n",
vk, scancode, shift, k, chars[0], chars[1]);
#endif
if (k == 1)
{
if (_gdk_input_codepage == 1252 &&
if (_gdk_input_codepage >= 1250 &&
_gdk_input_codepage <= 1258 &&
chars[0] >= GDK_space && chars[0] <= GDK_asciitilde)
*ksymp = chars[0];
else
{
wchar_t wcs[1];
if (MultiByteToWideChar (_gdk_input_codepage, 0,
chars, 1, wcs, 1) > 0)
*ksymp = gdk_unicode_to_keyval (wcs[0]);
}
}
else if (k == -1)
{
MultiByteToWideChar (_gdk_input_codepage, 0,
chars, 1, wcs, 1);
/* It is a dead key, and it's has been stored in
* the keyboard layout's state by ToAsciiEx().
* Yes, this is an incredibly silly API! Make
* the keyboard layout forget it by calling
* ToAsciiEx() once more, with the virtual key
* code and scancode for the spacebar, without
* shift or AltGr. Otherwise the next call to
* ToAsciiEx() with a different key would try to
* combine with the dead key.
*/
memmove (temp_key_state, key_state, sizeof (key_state));
temp_key_state[VK_SHIFT] =
temp_key_state[VK_CONTROL] =
temp_key_state[VK_MENU] = 0;
ToAsciiEx (VK_SPACE, MapVirtualKey (VK_SPACE, 0),
temp_key_state, (LPWORD) chars, 0,
_gdk_input_locale);
/* Use dead keysyms instead of "undead" ones */
switch (gdk_unicode_to_keyval (wcs[0]))
{
case GDK_grave:
*ksymp = GDK_dead_grave; break;
case GDK_acute:
*ksymp = GDK_dead_acute; break;
case GDK_asciicircum:
*ksymp = GDK_dead_circumflex; break;
case GDK_asciitilde:
*ksymp = GDK_dead_tilde; break;
case GDK_breve:
*ksymp = GDK_dead_breve; break;
case GDK_abovedot:
*ksymp = GDK_dead_abovedot; break;
case GDK_diaeresis:
*ksymp = GDK_dead_diaeresis; break;
case GDK_doubleacute:
*ksymp = GDK_dead_doubleacute; break;
case GDK_caron:
*ksymp = GDK_dead_caron; break;
case GDK_cedilla:
*ksymp = GDK_dead_cedilla; break;
case GDK_ogonek:
*ksymp = GDK_dead_ogonek; break;
case GDK_degree:
*ksymp = GDK_dead_abovering; break;
case GDK_periodcentered:
*ksymp = GDK_dead_abovedot; break;
case GDK_Greek_accentdieresis:
*ksymp = GDK_Greek_accentdieresis; break;
default:
GDK_NOTE (EVENTS,
g_print ("Unhandled dead key cp:%d vk:%02x, sc:%x, ch:%02x%s%s\n",
_gdk_input_codepage, vk,
scancode, chars[0],
(shift&0x1 ? " shift" : ""),
(shift&0x2 ? " altgr" : "")));
}
}
else if (k == 0)
{
/* Seems to be necessary to "reset" the keyboard layout
* in this case, too. Otherwise problems on NT4.
*/
memmove (temp_key_state, key_state, sizeof (key_state));
temp_key_state[VK_SHIFT] =
temp_key_state[VK_CONTROL] =
temp_key_state[VK_MENU] = 0;
ToAsciiEx (VK_SPACE, MapVirtualKey (VK_SPACE, 0),
temp_key_state, (LPWORD) chars, 0,
_gdk_input_locale);
}
else
{
GDK_NOTE (EVENTS, g_print ("ToAsciiEx returns %d "
"for vk:%02x, sc:%02x%s%s\n",
k, vk, scancode,
(shift&0x1 ? " shift" : ""),
(shift&0x2 ? " altgr" : "")));
}
}
if (*ksymp == 0)
*ksymp = GDK_VoidSymbol;
}
key_state[vk] = 0;
}
if ((keysym_tab[vk*4 + 2] != GDK_VoidSymbol &&
keysym_tab[vk*4] != keysym_tab[vk*4 + 2]) ||
(keysym_tab[vk*4 + 3] != GDK_VoidSymbol &&
keysym_tab[vk*4 + 1] != keysym_tab[vk*4 + 3]))
_gdk_keyboard_has_altgr = TRUE;
}
GDK_NOTE (EVENTS, print_keysym_tab ());
}
@ -309,7 +407,6 @@ gdk_keymap_get_direction (GdkKeymap *keymap)
{
case LANG_HEBREW:
case LANG_ARABIC:
/* Not 100% sure about these */
#ifdef LANG_URDU
case LANG_URDU:
#endif

View File

@ -97,6 +97,7 @@ _gdk_windowing_init (gint *argc,
GDK_NOTE (MISC, g_print ("Windows version: %08x\n", (guint) _windows_version));
_gdk_input_locale = GetKeyboardLayout (0);
_gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
buf, sizeof (buf));

View File

@ -461,9 +461,11 @@ extern HINSTANCE _gdk_app_hmodule;
* from a single thread anyway.
*/
extern HKL _gdk_input_locale;
extern gboolean _gdk_input_locale_is_ime;
extern UINT _gdk_input_codepage;
extern guint _gdk_keymap_serial;
extern gboolean _gdk_keyboard_has_altgr;
/* Registered clipboard formats */
extern WORD _cf_rtf;

View File

@ -156,7 +156,7 @@ gdk_window_impl_win32_get_colormap (GdkDrawable *drawable)
drawable_impl->colormap == NULL)
{
drawable_impl->colormap = gdk_colormap_get_system ();
gdk_colormap_ref (drawable_impl->colormap);
g_object_ref (drawable_impl->colormap);
}
return drawable_impl->colormap;
@ -237,16 +237,19 @@ _gdk_windowing_window_init (void)
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);
g_object_ref (draw_impl->colormap);
private->window_type = GDK_WINDOW_ROOT;
private->depth = gdk_visual_get_system ()->depth;
impl->width = width;
impl->height = height;
_gdk_window_init_position (GDK_WINDOW (private));
gdk_win32_handle_table_insert (&_gdk_root_window, _gdk_parent_root);
GDK_NOTE (MISC, g_print ("_gdk_parent_root=%p\n", GDK_WINDOW_HWND (_gdk_parent_root)));
}
static const gchar *
@ -420,6 +423,7 @@ gdk_window_new (GdkWindow *parent,
GdkWindowObject *private;
GdkWindowImplWin32 *impl;
GdkDrawableImplWin32 *draw_impl;
GdkScreen *screen;
GdkVisual *visual;
const gchar *title;
char *mbtitle;
@ -427,7 +431,12 @@ gdk_window_new (GdkWindow *parent,
g_return_val_if_fail (attributes != NULL, NULL);
if (!parent)
parent = _gdk_parent_root;
{
screen = gdk_screen_get_default ();
parent = gdk_screen_get_root_window (screen);
}
else
screen = gdk_drawable_get_screen (parent);
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
@ -490,11 +499,12 @@ gdk_window_new (GdkWindow *parent,
if (attributes_mask & GDK_WA_COLORMAP)
{
draw_impl->colormap = attributes->colormap;
gdk_colormap_ref (attributes->colormap);
g_object_ref (attributes->colormap);
}
else
{
draw_impl->colormap = gdk_colormap_get_system ();
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
}
}
else
@ -503,7 +513,7 @@ gdk_window_new (GdkWindow *parent,
private->depth = 0;
private->input_only = TRUE;
draw_impl->colormap = gdk_colormap_get_system ();
gdk_colormap_ref (draw_impl->colormap);
g_object_ref (draw_impl->colormap);
GDK_NOTE (MISC, g_print ("...GDK_INPUT_ONLY, system colormap\n"));
}
@ -628,7 +638,7 @@ gdk_window_new (GdkWindow *parent,
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
# else
/* the old behaviour, but with warning */
GDK_WINDOW_HWND (window) = hwndNew;
draw_impl->handle = hwndNew;
# endif
}
@ -652,7 +662,7 @@ gdk_window_new (GdkWindow *parent,
if (draw_impl->handle == NULL)
{
WIN32_API_FAILED ("CreateWindowEx");
g_object_unref ((GObject *) window);
g_object_unref (window);
return NULL;
}
@ -805,7 +815,7 @@ show_window_internal (GdkWindow *window,
GdkWindowObject *private;
HWND old_active_window;
private = GDK_WINDOW_OBJECT (window);
private = (GdkWindowObject *) window;
if (private->destroyed)
return;
@ -906,31 +916,31 @@ gdk_window_hide (GdkWindow *window)
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
if (!private->destroyed)
if (private->destroyed)
return;
GDK_NOTE (MISC, g_print ("gdk_window_hide: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (private->state)));
if (GDK_WINDOW_IS_MAPPED (window))
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_WITHDRAWN);
_gdk_window_clear_update_area (window);
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
{
GDK_NOTE (MISC, g_print ("gdk_window_hide: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (private->state)));
if (GDK_WINDOW_IS_MAPPED (window))
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_WITHDRAWN);
_gdk_window_clear_update_area (window);
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
{
SetWindowPos(GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_HIDEWINDOW | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
}
else
{
ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
}
SetWindowPos(GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_HIDEWINDOW | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
}
else
{
ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
}
}
@ -942,14 +952,14 @@ gdk_window_withdraw (GdkWindow *window)
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (private->state)));
if (private->destroyed)
return;
gdk_window_hide (window); /* ??? */
}
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %p %s\n",
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (private->state)));
gdk_window_hide (window); /* ??? */
}
void
@ -1063,6 +1073,10 @@ gdk_window_move_resize (GdkWindow *window,
GdkWindowObject *private = (GdkWindowObject*) window;
GdkWindowImplWin32 *impl;
RECT rect;
DWORD dwStyle;
DWORD dwExStyle;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@ -1073,40 +1087,36 @@ gdk_window_move_resize (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
if (!private->destroyed)
if (private->destroyed)
return;
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %p %dx%d@+%d+%d\n",
GDK_WINDOW_HWND (window),
width, height, x, y));
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, x, y, width, height);
else
{
RECT rect;
DWORD dwStyle;
DWORD dwExStyle;
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %p %dx%d@+%d+%d\n",
GDK_WINDOW_HWND (window),
width, height, x, y));
rect.left = x;
rect.top = y;
rect.right = x + width;
rect.bottom = y + height;
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, x, y, width, height);
else
{
rect.left = x;
rect.top = y;
rect.right = x + width;
rect.bottom = y + height;
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
WIN32_API_FAILED ("AdjustWindowRectEx");
GDK_NOTE (MISC, g_print ("...SetWindowPos(%p,%ldx%ld@+%ld+%ld)\n",
GDK_WINDOW_HWND (window),
rect.right - rect.left, rect.bottom - rect.top,
rect.left, rect.top));
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOZORDER))
WIN32_API_FAILED ("SetWindowPos");
}
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
WIN32_API_FAILED ("AdjustWindowRectEx");
GDK_NOTE (MISC, g_print ("...SetWindowPos(%p,%ldx%ld@+%ld+%ld)\n",
GDK_WINDOW_HWND (window),
rect.right - rect.left, rect.bottom - rect.top,
rect.left, rect.top));
if (!SetWindowPos (GDK_WINDOW_HWND (window), NULL,
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
SWP_NOACTIVATE | SWP_NOZORDER))
WIN32_API_FAILED ("SetWindowPos");
}
}

View File

@ -2100,12 +2100,15 @@ gdk_event_dispatch (GSource *source,
* gdk_event_send_client_message_for_display:
* @display: the #GdkDisplay for the window where the message is to be sent.
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
* @winid: the window to send the X ClientMessage event to.
* @winid: the window to send the client message to.
*
* Sends an X ClientMessage event to a given window.
* On X11, sends an X ClientMessage event to a given window. On
* Windows, sends a message registered with the name
* GDK_WIN32_CLIENT_MESSAGE.
*
* This could be used for communicating between different applications,
* though the amount of data is limited to 20 bytes.
* This could be used for communicating between different
* applications, though the amount of data is limited to 20 bytes on
* X11, and to just four bytes on Windows.
*
* Returns: non-zero on success.
*
@ -2198,13 +2201,18 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
* @screen: the #GdkScreen where the event will be broadcasted.
* @event: the #GdkEvent.
*
* Sends an X ClientMessage event to all toplevel windows on @screen.
* On X11, sends an X ClientMessage event to all toplevel windows on
* @screen.
*
* Toplevel windows are determined by checking for the WM_STATE property,
* as described in the Inter-Client Communication Conventions Manual (ICCCM).
* If no windows are found with the WM_STATE property set, the message is
* sent to all children of the root window.
*
* On Windows, broadcasts a message registered with the name
* GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of
* data is limited to one long, i.e. four bytes.
*
* Since: 2.2
*/