+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+2000-07-04 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Handle also
+ WM_SYSCHAR, and other changes to get handling of Alt+nnn or
+ Alt+0nnn on the numpad (used to enter characters by numeric code
+ from current DOS or ANSI codepage) working correctly, as in other
+ Windows apps.
+
+ * gdk/win32/gdkcursor-win32.c (gdk_cursor_new_from_pixmap): Use
+ same argument validity tests as in X11 version.
+ (_gdk_cursor_destroy): Use DestroyCursor, not DestroyIcon.
+
+ * gdk/win32/gdkwin32.h: Add also WM_MOUSEWHEEL and CopyCursor
+ definitions in case missing from headers.
+
+ * gdk/win32/gdkwindow-win32.c (gdk_win32_window_destroy): ALso
+ destroy the window-specific cursor.
+ (RegisterGdkClass): Use the global gdk_ProgInstance instead of
+ calling GetModuleHandle(NULL).
+ (gdk_window_set_cursor): Reworked to always copy the passed cursor
+ with CopyCursor before setting it. It is OK for the caller to
+ destroy the GdkCursor (and thus also the Windows cursor) after
+ calling this function. Also, destroy any previous cursor for this
+ window.
+
Mon Jul 3 17:54:49 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale):
* gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description):
Add function to load a GdkFont from a PangoFontDescription.
+2000-05-29 Tor Lillqvist <tml@iki.fi>
+
+ * gdk/win32/gdkevents-win32.c (gdk_WindowProc): The local "event"
+ variable should be of type GdkEventPrivate.
+
Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able
+This current (CVS) version of the Win32 backend does *not* even
+compile properly. A zipfile with an older snapshot (from before the
+merge of the no-flicker branch, and the other recent additions), is
+available from http://www.gimp.org/win32/. That should be use by
+"production" code until this CVS version is useable. (But note, the
+Win32 backend has never been claimed to be "production quality",
+although it works OK for the GIMP.)
+
The Win32 port of GTk+ is a work in progress, and not as stable or
correct as the Unix/X11 version. For more information about the Win32
port, see http://www.gimp.org/tml/gimp/win32/ or
http://www.iki.fi/tml/gimp/win32/ .
-The current (CVS) version of the Win32 backend is *not* as stable as it
-was before the no-flicker branch was merged. A zipfile with that
-version is available from http://www.gimp.org/win32/. That should be
-use by "production" code until this CVS version is usable. (But note,
-the Win32 backend has never been claimed to be "production quality".)
-
To build GTk+ on Win32, you need either the Microsoft compiler and
tools, or gcc-2.95 or later. The mingw setup of gcc is preferred, but
you can run gcc also under cygwin-b20.1 or later. Compile in
guchar residue;
gint ix, iy;
- g_return_val_if_fail (source != NULL, NULL);
- g_return_val_if_fail (mask != NULL, NULL);
+ g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
+ g_return_val_if_fail (GDK_IS_PIXMAP (mask), NULL);
+ g_return_val_if_fail (fg != NULL, NULL);
+ g_return_val_if_fail (bg != NULL, NULL);
source_private = (GdkDrawablePrivate *) source;
mask_private = (GdkDrawablePrivate *) mask;
(cursor->type == GDK_CURSOR_IS_PIXMAP) ? private->xcursor : 0));
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
- if (!DestroyIcon (private->xcursor))
- WIN32_API_FAILED ("DestroyIcon");
+ if (!DestroyCursor (private->xcursor))
+ WIN32_API_FAILED ("DestroyCursor");
g_free (private);
}
WPARAM wParam,
LPARAM lParam)
{
- GdkEvent event;
+ GdkEventPrivate event;
GdkEvent *eventp;
MSG msg;
DWORD pos;
gint ret_val;
gboolean ret_val_flag;
- GDK_NOTE (EVENTS, g_print ("gdk_WindowProc: %#x %#.03x\n", hWnd, message));
+ GDK_NOTE (EVENTS, g_print ("gdk_WindowProc: %#x %s\n",
+ hWnd, gdk_win32_message_name (message)));
msg.hwnd = hWnd;
msg.message = message;
msg.pt.x = LOWORD (pos);
msg.pt.y = HIWORD (pos);
- ((GdkEventPrivate *)&event)->flags |= GDK_EVENT_PENDING;
- if (gdk_event_translate (&event, &msg, &ret_val_flag, &ret_val))
+ event.flags = GDK_EVENT_PENDING;
+ if (gdk_event_translate (&event.event, &msg, &ret_val_flag, &ret_val))
{
- ((GdkEventPrivate *)&event)->flags &= ~GDK_EVENT_PENDING;
+ event.flags &= ~GDK_EVENT_PENDING;
#if 1
- if (event.any.type == GDK_CONFIGURE)
+ if (event.event.any.type == GDK_CONFIGURE)
{
/* Compress configure events */
GList *list = gdk_queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_CONFIGURE
- || ((GdkEvent *)list->data)->any.window != event.any.window))
+ || ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GDK_NOTE (EVENTS, g_print ("... compressing an CONFIGURE event\n"));
- *((GdkEvent *)list->data) = event;
- gdk_drawable_unref (event.any.window);
+ *((GdkEvent *)list->data) = event.event;
+ gdk_drawable_unref (event.event.any.window);
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
return FALSE;
}
}
- else if (event.any.type == GDK_EXPOSE)
+ else if (event.event.any.type == GDK_EXPOSE)
{
/* Compress expose events */
GList *list = gdk_queued_events;
while (list != NULL
&& (((GdkEvent *)list->data)->any.type != GDK_EXPOSE
- || ((GdkEvent *)list->data)->any.window != event.any.window))
+ || ((GdkEvent *)list->data)->any.window != event.event.any.window))
list = list->next;
if (list != NULL)
{
GdkRectangle u;
GDK_NOTE (EVENTS, g_print ("... compressing an EXPOSE event\n"));
- gdk_rectangle_union (&event.expose.area,
+ gdk_rectangle_union (&event.event.expose.area,
&((GdkEvent *)list->data)->expose.area,
&u);
((GdkEvent *)list->data)->expose.area = u;
- gdk_drawable_unref (event.any.window);
+ gdk_drawable_unref (event.event.any.window);
#if 0
/* Wake up WaitMessage */
PostMessage (NULL, gdk_ping_msg, 0, 0);
}
#endif
eventp = gdk_event_new ();
- *eventp = event;
+ *((GdkEventPrivate *) eventp) = event;
/* Philippe Colantoni <colanton@aris.ss.uci.edu> suggests this
* in order to handle events while opaque resizing neatly. I
p_grab_owner_events = (owner_events != 0);
p_grab_automatic = FALSE;
-#if 0 /* Menus don't work if we use mouse capture. Pity, because many other
+#if 1 /* Menus don't work if we use mouse capture. Pity, because many other
* things work better with mouse capture.
*/
SetCapture (xwindow);
{
if (gdk_input_vtable.ungrab_pointer)
gdk_input_vtable.ungrab_pointer (time);
-#if 0
+#if 1
if (GetCapture () != NULL)
ReleaseCapture ();
#endif
static void
build_key_event_state (GdkEvent *event)
{
- event->key.state = 0;
if (GetKeyState (VK_SHIFT) < 0)
event->key.state |= GDK_SHIFT_MASK;
if (GetKeyState (VK_CAPITAL) & 0x1)
if (GetKeyState (VK_CONTROL) < 0)
{
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)
event->key.state |= GDK_MOD1_MASK;
}
return state;
}
-
static void
build_keypress_event (GdkWindowWin32Data *windata,
GdkEvent *event,
MSG *xevent)
{
HIMC hIMC;
- gint i, bytesleft, bytecount, ucount, ucleft, len;
+ gint i, bytecount, ucount, ucleft, len;
guchar buf[100], *bp;
wchar_t wbuf[100], *wcp;
event->key.type = GDK_KEY_PRESS;
event->key.time = xevent->time;
+ event->key.state = 0;
if (xevent->message == WM_IME_COMPOSITION)
{
}
else
{
- if (xevent->message == WM_CHAR)
+ if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
{
bytecount = MIN ((xevent->lParam & 0xFFFF), sizeof (buf));
for (i = 0; i < bytecount; i++)
}
if (ucount == 0)
event->key.keyval = GDK_VoidSymbol;
- else if (xevent->message == WM_CHAR)
+ else if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
if (xevent->wParam < ' ')
- event->key.keyval = xevent->wParam + '@';
+ {
+ event->key.keyval = xevent->wParam + '@';
+ /* This is needed in case of Alt+nnn or Alt+0nnn (on the numpad)
+ * where nnn<32
+ */
+ event->key.state |= GDK_CONTROL_MASK;
+ }
else
event->key.keyval = gdk_unicode_to_keyval (wbuf[0]);
- else
- event->key.keyval = GDK_VoidSymbol;
build_key_event_state (event);
+ /* Build UTF-8 string */
ucleft = ucount;
len = 0;
wcp = wbuf;
event->key.type = GDK_KEY_RELEASE;
event->key.time = xevent->time;
+ event->key.state = 0;
- if (xevent->message == WM_CHAR)
+ if (xevent->message == WM_CHAR || xevent->message == WM_SYSCHAR)
if (xevent->wParam < ' ')
event->key.keyval = xevent->wParam + '@';
else
doesnt_want_key (gint mask,
MSG *xevent)
{
- return (((xevent->message == WM_KEYUP
- || xevent->message == WM_SYSKEYUP)
+ return (((xevent->message == WM_KEYUP || xevent->message == WM_SYSKEYUP)
&& !(mask & GDK_KEY_RELEASE_MASK))
||
- ((xevent->message == WM_KEYDOWN
- || xevent->message == WM_SYSKEYDOWN)
+ ((xevent->message == WM_KEYDOWN || xevent->message == WM_SYSKEYDOWN)
&& !(mask & GDK_KEY_PRESS_MASK)));
}
#endif
}
+static char *
+decode_key_lparam (LPARAM lParam)
+{
+ static char buf[100];
+ char *p = buf;
+
+ if (HIWORD (lParam) & KF_UP)
+ p += sprintf (p, "KF_UP ");
+ if (HIWORD (lParam) & KF_REPEAT)
+ p += sprintf (p, "KF_REPEAT ");
+ if (HIWORD (lParam) & KF_ALTDOWN)
+ p += sprintf (p, "KF_ALTDOWN ");
+ if (HIWORD (lParam) & KF_EXTENDED)
+ p += sprintf (p, "KF_EXTENDED ");
+ p += sprintf (p, "sc%d rep%d", LOBYTE (HIWORD (lParam)), LOWORD (lParam));
+
+ return buf;
+}
+
static gboolean
gdk_event_translate (GdkEvent *event,
MSG *xevent,
POINT pt;
MINMAXINFO *lpmmi;
HWND hwnd;
+ HCURSOR xcursor;
GdkWindow *window, *orig_window, *newwindow;
GdkColormapPrivateWin32 *colormap_private;
GdkEventMask mask;
{
case WM_INPUTLANGCHANGE:
GDK_NOTE (EVENTS,
- g_print ("WM_INPUTLANGCHANGE: %#x charset %d locale %x\n",
+ g_print ("WM_INPUTLANGCHANGE: %#x charset %d locale %x\n",
xevent->hwnd, xevent->wParam, xevent->lParam));
GDK_WINDOW_WIN32DATA (window)->input_locale = (HKL) xevent->lParam;
TranslateCharsetInfo ((DWORD FAR *) xevent->wParam,
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
GDK_NOTE (EVENTS,
- g_print ("WM_SYSKEY%s: %#x key: %s %#x %#.08x\n",
+ g_print ("WM_SYSKEY%s: %#x %s %#x %s\n",
(xevent->message == WM_SYSKEYUP ? "UP" : "DOWN"),
xevent->hwnd,
(GetKeyNameText (xevent->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
xevent->wParam,
- xevent->lParam));
+ decode_key_lparam (xevent->lParam)));
/* Let the system handle Alt-Tab and Alt-Enter */
if (xevent->wParam == VK_TAB
case WM_KEYUP:
case WM_KEYDOWN:
GDK_NOTE (EVENTS,
- g_print ("WM_KEY%s: %#x key: %s %#x %#.08x\n",
+ g_print ("WM_KEY%s: %#x %s %#x %s\n",
(xevent->message == WM_KEYUP ? "UP" : "DOWN"),
xevent->hwnd,
(GetKeyNameText (xevent->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
xevent->wParam,
- xevent->lParam));
+ decode_key_lparam (xevent->lParam)));
ignore_WM_CHAR = TRUE;
keyup_or_down:
- if (!propagate (&window, xevent,
- k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
- doesnt_want_key))
- break;
+
event->key.window = window;
switch (xevent->wParam)
{
case VK_SHIFT:
/* Don't let Shift auto-repeat */
if (xevent->message == WM_KEYDOWN
- && (xevent->lParam & 0x40000000))
+ && (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
else
event->key.keyval = GDK_Shift_L;
case VK_CONTROL:
/* And not Control either */
if (xevent->message == WM_KEYDOWN
- && (xevent->lParam & 0x40000000))
+ && (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
- else if (xevent->lParam & 0x01000000)
+ else if (HIWORD (xevent->lParam) & KF_EXTENDED)
event->key.keyval = GDK_Control_R;
else
event->key.keyval = GDK_Control_L;
case VK_MENU:
/* And not Alt */
if (xevent->message == WM_KEYDOWN
- && (xevent->lParam & 0x40000000))
+ && (HIWORD (xevent->lParam) & KF_REPEAT))
ignore_WM_CHAR = FALSE;
- else if (xevent->lParam & 0x01000000)
+ else if (HIWORD (xevent->lParam) & KF_EXTENDED)
{
/* AltGr key comes in as Control+Right Alt */
if (GetKeyState (VK_CONTROL) < 0)
event->key.keyval = GDK_Alt_R;
}
else
- event->key.keyval = GDK_Alt_L;
+ {
+ event->key.keyval = GDK_Alt_L;
+ /* This needed in case she types Alt+nnn (on the numpad) */
+ ignore_WM_CHAR = FALSE;
+ }
break;
case VK_PAUSE:
event->key.keyval = GDK_Pause; break;
if (!ignore_WM_CHAR)
break;
+ if (!propagate (&window, xevent,
+ k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
+ doesnt_want_key))
+ break;
+
is_AltGr_key = FALSE;
event->key.type = ((xevent->message == WM_KEYDOWN
|| xevent->message == WM_SYSKEYDOWN) ?
goto wm_char;
case WM_CHAR:
+ case WM_SYSCHAR:
GDK_NOTE (EVENTS,
- g_print ("WM_CHAR: %#x char: %#x %#.08x %s\n",
- xevent->hwnd, xevent->wParam, xevent->lParam,
+ g_print ("WM_%sCHAR: %#x %#x %#s %s\n",
+ (xevent->message == WM_CHAR ? "" : "SYS"),
+ xevent->hwnd, xevent->wParam,
+ decode_key_lparam (xevent->lParam),
(ignore_WM_CHAR ? "ignored" : "")));
if (ignore_WM_CHAR)
break;
-#ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL 0x20a
-#endif
-
case WM_MOUSEWHEEL:
GDK_NOTE (EVENTS, g_print ("WM_MOUSEWHEEL: %#x\n", xevent->hwnd));
if (LOWORD (xevent->lParam) != HTCLIENT)
break;
+
if (p_grab_window != NULL && p_grab_cursor != NULL)
+ xcursor = p_grab_cursor;
+ else if (!GDK_DRAWABLE_DESTROYED (window))
+ xcursor = GDK_WINDOW_WIN32DATA (window)->xcursor;
+ else
+ xcursor = NULL;
+
+ if (xcursor != NULL)
{
- GDK_NOTE (EVENTS, g_print ("...SetCursor(%#x)\n", p_grab_cursor));
- SetCursor (p_grab_cursor);
- }
- else if (!GDK_DRAWABLE_DESTROYED (window)
- && GDK_WINDOW_WIN32DATA (window)->xcursor)
- {
- GDK_NOTE (EVENTS, g_print ("...SetCursor(%#x)\n",
- GDK_WINDOW_WIN32DATA (window)->xcursor));
- SetCursor (GDK_WINDOW_WIN32DATA (window)->xcursor);
+ GDK_NOTE (EVENTS, g_print ("...SetCursor(%#x)\n", xcursor));
+ SetCursor (xcursor);
+ *ret_val_flagp = TRUE;
+ *ret_valp = TRUE;
}
-
- if (window != curWnd)
- synthesize_crossing_events (window, xevent);
-
- *ret_val_flagp = TRUE;
- *ret_valp = FALSE;
break;
case WM_SHOWWINDOW:
goto wintab;
case WT_PROXIMITY:
- GDK_NOTE (EVENTS,
- g_print ("WT_PROXIMITY: %#x %#x %d %d\n",
- xevent->hwnd, xevent->wParam,
- LOWORD (xevent->lParam), HIWORD (xevent->lParam)));
+ GDK_NOTE (EVENTS, g_print ("WT_PROXIMITY: %#x %#x %d %d\n",
+ xevent->hwnd, xevent->wParam,
+ LOWORD (xevent->lParam),
+ HIWORD (xevent->lParam)));
/* Fall through */
wintab:
event->any.window = window;
while (!gdk_event_queue_find_first ()
&& PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
- GDK_NOTE (EVENTS, g_print ("PeekMessage: %#x %#x\n",
- msg.hwnd, msg.message));
+ GDK_NOTE (EVENTS, g_print ("PeekMessage: %#x %s\n",
+ msg.hwnd, gdk_win32_message_name (msg.message)));
if (paimmmpo == NULL
|| (paimmmpo->lpVtbl->OnTranslateMessage) (paimmmpo, &msg) != S_OK)
/* Missing messages */
+#ifndef WM_MOUSEWHEEL
+#define WM_MOUSEWHEEL 0X20A
+#endif
#ifndef WM_GETOBJECT
#define WM_GETOBJECT 0x3D
#endif
#define WM_AFXLAST 0x37F
#endif
+#ifndef CopyCursor
+#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
+#endif
+
#include <gdk/gdkprivate.h>
/* Define corresponding Windows types for some X11 types, just for laziness. */
gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable));
}
+ if (GDK_WINDOW_WIN32DATA (drawable)->xcursor != NULL)
+ DestroyCursor (GDK_WINDOW_WIN32DATA (drawable)->xcursor);
+
g_free (GDK_DRAWABLE_WIN32DATA (drawable));
}
if (0 == hAppIcon)
{
gchar sLoc [_MAX_PATH+1];
- HINSTANCE hInst = GetModuleHandle(NULL);
- if (0 != GetModuleFileName(hInst, sLoc, _MAX_PATH))
+ if (0 != GetModuleFileName(gdk_ProgInstance, sLoc, _MAX_PATH))
{
- hAppIcon = ExtractIcon(hInst, sLoc, 0);
+ hAppIcon = ExtractIcon(gdk_ProgInstance, sLoc, 0);
if (0 == hAppIcon)
{
char *gdklibname = g_strdup_printf ("gdk-%s.dll", GDK_VERSION);
- hAppIcon = ExtractIcon(hInst, gdklibname, 0);
+ hAppIcon = ExtractIcon(gdk_ProgInstance, gdklibname, 0);
g_free (gdklibname);
}
if (!GDK_DRAWABLE_DESTROYED (window))
{
if (!cursor)
- xcursor = LoadCursor (NULL, IDC_ARROW);
+ xcursor = NULL;
else
xcursor = cursor_private->xcursor;
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n",
GDK_DRAWABLE_XID (window), xcursor));
- GDK_WINDOW_WIN32DATA (window)->xcursor = xcursor;
-
- GetCursorPos (&pt);
- if (ChildWindowFromPoint (GDK_DRAWABLE_XID (window), pt) == GDK_DRAWABLE_XID (window))
- SetCursor (xcursor);
+ if (GDK_WINDOW_WIN32DATA (window)->xcursor != NULL)
+ {
+ GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n",
+ GDK_WINDOW_WIN32DATA (window)->xcursor));
+
+ DestroyCursor (GDK_WINDOW_WIN32DATA (window)->xcursor);
+ GDK_WINDOW_WIN32DATA (window)->xcursor = NULL;
+ }
+ if (xcursor != NULL)
+ {
+ /* We must copy the cursor as it is OK to destroy the GdkCursor
+ * while still in use for some window. See for instance
+ * gimp_change_win_cursor() which calls
+ * gdk_window_set_cursor (win, cursor), and immediately
+ * afterwards gdk_cursor_destroy (cursor).
+ */
+ GDK_WINDOW_WIN32DATA (window)->xcursor = CopyCursor (xcursor);
+ GDK_NOTE (MISC, g_print ("...CopyCursor (%#x) = %#x\n",
+ xcursor,
+ GDK_WINDOW_WIN32DATA (window)->xcursor));
+
+ GetCursorPos (&pt);
+ if (ChildWindowFromPoint (GDK_DRAWABLE_XID (window), pt) == GDK_DRAWABLE_XID (window))
+ SetCursor (GDK_WINDOW_WIN32DATA (window)->xcursor);
+ }
}
}