Remove the event_mask, it is now in GdkWindowObject.

2002-03-01  Tor Lillqvist  <tml@iki.fi>

	* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
	the event_mask, it is now in GdkWindowObject.

	* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
	GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
	in gdk_window_new(), too. (Bug#72921)

	* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
	(vk_from_char): New function, calculates the virtual keycode
	corresponding to the char in a WM_CHAR message.
	(build_keypress_event, build_keyrelease_event): Use it.
	(build_keypress_event): Call ImmReleaseContext() after using the
	input context. This might plug a memory or resource leak.
	(build_key_event_state): Remove #if 0 code.
	(gdk_event_translate): Actually, it would be preferrable to always
	handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
	all, and thus drop the contorted logic with ignore_wm_char etc.

	* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
	Debugging output.
	(gdk_keymap_translate_keyboard_state): Return correct value. (But
	_gtk_key_hash_lookup() doesn't check the return value...)
This commit is contained in:
Tor Lillqvist 2002-02-28 23:38:55 +00:00 committed by Tor Lillqvist
parent ad17c36038
commit 8beceb3846
11 changed files with 290 additions and 97 deletions

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -1,3 +1,28 @@
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com> Thu Feb 28 14:49:08 2002 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): Initialize

View File

@ -791,20 +791,7 @@ build_key_event_state (GdkEvent *event)
if (!is_altgr_key) if (!is_altgr_key)
{ {
if (GetKeyState (VK_CONTROL) < 0) if (GetKeyState (VK_CONTROL) < 0)
{ event->key.state |= GDK_CONTROL_MASK;
event->key.state |= GDK_CONTROL_MASK;
#if 0
if (event->key.keyval < ' ')
event->key.keyval += '@';
#endif
}
#if 0
else if (event->key.keyval < ' ')
{
event->key.state |= GDK_CONTROL_MASK;
event->key.keyval += '@';
}
#endif
if (GetKeyState (VK_MENU) < 0) if (GetKeyState (VK_MENU) < 0)
event->key.state |= GDK_MOD1_MASK; event->key.state |= GDK_MOD1_MASK;
} }
@ -836,10 +823,23 @@ build_pointer_event_state (MSG *msg)
return state; return state;
} }
static guint
vk_from_char (guint c)
{
switch (c)
{
case '\b':
return 'H';
case '\t':
return 'I';
default:
return (VkKeyScanEx (c, _gdk_input_locale) & 0xFF);
}
}
static void static void
build_keypress_event (GdkWindowImplWin32 *impl, build_keypress_event (GdkEvent *event,
GdkEvent *event, MSG *msg)
MSG *msg)
{ {
HIMC himc; HIMC himc;
gint i, bytecount, ucount; gint i, bytecount, ucount;
@ -854,24 +854,26 @@ build_keypress_event (GdkWindowImplWin32 *impl,
if (msg->message == WM_IME_COMPOSITION) if (msg->message == WM_IME_COMPOSITION)
{ {
himc = ImmGetContext (msg->hwnd); himc = ImmGetContext (msg->hwnd);
bytecount = ImmGetCompositionStringW (himc, GCS_RESULTSTR, bytecount = ImmGetCompositionStringW (himc, GCS_RESULTSTR,
wbuf, sizeof (wbuf)); wbuf, sizeof (wbuf));
ImmReleaseContext (msg->hwnd, himc);
ucount = bytecount / 2; ucount = bytecount / 2;
event->key.hardware_keycode = wbuf[0]; /* ??? */ event->key.hardware_keycode = wbuf[0]; /* ??? */
} }
else else
{ {
event->key.hardware_keycode = msg->wParam;
if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
{ {
bytecount = MIN ((msg->lParam & 0xFFFF), sizeof (buf)); bytecount = MIN ((msg->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++) for (i = 0; i < bytecount; i++)
buf[i] = msg->wParam; buf[i] = msg->wParam;
event->key.hardware_keycode = vk_from_char (msg->wParam);
} }
else /* WM_IME_CHAR */ else /* WM_IME_CHAR */
{ {
event->key.keyval = GDK_VoidSymbol; event->key.keyval = GDK_VoidSymbol;
event->key.hardware_keycode = 0; /* ??? */
if (msg->wParam & 0xFF00) if (msg->wParam & 0xFF00)
{ {
/* Contrary to some versions of the documentation, /* Contrary to some versions of the documentation,
@ -930,9 +932,8 @@ build_keypress_event (GdkWindowImplWin32 *impl,
} }
static void static void
build_keyrelease_event (GdkWindowImplWin32 *impl, build_keyrelease_event (GdkEvent *event,
GdkEvent *event, MSG *msg)
MSG *msg)
{ {
guchar buf; guchar buf;
wchar_t wbuf; wchar_t wbuf;
@ -944,7 +945,6 @@ build_keyrelease_event (GdkWindowImplWin32 *impl,
if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
{ {
event->key.hardware_keycode = msg->wParam;
if (msg->wParam < ' ') if (msg->wParam < ' ')
event->key.keyval = msg->wParam + '@'; event->key.keyval = msg->wParam + '@';
else else
@ -955,6 +955,7 @@ build_keyrelease_event (GdkWindowImplWin32 *impl,
event->key.keyval = gdk_unicode_to_keyval (wbuf); event->key.keyval = gdk_unicode_to_keyval (wbuf);
} }
event->key.hardware_keycode = vk_from_char (msg->wParam);
} }
else else
{ {
@ -1158,7 +1159,7 @@ synthesize_leave_event (GdkWindow *window,
{ {
POINT pt; POINT pt;
if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_LEAVE_NOTIFY_MASK)) if (!(GDK_WINDOW_OBJECT (window)->event_mask & GDK_LEAVE_NOTIFY_MASK))
return; return;
/* Leave events are at (current_x,current_y) in current_window */ /* Leave events are at (current_x,current_y) in current_window */
@ -1183,7 +1184,7 @@ synthesize_enter_event (GdkWindow *window,
{ {
POINT pt; POINT pt;
if (!(GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask & GDK_ENTER_NOTIFY_MASK)) if (!(GDK_WINDOW_OBJECT (window)->event_mask & GDK_ENTER_NOTIFY_MASK))
return; return;
/* Enter events are at LOWORD (msg->lParam), HIWORD /* Enter events are at LOWORD (msg->lParam), HIWORD
@ -1468,7 +1469,7 @@ propagate (GdkWindow **window,
} }
while (TRUE) while (TRUE)
{ {
if ((*doesnt_want_it) (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (*window)->impl)->event_mask, msg)) if ((*doesnt_want_it) (GDK_WINDOW_OBJECT (*window)->event_mask, msg))
{ {
/* Owner doesn't want it, propagate to parent. */ /* Owner doesn't want it, propagate to parent. */
if (GDK_WINDOW (GDK_WINDOW_OBJECT (*window)->parent) == _gdk_parent_root) if (GDK_WINDOW (GDK_WINDOW_OBJECT (*window)->parent) == _gdk_parent_root)
@ -1809,13 +1810,16 @@ gdk_event_translate (GdkEvent *event,
CHARSETINFO charset_info; CHARSETINFO charset_info;
/* Invariant: /* Invariant:
* window_impl == GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl) * private == GDK_WINDOW_OBJECT (window)
*/ */
GdkWindow *window; GdkWindow *window;
GdkWindowImplWin32 *window_impl; GdkWindowObject *private;
#define ASSIGN_WINDOW(rhs) \ #define ASSIGN_WINDOW(rhs) \
(window = rhs, \ (window = rhs, \
window_impl = (window ? GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl) : NULL)) private = (GdkWindowObject *) window)
GdkWindowImplWin32 *impl;
GdkWindow *orig_window, *new_window; GdkWindow *orig_window, *new_window;
gint xoffset, yoffset; gint xoffset, yoffset;
@ -2392,29 +2396,29 @@ gdk_event_translate (GdkEvent *event,
return_val = !GDK_WINDOW_DESTROYED (window); return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val && (event->key.window == k_grab_window if (return_val && (event->key.window == k_grab_window
|| (window_impl->event_mask & GDK_KEY_RELEASE_MASK))) || (private->event_mask & GDK_KEY_RELEASE_MASK)))
{ {
if (window == k_grab_window if (window == k_grab_window
|| (window_impl->event_mask & GDK_KEY_PRESS_MASK)) || (private->event_mask & GDK_KEY_PRESS_MASK))
{ {
/* Append a GDK_KEY_PRESS event to the pushback list /* Append a GDK_KEY_PRESS event to the pushback list
* (from which it will be fetched before the release * (from which it will be fetched before the release
* event). * event).
*/ */
GdkEvent *event2 = _gdk_event_new (); GdkEvent *event2 = _gdk_event_new ();
build_keypress_event (window_impl, event2, msg); build_keypress_event (event2, msg);
event2->key.window = window; event2->key.window = window;
gdk_drawable_ref (window); gdk_drawable_ref (window);
_gdk_event_queue_append (event2); _gdk_event_queue_append (event2);
GDK_NOTE (EVENTS, print_event (event2)); GDK_NOTE (EVENTS, print_event (event2));
} }
/* Return the key release event. */ /* Return the key release event. */
build_keyrelease_event (window_impl, event, msg); build_keyrelease_event (event, msg);
} }
else if (return_val && (window_impl->event_mask & GDK_KEY_PRESS_MASK)) else if (return_val && (private->event_mask & GDK_KEY_PRESS_MASK))
{ {
/* Return just the key press event. */ /* Return just the key press event. */
build_keypress_event (window_impl, event, msg); build_keypress_event (event, msg);
} }
else else
return_val = FALSE; return_val = FALSE;
@ -2468,13 +2472,12 @@ gdk_event_translate (GdkEvent *event,
if (!p_grab_window) if (!p_grab_window)
{ {
/* No explicit active grab, let's start one automatically */ /* No explicit active grab, let's start one automatically */
gint owner_events = window_impl->event_mask gint owner_events = (private->event_mask & (GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK));
& (GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);
GDK_NOTE (EVENTS, g_print ("...automatic grab started\n")); GDK_NOTE (EVENTS, g_print ("...automatic grab started\n"));
gdk_pointer_grab (window, gdk_pointer_grab (window,
owner_events, owner_events,
window_impl->event_mask, private->event_mask,
NULL, NULL, 0); NULL, NULL, 0);
p_grab_automatic = TRUE; p_grab_automatic = TRUE;
} }
@ -2623,7 +2626,7 @@ gdk_event_translate (GdkEvent *event,
LOWORD (msg->lParam), HIWORD (msg->lParam))); LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (track_mouse_event == NULL if (track_mouse_event == NULL
&& current_window != NULL && current_window != NULL
&& (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (current_window)->impl)->event_mask & GDK_LEAVE_NOTIFY_MASK)) && (GDK_WINDOW_OBJECT (current_window)->event_mask & GDK_LEAVE_NOTIFY_MASK))
{ {
GDK_NOTE (EVENTS, g_print ("...synthesizing LEAVE_NOTIFY event\n")); GDK_NOTE (EVENTS, g_print ("...synthesizing LEAVE_NOTIFY event\n"));
@ -2712,7 +2715,7 @@ gdk_event_translate (GdkEvent *event,
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %p\n", msg->hwnd)); GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %p\n", msg->hwnd));
if (!(window_impl->event_mask & GDK_LEAVE_NOTIFY_MASK)) if (!(private->event_mask & GDK_LEAVE_NOTIFY_MASK))
break; break;
event->crossing.type = GDK_LEAVE_NOTIFY; event->crossing.type = GDK_LEAVE_NOTIFY;
@ -2787,7 +2790,7 @@ gdk_event_translate (GdkEvent *event,
"SET" : "KILL"), "SET" : "KILL"),
msg->hwnd)); msg->hwnd));
if (!(window_impl->event_mask & GDK_FOCUS_CHANGE_MASK)) if (!(private->event_mask & GDK_FOCUS_CHANGE_MASK))
break; break;
event->focus_change.type = GDK_FOCUS_CHANGE; event->focus_change.type = GDK_FOCUS_CHANGE;
@ -2836,7 +2839,7 @@ gdk_event_translate (GdkEvent *event,
if (GDK_WINDOW_OBJECT (window)->input_only) if (GDK_WINDOW_OBJECT (window)->input_only)
break; break;
if (!(window_impl->event_mask & GDK_EXPOSURE_MASK)) if (!(private->event_mask & GDK_EXPOSURE_MASK))
break; break;
#if 0 /* we need to process exposes even with GDK_NO_BG #if 0 /* we need to process exposes even with GDK_NO_BG
@ -2919,7 +2922,7 @@ gdk_event_translate (GdkEvent *event,
if (p_grab_window != NULL && p_grab_cursor != NULL) if (p_grab_window != NULL && p_grab_cursor != NULL)
hcursor = p_grab_cursor; hcursor = p_grab_cursor;
else if (!GDK_WINDOW_DESTROYED (window)) else if (!GDK_WINDOW_DESTROYED (window))
hcursor = window_impl->hcursor; hcursor = GDK_WINDOW_IMPL_WIN32 (private->impl)->hcursor;
else else
hcursor = NULL; hcursor = NULL;
@ -2936,7 +2939,7 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS, g_print ("WM_SHOWWINDOW: %p %d\n", GDK_NOTE (EVENTS, g_print ("WM_SHOWWINDOW: %p %d\n",
msg->hwnd, msg->wParam)); msg->hwnd, msg->wParam));
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK)) if (!(private->event_mask & GDK_STRUCTURE_MASK))
break; break;
event->any.type = (msg->wParam ? GDK_MAP : GDK_UNMAP); event->any.type = (msg->wParam ? GDK_MAP : GDK_UNMAP);
@ -2964,7 +2967,7 @@ gdk_event_translate (GdkEvent *event,
(msg->wParam == SIZE_RESTORED ? "RESTORED" : "?"))))), (msg->wParam == SIZE_RESTORED ? "RESTORED" : "?"))))),
LOWORD (msg->lParam), HIWORD (msg->lParam))); LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK)) if (!(private->event_mask & GDK_STRUCTURE_MASK))
break; break;
if (msg->wParam == SIZE_MINIMIZED) if (msg->wParam == SIZE_MINIMIZED)
@ -2999,17 +3002,16 @@ gdk_event_translate (GdkEvent *event,
event->configure.y = pt.y; event->configure.y = pt.y;
event->configure.width = LOWORD (msg->lParam); event->configure.width = LOWORD (msg->lParam);
event->configure.height = HIWORD (msg->lParam); event->configure.height = HIWORD (msg->lParam);
GDK_WINDOW_OBJECT (window)->x = event->configure.x; private->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y; private->y = event->configure.y;
window_impl->width = event->configure.width; GDK_WINDOW_IMPL_WIN32 (private->impl)->width = event->configure.width;
window_impl->height = event->configure.height; GDK_WINDOW_IMPL_WIN32 (private->impl)->height = event->configure.height;
if (GDK_WINDOW_OBJECT (window)->resize_count > 1) if (private->resize_count > 1)
GDK_WINDOW_OBJECT (window)->resize_count -= 1; private->resize_count -= 1;
return_val = !GDK_WINDOW_DESTROYED (window); return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val if (return_val && private->extension_events != 0)
&& GDK_WINDOW_OBJECT (window)->extension_events != 0)
_gdk_input_configure_event (&event->configure, window); _gdk_input_configure_event (&event->configure, window);
} }
break; break;
@ -3031,17 +3033,16 @@ gdk_event_translate (GdkEvent *event,
event->configure.y = lpr->top + ncm.iCaptionHeight; event->configure.y = lpr->top + ncm.iCaptionHeight;
event->configure.width = lpr->right - lpr->left - 2 * ncm.iBorderWidth; event->configure.width = lpr->right - lpr->left - 2 * ncm.iBorderWidth;
event->configure.height = lpr->bottom - lpr->top - ncm.iCaptionHeight; event->configure.height = lpr->bottom - lpr->top - ncm.iCaptionHeight;
GDK_WINDOW_OBJECT (window)->x = event->configure.x; private->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y; private->y = event->configure.y;
window_impl->width = event->configure.width; GDK_WINDOW_IMPL_WIN32 (private->impl)->width = event->configure.width;
window_impl->height = event->configure.height; GDK_WINDOW_IMPL_WIN32 (private->impl)->height = event->configure.height;
if (GDK_WINDOW_OBJECT (window)->resize_count > 1) if (private->resize_count > 1)
GDK_WINDOW_OBJECT (window)->resize_count -= 1; private->resize_count -= 1;
return_val = !GDK_WINDOW_DESTROYED (window); return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val if (return_val && private->extension_events != 0)
&& GDK_WINDOW_OBJECT (window)->extension_events != 0)
_gdk_input_configure_event (&event->configure, window); _gdk_input_configure_event (&event->configure, window);
} }
break; break;
@ -3049,32 +3050,33 @@ gdk_event_translate (GdkEvent *event,
case WM_GETMINMAXINFO: case WM_GETMINMAXINFO:
GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %p\n", msg->hwnd)); GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %p\n", msg->hwnd));
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
mmi = (MINMAXINFO*) msg->lParam; mmi = (MINMAXINFO*) msg->lParam;
if (window_impl->hint_flags & GDK_HINT_MIN_SIZE) if (impl->hint_flags & GDK_HINT_MIN_SIZE)
{ {
mmi->ptMinTrackSize.x = window_impl->hint_min_width; mmi->ptMinTrackSize.x = impl->hint_min_width;
mmi->ptMinTrackSize.y = window_impl->hint_min_height; mmi->ptMinTrackSize.y = impl->hint_min_height;
} }
if (window_impl->hint_flags & GDK_HINT_MAX_SIZE) if (impl->hint_flags & GDK_HINT_MAX_SIZE)
{ {
mmi->ptMaxTrackSize.x = window_impl->hint_max_width; mmi->ptMaxTrackSize.x = impl->hint_max_width;
mmi->ptMaxTrackSize.y = window_impl->hint_max_height; mmi->ptMaxTrackSize.y = impl->hint_max_height;
/* kind of WM functionality, limit maximized size to screen */ /* kind of WM functionality, limit maximized size to screen */
mmi->ptMaxPosition.x = 0; mmi->ptMaxPosition.y = 0; mmi->ptMaxPosition.x = 0;
mmi->ptMaxSize.x = MIN(window_impl->hint_max_width, gdk_screen_width ()); mmi->ptMaxPosition.y = 0;
mmi->ptMaxSize.y = MIN(window_impl->hint_max_height, gdk_screen_height ()); mmi->ptMaxSize.x = MIN (impl->hint_max_width, gdk_screen_width ());
mmi->ptMaxSize.y = MIN (impl->hint_max_height, gdk_screen_height ());
} }
else if (window_impl->hint_flags & GDK_HINT_MIN_SIZE) else if (impl->hint_flags & GDK_HINT_MIN_SIZE)
{ {
/* need to initialize */ /* need to initialize */
mmi->ptMaxSize.x = gdk_screen_width (); mmi->ptMaxSize.x = gdk_screen_width ();
mmi->ptMaxSize.y = gdk_screen_height (); mmi->ptMaxSize.y = gdk_screen_height ();
} }
/* lovely API inconsistence: return FALSE when handled */ /* lovely API inconsistence: return FALSE when handled */
if (ret_val_flagp) if (ret_val_flagp)
*ret_val_flagp = !(window_impl->hint_flags & *ret_val_flagp = !(impl->hint_flags & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE));
(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE));
break; break;
case WM_MOVE: case WM_MOVE:
@ -3082,7 +3084,7 @@ gdk_event_translate (GdkEvent *event,
msg->hwnd, msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam))); LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK)) if (!(private->event_mask & GDK_STRUCTURE_MASK))
break; break;
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD
@ -3096,20 +3098,21 @@ gdk_event_translate (GdkEvent *event,
GetClientRect (msg->hwnd, &rect); GetClientRect (msg->hwnd, &rect);
event->configure.width = rect.right; event->configure.width = rect.right;
event->configure.height = rect.bottom; event->configure.height = rect.bottom;
GDK_WINDOW_OBJECT (window)->x = event->configure.x; private->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y; private->y = event->configure.y;
window_impl->width = event->configure.width; GDK_WINDOW_IMPL_WIN32 (private->impl)->width = event->configure.width;
window_impl->height = event->configure.height; GDK_WINDOW_IMPL_WIN32 (private->impl)->height = event->configure.height;
return_val = !GDK_WINDOW_DESTROYED (window); return_val = !GDK_WINDOW_DESTROYED (window);
} }
break; break;
#if 0 /* not quite right, otherwise it may be faster/better than WM_(MOVE|SIZE)
* remove decoration (frame) sizes ? #if 0 /* Not quite right, otherwise it may be faster/better than
* WM_(MOVE|SIZE) remove decoration (frame) sizes ?
*/ */
case WM_WINDOWPOSCHANGED : case WM_WINDOWPOSCHANGED :
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK)) if (!(private->event_mask & GDK_STRUCTURE_MASK))
break; break;
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD
@ -3124,10 +3127,10 @@ gdk_event_translate (GdkEvent *event,
event->configure.y = lpwp->y; event->configure.y = lpwp->y;
event->configure.width = lpwp->cx; event->configure.width = lpwp->cx;
event->configure.height = lpwp->cy; event->configure.height = lpwp->cy;
GDK_WINDOW_OBJECT (window)->x = event->configure.x; private->x = event->configure.x;
GDK_WINDOW_OBJECT (window)->y = event->configure.y; private->y = event->configure.y;
window_impl->width = event->configure.width; GDK_WINDOW_IMPL_WIN32 (private->impl)->width = event->configure.width;
window_impl->height = event->configure.height; GDK_WINDOW_IMPL_WIN32 (private->impl)->height = event->configure.height;
return_val = !GDK_WINDOW_DESTROYED (window); return_val = !GDK_WINDOW_DESTROYED (window);

View File

@ -376,6 +376,22 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
} }
} }
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
{
gint i;
g_print ("gdk_keymap_get_entries_for_keyval: %#.04x (%s):",
keyval, gdk_keyval_name (keyval));
for (i = 0; i < retval->len; i++)
{
GdkKeymapKey *entry = (GdkKeymapKey *) retval->data + i;
g_print (" %#.02x %d %d", entry->keycode, entry->group, entry->level);
}
g_print ("\n");
}
#endif
if (retval->len > 0) if (retval->len > 0)
{ {
*keys = (GdkKeymapKey*) retval->data; *keys = (GdkKeymapKey*) retval->data;
@ -638,7 +654,7 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
if (keyval) if (keyval)
*keyval = tmp_keyval; *keyval = tmp_keyval;
return FALSE; return tmp_keyval != GDK_VoidSymbol;
} }
/* Key handling not part of the keymap */ /* Key handling not part of the keymap */

View File

@ -91,7 +91,6 @@ gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
impl->width = 1; impl->width = 1;
impl->height = 1; impl->height = 1;
impl->event_mask = 0;
impl->hcursor = NULL; impl->hcursor = NULL;
impl->hint_flags = 0; impl->hint_flags = 0;
impl->extension_events_selected = FALSE; impl->extension_events_selected = FALSE;
@ -486,8 +485,7 @@ gdk_window_new (GdkWindow *parent,
if (!title || !*title) if (!title || !*title)
title = "GDK client window"; title = "GDK client window";
impl->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask; private->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
private->event_mask = impl->event_mask;
if (private->parent && private->parent->guffaw_gravity) if (private->parent && private->parent->guffaw_gravity)
{ {
@ -707,6 +705,7 @@ gdk_window_foreign_new (GdkNativeWindow anid)
impl->height = rect.bottom - rect.top; impl->height = rect.bottom - rect.top;
private->window_type = GDK_WINDOW_FOREIGN; private->window_type = GDK_WINDOW_FOREIGN;
private->destroyed = FALSE; private->destroyed = FALSE;
private->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
if (IsWindowVisible ((HWND) anid)) if (IsWindowVisible ((HWND) anid))
private->state &= (~GDK_WINDOW_STATE_WITHDRAWN); private->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
else else
@ -1929,7 +1928,7 @@ gdk_window_get_events (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return 0; return 0;
return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask; return GDK_WINDOW_OBJECT (window)->event_mask;
} }
void void
@ -1942,8 +1941,11 @@ gdk_window_set_events (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window)) if (GDK_WINDOW_DESTROYED (window))
return; return;
GDK_WINDOW_OBJECT (window)->event_mask = event_mask; /* gdk_window_new() always sets the GDK_STRUCTURE_MASK, so better
GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask = event_mask; * set it here, too. Not that I know or remember why it is
* necessary, will have to test some day.
*/
GDK_WINDOW_OBJECT (window)->event_mask = GDK_STRUCTURE_MASK | event_mask;
} }
void void

View File

@ -75,9 +75,6 @@ struct _GdkWindowImplWin32
GdkWin32PositionInfo position_info; GdkWin32PositionInfo position_info;
/* We must keep the event mask here to filter them ourselves */
gint event_mask;
HCURSOR hcursor; HCURSOR hcursor;
/* Window size hints */ /* Window size hints */