/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998-1999 Tor Lillqvist
+ * Copyright (C) 1998-2002 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include "config.h"
-
/* Cannot use TrackMouseEvent, as the stupid WM_MOUSELEAVE message
* doesn't tell us where the mouse has gone. Thus we cannot use it to
* generate a correct GdkNotifyType. Pity, as using TrackMouseEvent
#include <stdio.h>
+#include "gdk.h"
#include "gdkprivate-win32.h"
+#include "gdkinput-win32.h"
+#include "gdkkeysyms.h"
#include <objbase.h>
+
+#if defined (__GNUC__) && defined (HAVE_DIMM_H)
+/* The w32api imm.h clashes a bit with the IE5.5 dimm.h */
+# define IMEMENUITEMINFOA hidden_IMEMENUITEMINFOA
+# define IMEMENUITEMINFOW hidden_IMEMENUITEMINFOW
+#endif
+
#include <imm.h>
+#if defined (__GNUC__) && defined (HAVE_DIMM_H)
+# undef IMEMENUITEMINFOA
+# undef IMEMENUITEMINFOW
+#endif
+
#ifdef HAVE_DIMM_H
#include <dimm.h>
-#else
-#include "surrogate-dimm.h"
#endif
-#include "gdk.h"
-#include "gdkinternals.h"
-#include "gdkinput-win32.h"
-
-#include "gdkkeysyms.h"
-
-#define PING() printf("%s: %d\n",__FILE__,__LINE__),fflush(stdout)
-typedef struct _GdkIOClosure GdkIOClosure;
typedef struct _GdkEventPrivate GdkEventPrivate;
typedef enum
GDK_EVENT_PENDING = 1 << 0
} GdkEventFlags;
-struct _GdkIOClosure
-{
- GdkInputFunction function;
- GdkInputCondition condition;
- GdkDestroyNotify notify;
- gpointer data;
-};
-
struct _GdkEventPrivate
{
GdkEvent event;
static gboolean ignore_wm_char = FALSE;
static gboolean is_altgr_key = FALSE;
+#ifdef HAVE_DIMM_H
static IActiveIMMApp *active_imm_app = NULL;
static IActiveIMMMessagePumpOwner *active_imm_msgpump_owner = NULL;
+#endif
typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
static PFN_TrackMouseEvent track_mouse_event = NULL;
GdkEvent *eventp;
MSG msg;
DWORD pos;
+#ifdef HAVE_DIMM_H
LRESULT lres;
+#endif
gint ret_val;
gboolean ret_val_flag;
return ret_val;
else
{
+#ifndef HAVE_DIMM_H
+ return DefWindowProc (hwnd, message, wparam, lparam);
+#else
if (active_imm_app == NULL
|| (*active_imm_app->lpVtbl->OnDefWindowProc) (active_imm_app, hwnd, message, wparam, lparam, &lres) == S_FALSE)
return DefWindowProc (hwnd, message, wparam, lparam);
else
return lres;
+#endif
}
}
LRESULT CALLBACK
-gdk_window_procedure (HWND hwnd,
- UINT message,
- WPARAM wparam,
- LPARAM lparam)
+_gdk_win32_window_procedure (HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam)
{
LRESULT retval;
- GDK_NOTE (MISC, g_print ("gdk_window_procedure: %#lx %s\n",
- (gulong) hwnd, gdk_win32_message_name (message)));
+ GDK_NOTE (MISC, g_print ("_gdk_win32_window_procedure: %p %s\n",
+ hwnd, gdk_win32_message_name (message)));
retval = real_window_procedure (hwnd, message, wparam, lparam);
- GDK_NOTE (MISC, g_print ("gdk_window_procedure: %#lx returns %ld\n",
- (gulong) hwnd, retval));
+ GDK_NOTE (MISC, g_print ("_gdk_win32_window_procedure: %p returns %ld\n",
+ hwnd, retval));
return retval;
}
_gdk_events_init (void)
{
GSource *source;
+#ifdef HAVE_DIMM_H
HRESULT hres;
+#endif
#ifdef USE_TRACKMOUSEEVENT
HMODULE user32, imm32;
HINSTANCE commctrl32;
g_source_set_can_recurse (source, TRUE);
g_source_attach (source, NULL);
+#ifdef HAVE_DIMM_H
hres = CoCreateInstance (&CLSID_CActiveIMM,
NULL,
CLSCTX_ALL,
active_imm_msgpump_owner));
(active_imm_msgpump_owner->lpVtbl->Start) (active_imm_msgpump_owner);
}
+#endif
#ifdef USE_TRACKMOUSEEVENT
user32 = GetModuleHandle ("user32.dll");
{
if (!GDK_WINDOW_DESTROYED (window))
{
- GDK_NOTE (EVENTS, g_print ("gdk_pointer_grab: %#lx %s %#lx %s\n",
- (gulong) GDK_WINDOW_HWND (window),
+ GDK_NOTE (EVENTS, g_print ("gdk_pointer_grab: %p %s %p %s\n",
+ GDK_WINDOW_HWND (window),
(owner_events ? "TRUE" : "FALSE"),
- (gulong) hcursor,
+ hcursor,
event_mask_string (event_mask)));
p_grab_mask = event_mask;
p_grab_owner_events = (owner_events != 0);
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- GDK_NOTE (EVENTS, g_print ("gdk_keyboard_grab %#lx\n",
- (gulong) GDK_WINDOW_HWND (window)));
+ GDK_NOTE (EVENTS, g_print ("gdk_keyboard_grab %p\n",
+ GDK_WINDOW_HWND (window)));
if (!GDK_WINDOW_DESTROYED (window))
{
MSG *msg)
{
HIMC himc;
- gint i, bytecount, ucount, ucleft, len;
- guchar buf[100], *bp;
- wchar_t wbuf[100], *wcp;
+ gint i, bytecount, ucount;
+ guchar buf[100];
+ wchar_t wbuf[100];
event->key.type = GDK_KEY_PRESS;
event->key.time = msg->time;
event->key.state = 0;
+ event->key.group = 0; /* ??? */
if (msg->message == WM_IME_COMPOSITION)
{
* to Unicode. Then convert to UTF-8.
* We don't handle the surrogate stuff. Should we?
*/
+ GDK_NOTE (EVENTS, g_print ("ciACP=%d\n", impl->charset_info.ciACP));
ucount = MultiByteToWideChar (impl->charset_info.ciACP,
0, buf, bytecount,
- wbuf, sizeof (wbuf) / sizeof (wbuf[0]));
-
+ wbuf, G_N_ELEMENTS (wbuf));
}
if (ucount == 0)
event->key.keyval = GDK_VoidSymbol;
build_key_event_state (event);
/* Build UTF-8 string */
- ucleft = ucount;
- len = 0;
- wcp = wbuf;
- while (ucleft-- > 0)
+ if (ucount == 1 && wbuf[0] < 0200)
{
- wchar_t c = *wcp++;
-
- if (c < 0x80)
- len += 1;
- else if (c < 0x800)
- len += 2;
- else
- len += 3;
+ event->key.string = g_malloc (2);
+ event->key.string[0] = wbuf[0];
+ event->key.string[1] = '\0';
+ event->key.length = 1;
}
-
- event->key.string = g_malloc (len + 1);
- event->key.length = len;
-
- ucleft = ucount;
- wcp = wbuf;
- bp = event->key.string;
- while (ucleft-- > 0)
+ else
{
- int first;
- wchar_t c = *wcp++;
-
- if (c < 0x80)
- {
- first = 0;
- len = 1;
- }
- else if (c < 0x800)
- {
- first = 0xc0;
- len = 2;
- }
- else
- {
- first = 0xe0;
- len = 3;
- }
-
-#if 1
- /* Woo-hoo! */
- switch (len)
- {
- case 3: bp[2] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
- case 2: bp[1] = (c & 0x3f) | 0x80; c >>= 6; /* Fall through */
- case 1: bp[0] = c | first;
- }
-#else
- for (i = len - 1; i > 0; --i)
- {
- bp[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
- bp[0] = c | first;
-#endif
-
- bp += len;
+ event->key.string = _gdk_ucs2_to_utf8 (wbuf, ucount);
+ event->key.length = strlen (event->key.string);
}
- *bp = 0;
}
static void
event->key.type = GDK_KEY_RELEASE;
event->key.time = msg->time;
event->key.state = 0;
+ event->key.group = 0; /* ??? */
if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
if (msg->wParam < ' ')
CASE (GDK_NO_EXPOSE);
CASE (GDK_SCROLL);
CASE (GDK_WINDOW_STATE);
+ CASE (GDK_SETTING);
#undef CASE
}
- g_print ("%#lx ", (gulong) GDK_WINDOW_HWND (event->any.window));
+ g_print ("%p ", GDK_WINDOW_HWND (event->any.window));
switch (event->any.type)
{
gdk_window_ref (current_window);
}
+#if 0
+
+static GList *
+get_descendants (GdkWindow *window)
+{
+ GList *list = gdk_window_get_children (window);
+ GList *head = list;
+ GList *tmp = NULL;
+
+ while (list)
+ {
+ tmp = g_list_concat (tmp, get_descendants ((GdkWindow *) list->data));
+ list = list->next;
+ }
+
+ return g_list_concat (tmp, head);
+}
+
+#endif
+
+static void
+synthesize_expose_events (GdkWindow *window)
+{
+ RECT r;
+ HDC hdc;
+ GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ GList *list = gdk_window_get_children (window);
+ GList *head = list;
+ GdkEvent *event;
+ int k;
+
+ while (list)
+ {
+ synthesize_expose_events ((GdkWindow *) list->data);
+ list = list->next;
+ }
+
+ g_list_free (head);
+
+ if (!(hdc = GetDC (impl->handle)))
+ WIN32_GDI_FAILED ("GetDC");
+ else
+ {
+ if ((k = GetClipBox (hdc, &r)) == ERROR)
+ WIN32_GDI_FAILED ("GetClipBox");
+ else if (k != NULLREGION)
+ {
+ event = _gdk_event_new ();
+ event->expose.type = GDK_EXPOSE;
+ event->expose.window = window;
+ gdk_window_ref (window);
+ event->expose.area.x = r.left;
+ event->expose.area.y = r.top;
+ event->expose.area.width = r.right - r.left;
+ event->expose.area.height = r.bottom - r.top;
+ event->expose.region = gdk_region_rectangle (&(event->expose.area));
+ event->expose.count = 0;
+
+ _gdk_event_queue_append (event);
+
+ GDK_NOTE (EVENTS_OR_COLORMAP, print_event (event));
+ }
+ if (!ReleaseDC (impl->handle, hdc))
+ WIN32_GDI_FAILED ("ReleaseDC");
+ }
+}
+
+static void
+update_colors (GdkWindow *window,
+ gboolean top)
+{
+ HDC hdc;
+ GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ GList *list = gdk_window_get_children (window);
+ GList *head = list;
+
+ GDK_NOTE (COLORMAP, (top ? g_print ("update_colors:") : (void) 0));
+
+ while (list)
+ {
+ update_colors ((GdkWindow *) list->data, FALSE);
+ list = list->next;
+ }
+ g_list_free (head);
+
+ if (((GdkWindowObject *) window)->input_only ||
+ impl->colormap == NULL)
+ return;
+
+ if (!(hdc = GetDC (impl->handle)))
+ WIN32_GDI_FAILED ("GetDC");
+ else
+ {
+ GdkColormapPrivateWin32 *cmapp = GDK_WIN32_COLORMAP_DATA (impl->colormap);
+ HPALETTE holdpal;
+ gint k;
+
+ if ((holdpal = SelectPalette (hdc, cmapp->hpal, TRUE)) == NULL)
+ WIN32_GDI_FAILED ("SelectPalette");
+ else if ((k = RealizePalette (hdc)) == GDI_ERROR)
+ WIN32_GDI_FAILED ("RealizePalette");
+ else
+ {
+ GDK_NOTE (COLORMAP,
+ (k > 0 ?
+ g_print (" %p pal=%p: realized %d colors\n"
+ "update_colors:",
+ impl->handle, cmapp->hpal, k) :
+ (void) 0,
+ g_print (" %p", impl->handle)));
+ if (!UpdateColors (hdc))
+ WIN32_GDI_FAILED ("UpdateColors");
+ SelectPalette (hdc, holdpal, TRUE);
+ RealizePalette (hdc);
+ }
+ if (!ReleaseDC (impl->handle, hdc))
+ WIN32_GDI_FAILED ("ReleaseDC");
+ }
+ GDK_NOTE (COLORMAP, (top ? g_print ("\n") : (void) 0));
+}
+
static void
translate_mouse_coords (GdkWindow *window1,
GdkWindow *window2,
}
else
{
- GDK_NOTE (EVENTS, g_print ("...sending to grabber %#lx\n",
- (gulong) GDK_WINDOW_HWND (grab_window)));
+ GDK_NOTE (EVENTS, g_print ("...sending to grabber %p\n",
+ GDK_WINDOW_HWND (grab_window)));
gdk_drawable_unref (*window);
*window = grab_window;
gdk_drawable_ref (*window);
{
/* Grabbed! */
GDK_NOTE (EVENTS,
- g_print ("...sending to grabber %#lx\n",
- (gulong) GDK_WINDOW_HWND (grab_window)));
+ g_print ("...sending to grabber %p\n",
+ GDK_WINDOW_HWND (grab_window)));
gdk_drawable_unref (*window);
*window = grab_window;
gdk_drawable_ref (*window);
gdk_drawable_unref (*window);
*window = GDK_WINDOW (GDK_WINDOW_OBJECT (*window)->parent);
gdk_drawable_ref (*window);
- GDK_NOTE (EVENTS, g_print ("%s %#lx",
+ GDK_NOTE (EVENTS, g_print ("%s %p",
(in_propagation ? "," : " ...propagating to"),
- (gulong) GDK_WINDOW_HWND (*window)));
+ GDK_WINDOW_HWND (*window)));
/* The only branch where we actually continue the loop */
in_propagation = TRUE;
}
return buf;
}
+static void
+erase_background (GdkWindow *window,
+ HDC hdc)
+{
+ HDC bgdc = NULL;
+ HBRUSH hbr = NULL;
+ HPALETTE holdpal = NULL;
+ RECT rect;
+ COLORREF bg;
+ GdkColormap *colormap;
+ GdkColormapPrivateWin32 *colormap_private;
+ int i, j;
+
+ if (GDK_WINDOW_OBJECT (window)->input_only ||
+ GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_NO_BG ||
+ GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
+ return;
+
+ colormap = gdk_drawable_get_colormap (window);
+
+ if (colormap &&
+ (colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR ||
+ colormap->visual->type == GDK_VISUAL_STATIC_COLOR))
+ {
+ int k;
+
+ colormap_private = GDK_WIN32_COLORMAP_DATA (colormap);
+
+ if (!(holdpal = SelectPalette (hdc, colormap_private->hpal, FALSE)))
+ WIN32_GDI_FAILED ("SelectPalette");
+ else if ((k = RealizePalette (hdc)) == GDI_ERROR)
+ WIN32_GDI_FAILED ("RealizePalette");
+ else if (k > 0)
+ GDK_NOTE (COLORMAP, g_print ("gdk_win32_erase_background: realized %p: %d colors\n",
+ colormap_private->hpal, k));
+ }
+
+ while (window && GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
+ {
+ /* If this window should have the same background as the parent,
+ * fetch the parent. (And if the same goes for the parent, fetch
+ * the grandparent, etc.)
+ */
+ window = GDK_WINDOW (GDK_WINDOW_OBJECT (window)->parent);
+ }
+
+ if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
+ {
+ /* Improves scolling effect, e.g. main buttons of testgtk */
+ return;
+ }
+
+ if (GDK_WINDOW_OBJECT (window)->bg_pixmap == NULL)
+ {
+ bg = _gdk_win32_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap,
+ GDK_WINDOW_OBJECT (window)->bg_color.pixel);
+
+ GetClipBox (hdc, &rect);
+ GDK_NOTE (EVENTS,
+ g_print ("...%ldx%ld@+%ld+%ld bg %06lx\n",
+ rect.right - rect.left,
+ rect.bottom - rect.top,
+ rect.left, rect.top,
+ (gulong) bg));
+ if (!(hbr = CreateSolidBrush (bg)))
+ WIN32_GDI_FAILED ("CreateSolidBrush");
+ else if (!FillRect (hdc, &rect, hbr))
+ WIN32_GDI_FAILED ("FillRect");
+ if (hbr != NULL)
+ DeleteObject (hbr);
+ }
+ else if (GDK_WINDOW_OBJECT (window)->bg_pixmap != NULL &&
+ GDK_WINDOW_OBJECT (window)->bg_pixmap != GDK_NO_BG)
+ {
+ GdkPixmap *pixmap = GDK_WINDOW_OBJECT (window)->bg_pixmap;
+ GdkPixmapImplWin32 *pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
+
+ GetClipBox (hdc, &rect);
+
+ if (pixmap_impl->width <= 8 && pixmap_impl->height <= 8)
+ {
+ GDK_NOTE (EVENTS, g_print ("...small pixmap, using brush\n"));
+ if (!(hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (pixmap))))
+ WIN32_GDI_FAILED ("CreatePatternBrush");
+ else if (!FillRect (hdc, &rect, hbr))
+ WIN32_GDI_FAILED ("FillRect");
+ if (hbr != NULL)
+ DeleteObject (hbr);
+ }
+ else
+ {
+ HGDIOBJ oldbitmap;
+
+ GDK_NOTE (EVENTS,
+ g_print ("...blitting pixmap %p (%dx%d) "
+ "all over the place,\n"
+ "...clip box = %ldx%ld@+%ld+%ld\n",
+ GDK_PIXMAP_HBITMAP (pixmap),
+ pixmap_impl->width, pixmap_impl->height,
+ rect.right - rect.left, rect.bottom - rect.top,
+ rect.left, rect.top));
+
+ if (!(bgdc = CreateCompatibleDC (hdc)))
+ {
+ WIN32_GDI_FAILED ("CreateCompatibleDC");
+ return;
+ }
+ if (!(oldbitmap = SelectObject (bgdc, GDK_PIXMAP_HBITMAP (pixmap))))
+ {
+ WIN32_GDI_FAILED ("SelectObject");
+ DeleteDC (bgdc);
+ return;
+ }
+ i = 0;
+ while (i < rect.right)
+ {
+ j = 0;
+ while (j < rect.bottom)
+ {
+ if (i + pixmap_impl->width >= rect.left
+ && j + pixmap_impl->height >= rect.top)
+ {
+ if (!BitBlt (hdc, i, j,
+ pixmap_impl->width, pixmap_impl->height,
+ bgdc, 0, 0, SRCCOPY))
+ {
+ WIN32_GDI_FAILED ("BitBlt");
+ SelectObject (bgdc, oldbitmap);
+ DeleteDC (bgdc);
+ return;
+ }
+ }
+ j += pixmap_impl->height;
+ }
+ i += pixmap_impl->width;
+ }
+ SelectObject (bgdc, oldbitmap);
+ DeleteDC (bgdc);
+ }
+ }
+ else
+ {
+ GDK_NOTE (EVENTS, g_print ("...BLACK_BRUSH (?)\n"));
+ hbr = GetStockObject (BLACK_BRUSH);
+ GetClipBox (hdc, &rect);
+ if (!FillRect (hdc, &rect, hbr))
+ WIN32_GDI_FAILED ("FillRect");
+ }
+}
+
+static GdkRegion *
+_gdk_win32_hrgn_to_region (HRGN hrgn)
+{
+ RGNDATA *rgndata;
+ RECT *rects;
+ GdkRegion *result;
+ gint nbytes;
+ gint i;
+
+ if ((nbytes = GetRegionData (hrgn, 0, NULL)) == 0)
+ {
+ WIN32_GDI_FAILED ("GetRegionData");
+ return NULL;
+ }
+
+ rgndata = (RGNDATA *) g_malloc (nbytes);
+
+ if (GetRegionData (hrgn, nbytes, rgndata) == 0)
+ {
+ WIN32_GDI_FAILED ("GetRegionData");
+ g_free (rgndata);
+ return NULL;
+ }
+
+ result = gdk_region_new ();
+ rects = (RECT *) rgndata->Buffer;
+ for (i = 0; i < rgndata->rdh.nCount; i++)
+ {
+ GdkRectangle r;
+
+ r.x = rects[i].left;
+ r.y = rects[i].top;
+ r.width = rects[i].right - r.x;
+ r.height = rects[i].bottom - r.y;
+
+ gdk_region_union_with_rect (result, &r);
+ }
+
+ g_free (rgndata);
+
+ return result;
+}
+
static gboolean
gdk_event_translate (GdkEvent *event,
MSG *msg,
DWORD pidThis;
PAINTSTRUCT paintstruct;
HDC hdc;
- HDC bgdc;
- HGDIOBJ oldbitmap;
- HBRUSH hbr;
- COLORREF bg;
RECT rect;
POINT pt;
MINMAXINFO *mmi;
HWND hwnd;
HCURSOR hcursor;
+ HRGN hrgn;
/* Invariant:
* window_impl == GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)
window_impl = (window ? GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl) : NULL))
GdkWindow *orig_window, *new_window;
- GdkColormap *colormap;
- GdkColormapPrivateWin32 *colormap_private;
- GdkPixmap *pixmap;
- GdkPixmapImplWin32 *pixmap_impl;
gint xoffset, yoffset;
- int button;
- int i, j;
+ static gint update_colors_counter = 0;
+ gint button;
+ gint k;
gchar buf[256];
- gboolean return_val;
-
- return_val = FALSE;
+ gboolean return_val = FALSE;
if (ret_val_flagp)
*ret_val_flagp = FALSE;
* removed it. Repost the same message to our queue so that
* we will get it later when we are prepared.
*/
- GDK_NOTE(MISC, g_print("gdk_event_translate: %#lx %s posted.\n",
- (gulong) msg->hwnd,
+ GDK_NOTE(MISC, g_print("gdk_event_translate: %p %s posted.\n",
+ msg->hwnd,
msg->message == WM_MOVE ?
"WM_MOVE" : "WM_SIZE"));
/* to translate coordinates to the internal > 16 bit system */
_gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
- if (msg->message == gdk_selection_notify_msg)
- {
- GDK_NOTE (EVENTS, g_print ("gdk_selection_notify_msg: %#lx\n",
- (gulong) msg->hwnd));
-
- event->selection.type = GDK_SELECTION_NOTIFY;
- event->selection.window = window;
- event->selection.selection = msg->wParam;
- event->selection.target = msg->lParam;
- event->selection.property = _gdk_selection_property;
- event->selection.time = msg->time;
-
- return_val = !GDK_WINDOW_DESTROYED (window);
-
- goto done;
- }
- else if (msg->message == gdk_selection_request_msg)
- {
- GDK_NOTE (EVENTS, g_print ("gdk_selection_request_msg: %#lx\n",
- (gulong) msg->hwnd));
-
- event->selection.type = GDK_SELECTION_REQUEST;
- event->selection.window = window;
- event->selection.selection = gdk_clipboard_atom;
- event->selection.target = GDK_TARGET_STRING;
- event->selection.property = _gdk_selection_property;
- event->selection.requestor = (guint32) msg->hwnd;
- event->selection.time = msg->time;
-
- return_val = !GDK_WINDOW_DESTROYED (window);
-
- goto done;
- }
- else if (msg->message == gdk_selection_clear_msg)
- {
- GDK_NOTE (EVENTS, g_print ("gdk_selection_clear_msg: %#lx\n",
- (gulong) msg->hwnd));
-
- event->selection.type = GDK_SELECTION_CLEAR;
- event->selection.window = window;
- event->selection.selection = msg->wParam;
- event->selection.target = msg->lParam;
- event->selection.time = msg->time;
-
- return_val = !GDK_WINDOW_DESTROYED (window);
-
- goto done;
- }
- else if (msg->message == msh_mousewheel_msg)
+ if (msg->message == msh_mousewheel_msg)
{
- GDK_NOTE (EVENTS, g_print ("MSH_MOUSEWHEEL: %#lx %d\n",
- (gulong) msg->hwnd, msg->wParam));
+ GDK_NOTE (EVENTS, g_print ("MSH_MOUSEWHEEL: %p %d\n",
+ msg->hwnd, msg->wParam));
event->scroll.type = GDK_SCROLL;
while (tmp_list)
{
GdkClientFilter *filter = tmp_list->data;
- if (filter->type == msg->message)
+ /* FIXME: under win32 messages are not really atoms
+ * as the following cast suggest, but the appears to be right
+ * Haven't found a use case though ...
+ */
+ if (filter->type == GDK_POINTER_TO_ATOM (msg->message))
{
GDK_NOTE (EVENTS, g_print ("client filter matched\n"));
event->any.window = window;
return_val = TRUE;
event->client.type = GDK_CLIENT_EVENT;
event->client.window = window;
- event->client.message_type = msg->message;
+ /* FIXME: check if the cast is correct, see above */
+ event->client.message_type = GDK_POINTER_TO_ATOM (msg->message);
event->client.data_format = 0;
event->client.data.l[0] = msg->wParam;
event->client.data.l[1] = msg->lParam;
{
case WM_INPUTLANGCHANGE:
GDK_NOTE (EVENTS,
- g_print ("WM_INPUTLANGCHANGE: %#lx charset %lu locale %lx\n",
- (gulong) msg->hwnd, (gulong) msg->wParam, msg->lParam));
+ g_print ("WM_INPUTLANGCHANGE: %p charset %lu locale %lx\n",
+ msg->hwnd, (gulong) msg->wParam, msg->lParam));
window_impl->input_locale = (HKL) msg->lParam;
TranslateCharsetInfo ((DWORD FAR *) msg->wParam,
&window_impl->charset_info,
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
GDK_NOTE (EVENTS,
- g_print ("WM_SYSKEY%s: %#lx %s %#x %s\n",
+ g_print ("WM_SYSKEY%s: %p %s %#x %s\n",
(msg->message == WM_SYSKEYUP ? "UP" : "DOWN"),
- (gulong) msg->hwnd,
+ msg->hwnd,
(GetKeyNameText (msg->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
case WM_KEYUP:
case WM_KEYDOWN:
GDK_NOTE (EVENTS,
- g_print ("WM_KEY%s: %#lx %s %#x %s\n",
+ g_print ("WM_KEY%s: %p %s %#x %s\n",
(msg->message == WM_KEYUP ? "UP" : "DOWN"),
- (gulong) msg->hwnd,
+ msg->hwnd,
(GetKeyNameText (msg->lParam, buf,
sizeof (buf)) > 0 ?
buf : ""),
event->key.state |= GDK_CONTROL_MASK;
if (msg->wParam != VK_MENU && GetKeyState (VK_MENU) < 0)
event->key.state |= GDK_MOD1_MASK;
+ event->key.group = 0; /* ??? */
event->key.string = NULL;
event->key.length = 0;
return_val = !GDK_WINDOW_DESTROYED (window);
if (!use_ime_composition)
break;
- GDK_NOTE (EVENTS, g_print ("WM_IME_COMPOSITION: %#lx %#lx\n",
- (gulong) msg->hwnd, msg->lParam));
+ GDK_NOTE (EVENTS, g_print ("WM_IME_COMPOSITION: %p %#lx\n",
+ msg->hwnd, msg->lParam));
if (msg->lParam & GCS_RESULTSTR)
goto wm_char;
break;
case WM_IME_CHAR:
GDK_NOTE (EVENTS,
- g_print ("WM_IME_CHAR: %#lx bytes: %#.04x\n",
- (gulong) msg->hwnd, msg->wParam));
+ g_print ("WM_IME_CHAR: %p bytes: %#.04x\n",
+ msg->hwnd, msg->wParam));
goto wm_char;
case WM_CHAR:
case WM_SYSCHAR:
GDK_NOTE (EVENTS,
- g_print ("WM_%sCHAR: %#lx %#x %s %s\n",
+ g_print ("WM_%sCHAR: %p %#x %s %s\n",
(msg->message == WM_CHAR ? "" : "SYS"),
- (gulong) msg->hwnd, msg->wParam,
+ msg->hwnd, msg->wParam,
decode_key_lparam (msg->lParam),
(ignore_wm_char ? "ignored" : "")));
/* Return the key release event. */
build_keyrelease_event (window_impl, event, msg);
}
- else if (return_val
- && (window_impl->event_mask & GDK_KEY_PRESS_MASK))
+ else if (return_val && (window_impl->event_mask & GDK_KEY_PRESS_MASK))
{
/* Return just the key press event. */
build_keypress_event (window_impl, event, msg);
buttondown0:
GDK_NOTE (EVENTS,
- g_print ("WM_%cBUTTONDOWN: %#lx (%d,%d)\n",
+ g_print ("WM_%cBUTTONDOWN: %p (%d,%d)\n",
" LMR"[button],
- (gulong) msg->hwnd,
+ msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (GDK_WINDOW_OBJECT (window)->extension_events != 0
buttonup0:
GDK_NOTE (EVENTS,
- g_print ("WM_%cBUTTONUP: %#lx (%d,%d)\n",
+ g_print ("WM_%cBUTTONUP: %p (%d,%d)\n",
" LMR"[button],
- (gulong) msg->hwnd,
+ msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
ASSIGN_WINDOW (find_window_for_pointer_event (window, msg));
case WM_MOUSEMOVE:
GDK_NOTE (EVENTS,
- g_print ("WM_MOUSEMOVE: %#lx %#x (%d,%d)\n",
- (gulong) msg->hwnd, msg->wParam,
+ g_print ("WM_MOUSEMOVE: %p %#x (%d,%d)\n",
+ msg->hwnd, msg->wParam,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
ASSIGN_WINDOW (find_window_for_pointer_event (window, msg));
case WM_NCMOUSEMOVE:
GDK_NOTE (EVENTS,
- g_print ("WM_NCMOUSEMOVE: %#lx x,y: %d %d\n",
- (gulong) msg->hwnd,
+ g_print ("WM_NCMOUSEMOVE: %p x,y: %d %d\n",
+ msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (track_mouse_event == NULL
&& current_window != NULL
break;
case WM_MOUSEWHEEL:
- GDK_NOTE (EVENTS, g_print ("WM_MOUSEWHEEL: %#lx %d\n",
- (gulong) msg->hwnd, HIWORD (msg->wParam)));
+ GDK_NOTE (EVENTS, g_print ("WM_MOUSEWHEEL: %p %d\n",
+ msg->hwnd, HIWORD (msg->wParam)));
event->scroll.type = GDK_SCROLL;
#ifdef USE_TRACKMOUSEEVENT
case WM_MOUSELEAVE:
- GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %#lx\n", (gulong) msg->hwnd));
+ GDK_NOTE (EVENTS, g_print ("WM_MOUSELEAVE: %p\n", msg->hwnd));
if (!(window_impl->event_mask & GDK_LEAVE_NOTIFY_MASK))
break;
break;
#endif
+ case WM_QUERYNEWPALETTE:
+ GDK_NOTE (EVENTS_OR_COLORMAP, g_print ("WM_QUERYNEWPALETTE: %p\n",
+ msg->hwnd));
+ if (gdk_visual_get_system ()->type == GDK_VISUAL_PSEUDO_COLOR)
+ {
+ synthesize_expose_events (window);
+ update_colors_counter = 0;
+ }
+ *ret_val_flagp = TRUE;
+ *ret_valp = FALSE;
+ break;
+
+ case WM_PALETTECHANGED:
+ GDK_NOTE (EVENTS_OR_COLORMAP, g_print ("WM_PALETTECHANGED: %p %p\n",
+ msg->hwnd, (HWND) msg->wParam));
+ *ret_val_flagp = TRUE;
+ *ret_valp = FALSE;
+
+ if (gdk_visual_get_system ()->type != GDK_VISUAL_PSEUDO_COLOR)
+ break;
+
+ if (msg->hwnd == (HWND) msg->wParam)
+ break;
+
+ if (++update_colors_counter == 5)
+ {
+ synthesize_expose_events (window);
+ update_colors_counter = 0;
+ break;
+ }
+
+ update_colors (window, TRUE);
+ break;
+
case WM_SETFOCUS:
case WM_KILLFOCUS:
- GDK_NOTE (EVENTS, g_print ("WM_%sFOCUS: %#lx\n",
+ GDK_NOTE (EVENTS, g_print ("WM_%sFOCUS: %p\n",
(msg->message == WM_SETFOCUS ?
"SET" : "KILL"),
- (gulong) msg->hwnd));
+ msg->hwnd));
if (!(window_impl->event_mask & GDK_FOCUS_CHANGE_MASK))
break;
break;
case WM_ERASEBKGND:
- GDK_NOTE (EVENTS, g_print ("WM_ERASEBKGND: %#lx dc %#x\n",
- (gulong) msg->hwnd, msg->wParam));
+ GDK_NOTE (EVENTS, g_print ("WM_ERASEBKGND: %p dc %#x\n",
+ msg->hwnd, msg->wParam));
if (GDK_WINDOW_DESTROYED (window))
break;
+ erase_background (window, (HDC) msg->wParam);
*ret_val_flagp = TRUE; /* always claim as handled */
*ret_valp = 1;
- if (GDK_WINDOW_OBJECT (window)->input_only)
- break;
-
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
- {
- /* improves scolling effect, e.g. main buttons of testgtk */
- *ret_val_flagp = TRUE;
- *ret_valp = 1;
- break;
- }
-
- colormap = GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap;
- if (colormap)
- colormap_private = GDK_COLORMAP_PRIVATE_DATA (colormap);
- hdc = (HDC) msg->wParam;
- if (colormap && colormap_private->xcolormap->rc_palette)
- {
- int k;
-
- if (SelectPalette (hdc, colormap_private->xcolormap->palette,
- FALSE) == NULL)
- WIN32_GDI_FAILED ("SelectPalette");
- if ((k = RealizePalette (hdc)) == GDI_ERROR)
- WIN32_GDI_FAILED ("RealizePalette");
-#if 0
- g_print ("WM_ERASEBKGND: selected %#x, realized %d colors\n",
- colormap_private->xcolormap->palette, k);
-#endif
- }
-
- if (GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
- {
- /* If this window should have the same background as the
- * parent, fetch the parent. (And if the same goes for
- * the parent, fetch the grandparent, etc.)
- */
- while (window && GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
- {
- gdk_drawable_unref (window);
- ASSIGN_WINDOW (GDK_WINDOW (GDK_WINDOW_OBJECT (window)->parent));
- gdk_drawable_ref (window);
- }
- }
+ break;
- if (GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->position_info.no_bg)
+ case WM_PAINT:
+ if (!GetUpdateRect (msg->hwnd, NULL, FALSE))
{
- /* improves scolling effect, e.g. main buttons of testgtk */
- *ret_val_flagp = TRUE;
- *ret_valp = 1;
+ GDK_NOTE (EVENTS, g_print ("WM_PAINT: %p no update rgn\n",
+ msg->hwnd));
break;
}
- if (GDK_WINDOW_OBJECT (window)->bg_pixmap == NULL)
- {
- bg = gdk_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->colormap,
- GDK_WINDOW_OBJECT (window)->bg_color.pixel);
-
- GetClipBox (hdc, &rect);
- GDK_NOTE (EVENTS,
- g_print ("...%ldx%ld@+%ld+%ld BG_PIXEL %.06lx\n",
- rect.right - rect.left,
- rect.bottom - rect.top,
- rect.left, rect.top,
- (gulong) bg));
- hbr = CreateSolidBrush (bg);
-#if 0
- g_print ("...CreateSolidBrush (%.08x) = %.08x\n", bg, hbr);
-#endif
- if (!FillRect (hdc, &rect, hbr))
- WIN32_GDI_FAILED ("FillRect");
- DeleteObject (hbr);
- }
- else if (GDK_WINDOW_OBJECT (window)->bg_pixmap != NULL &&
- GDK_WINDOW_OBJECT (window)->bg_pixmap != GDK_NO_BG)
- {
- pixmap = GDK_WINDOW_OBJECT (window)->bg_pixmap;
- pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
- GetClipBox (hdc, &rect);
-
- if (pixmap_impl->width <= 8 && pixmap_impl->height <= 8)
- {
- GDK_NOTE (EVENTS, g_print ("...small pixmap, using brush\n"));
- hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (pixmap));
- if (!FillRect (hdc, &rect, hbr))
- WIN32_GDI_FAILED ("FillRect");
- DeleteObject (hbr);
- }
- else
- {
- GDK_NOTE (EVENTS,
- g_print ("...blitting pixmap %#lx (%dx%d) "
- "all over the place,\n"
- "...clip box = %ldx%ld@+%ld+%ld\n",
- (gulong) GDK_PIXMAP_HBITMAP (pixmap),
- pixmap_impl->width, pixmap_impl->height,
- rect.right - rect.left, rect.bottom - rect.top,
- rect.left, rect.top));
-
- if (!(bgdc = CreateCompatibleDC (hdc)))
- {
- WIN32_GDI_FAILED ("CreateCompatibleDC");
- break;
- }
- if (!(oldbitmap = SelectObject (bgdc, GDK_PIXMAP_HBITMAP (pixmap))))
- {
- WIN32_GDI_FAILED ("SelectObject");
- DeleteDC (bgdc);
- break;
- }
- i = 0;
- while (i < rect.right)
- {
- j = 0;
- while (j < rect.bottom)
- {
- if (i + pixmap_impl->width >= rect.left
- && j + pixmap_impl->height >= rect.top)
- {
- if (!BitBlt (hdc, i, j,
- pixmap_impl->width, pixmap_impl->height,
- bgdc, 0, 0, SRCCOPY))
- {
- WIN32_GDI_FAILED ("BitBlt");
- goto loopexit;
- }
- }
- j += pixmap_impl->height;
- }
- i += pixmap_impl->width;
- }
- loopexit:
- SelectObject (bgdc, oldbitmap);
- DeleteDC (bgdc);
- }
- }
- else
- {
- GDK_NOTE (EVENTS, g_print ("...BLACK_BRUSH (?)\n"));
- hbr = GetStockObject (BLACK_BRUSH);
- GetClipBox (hdc, &rect);
- if (!FillRect (hdc, &rect, hbr))
- WIN32_GDI_FAILED ("FillRect");
- }
- break;
-
- case WM_PAINT:
- if (!GetUpdateRect(msg->hwnd, NULL, FALSE))
- {
- GDK_NOTE (EVENTS, g_print ("WM_PAINT: %#lx no update rect\n",
- (gulong) msg->hwnd));
- break;
- }
-
hdc = BeginPaint (msg->hwnd, &paintstruct);
GDK_NOTE (EVENTS,
- g_print ("WM_PAINT: %#lx %ldx%ld@+%ld+%ld %s dc %#lx\n",
- (gulong) msg->hwnd,
+ g_print ("WM_PAINT: %p %ldx%ld@+%ld+%ld %s dc %p\n",
+ msg->hwnd,
paintstruct.rcPaint.right - paintstruct.rcPaint.left,
paintstruct.rcPaint.bottom - paintstruct.rcPaint.top,
paintstruct.rcPaint.left, paintstruct.rcPaint.top,
(paintstruct.fErase ? "erase" : ""),
- (gulong) hdc));
+ hdc));
EndPaint (msg->hwnd, &paintstruct);
if (!(window_impl->event_mask & GDK_EXPOSURE_MASK))
break;
+#if 0 /* we need to process exposes even with GDK_NO_BG
+ * Otherwise The GIMP canvas update is broken ....
+ */
if (GDK_WINDOW_OBJECT (window)->bg_pixmap == GDK_NO_BG)
break;
+#endif
if ((paintstruct.rcPaint.right == paintstruct.rcPaint.left)
|| (paintstruct.rcPaint.bottom == paintstruct.rcPaint.top))
if (return_exposes)
{
+ hrgn = CreateRectRgn (0, 0, 0, 0);
+ if ((k = GetUpdateRgn (msg->hwnd, hrgn, FALSE)) == ERROR)
+ WIN32_GDI_FAILED ("GetUpdateRgn");
+ else if (k == NULLREGION)
+ {
+ DeleteObject (hrgn);
+ break;
+ }
+
event->expose.type = GDK_EXPOSE;
event->expose.window = window;
event->expose.area.x = paintstruct.rcPaint.left;
event->expose.area.y = paintstruct.rcPaint.top;
event->expose.area.width = paintstruct.rcPaint.right - paintstruct.rcPaint.left;
event->expose.area.height = paintstruct.rcPaint.bottom - paintstruct.rcPaint.top;
- event->expose.region = gdk_region_rectangle (&(event->expose.area));
+ event->expose.region = _gdk_win32_hrgn_to_region (hrgn);
event->expose.count = 0;
+ DeleteObject (hrgn);
+
return_val = !GDK_WINDOW_DESTROYED (window);
if (return_val)
{
break;
case WM_GETICON:
- GDK_NOTE (EVENTS, g_print ("WM_GETICON: %#lx %s\n",
- (gulong) msg->hwnd,
+ GDK_NOTE (EVENTS, g_print ("WM_GETICON: %p %s\n",
+ msg->hwnd,
(ICON_BIG == msg->wParam ? "big" : "small")));
break;
case WM_SETCURSOR:
- GDK_NOTE (EVENTS, g_print ("WM_SETCURSOR: %#lx %#x %#x\n",
- (gulong) msg->hwnd,
+ GDK_NOTE (EVENTS, g_print ("WM_SETCURSOR: %p %#x %#x\n",
+ msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (LOWORD (msg->lParam) != HTCLIENT)
if (hcursor != NULL)
{
- GDK_NOTE (EVENTS, g_print ("...SetCursor(%#lx)\n", (gulong) hcursor));
+ GDK_NOTE (EVENTS, g_print ("...SetCursor(%p)\n", hcursor));
SetCursor (hcursor);
*ret_val_flagp = TRUE;
*ret_valp = TRUE;
break;
case WM_SHOWWINDOW:
- GDK_NOTE (EVENTS, g_print ("WM_SHOWWINDOW: %#lx %d\n",
- (gulong) msg->hwnd,
- msg->wParam));
+ GDK_NOTE (EVENTS, g_print ("WM_SHOWWINDOW: %p %d\n",
+ msg->hwnd, msg->wParam));
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK))
break;
case WM_SIZE:
GDK_NOTE (EVENTS,
- g_print ("WM_SIZE: %#lx %s %dx%d\n",
- (gulong) msg->hwnd,
+ g_print ("WM_SIZE: %p %s %dx%d\n",
+ msg->hwnd,
(msg->wParam == SIZE_MAXHIDE ? "MAXHIDE" :
(msg->wParam == SIZE_MAXIMIZED ? "MAXIMIZED" :
(msg->wParam == SIZE_MAXSHOW ? "MAXSHOW" :
break;
#endif
case WM_GETMINMAXINFO:
- GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %#lx\n", (gulong) msg->hwnd));
+ GDK_NOTE (EVENTS, g_print ("WM_GETMINMAXINFO: %p\n", msg->hwnd));
mmi = (MINMAXINFO*) msg->lParam;
if (window_impl->hint_flags & GDK_HINT_MIN_SIZE)
mmi->ptMaxSize.x = MIN(window_impl->hint_max_width, gdk_screen_width ());
mmi->ptMaxSize.y = MIN(window_impl->hint_max_height, gdk_screen_height ());
}
+ else if (window_impl->hint_flags & GDK_HINT_MIN_SIZE)
+ {
+ /* need to initialize */
+ mmi->ptMaxSize.x = gdk_screen_width ();
+ mmi->ptMaxSize.y = gdk_screen_height ();
+ }
+ /* lovely API inconsistence: return FALSE when handled */
+ if (ret_val_flagp)
+ *ret_val_flagp = !(window_impl->hint_flags &
+ (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE));
break;
case WM_MOVE:
- GDK_NOTE (EVENTS, g_print ("WM_MOVE: %#lx (%d,%d)\n",
- (gulong) msg->hwnd,
+ GDK_NOTE (EVENTS, g_print ("WM_MOVE: %p (%d,%d)\n",
+ msg->hwnd,
LOWORD (msg->lParam), HIWORD (msg->lParam)));
if (!(window_impl->event_mask & GDK_STRUCTURE_MASK))
return_val = !GDK_WINDOW_DESTROYED (window);
- GDK_NOTE (EVENTS, g_print ("WM_WINDOWPOSCHANGED: %#lx %ldx%ld@+%ld+%ld\n",
- (gulong) msg->hwnd,
+ GDK_NOTE (EVENTS, g_print ("WM_WINDOWPOSCHANGED: %p %ldx%ld@+%ld+%ld\n",
+ msg->hwnd,
lpwp->cx, lpwp->cy, lpwp->x, lpwp->y));
if (ret_val_flagp)
break;
#endif
case WM_CLOSE:
- GDK_NOTE (EVENTS, g_print ("WM_CLOSE: %#lx\n", (gulong) msg->hwnd));
+ GDK_NOTE (EVENTS, g_print ("WM_CLOSE: %p\n", msg->hwnd));
event->any.type = GDK_DELETE;
event->any.window = window;
flag = FALSE;
GDK_NOTE (EVENTS, flag = TRUE);
if (flag)
- g_print ("WM_%s: %#lx %#x (%s)\n",
+ g_print ("WM_%s: %p %#x (%s)\n",
(msg->message == WM_RENDERFORMAT ? "RENDERFORMAT" :
"RENDERALLFORMATS"),
- (gulong) msg->hwnd,
+ msg->hwnd,
msg->wParam,
(msg->wParam == CF_TEXT ? "CF_TEXT" :
(msg->wParam == CF_DIB ? "CF_DIB" :
#endif /* No delayed rendering */
case WM_DESTROY:
- GDK_NOTE (EVENTS, g_print ("WM_DESTROY: %#lx\n", (gulong) msg->hwnd));
+ GDK_NOTE (EVENTS, g_print ("WM_DESTROY: %p\n", msg->hwnd));
event->any.type = GDK_DESTROY;
event->any.window = window;
* constants as case labels.
*/
case WT_PACKET:
- GDK_NOTE (EVENTS, g_print ("WT_PACKET: %#lx %d %#lx\n",
- (gulong) msg->hwnd,
- msg->wParam, msg->lParam));
+ GDK_NOTE (EVENTS, g_print ("WT_PACKET: %p %d %#lx\n",
+ msg->hwnd, msg->wParam, msg->lParam));
goto wintab;
case WT_CSRCHANGE:
- GDK_NOTE (EVENTS, g_print ("WT_CSRCHANGE: %#lx %d %#lx\n",
- (gulong) msg->hwnd,
- msg->wParam, msg->lParam));
+ GDK_NOTE (EVENTS, g_print ("WT_CSRCHANGE: %p %d %#lx\n",
+ msg->hwnd, msg->wParam, msg->lParam));
goto wintab;
case WT_PROXIMITY:
- GDK_NOTE (EVENTS, g_print ("WT_PROXIMITY: %#lx %#x %d %d\n",
- (gulong) msg->hwnd, msg->wParam,
+ GDK_NOTE (EVENTS, g_print ("WT_PROXIMITY: %p %#x %d %d\n",
+ msg->hwnd, msg->wParam,
LOWORD (msg->lParam),
HIWORD (msg->lParam)));
/* Fall through */
#endif
default:
- GDK_NOTE (EVENTS, g_print ("%s: %#lx %#x %#lx\n",
+ GDK_NOTE (EVENTS, g_print ("%s: %p %#x %#lx\n",
gdk_win32_message_name (msg->message),
- (gulong) msg->hwnd,
- msg->wParam, msg->lParam));
+ msg->hwnd, msg->wParam, msg->lParam));
}
done:
while (!_gdk_event_queue_find_first ()
&& PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
- GDK_NOTE (EVENTS, g_print ("PeekMessage: %#lx %s\n",
- (gulong) msg.hwnd, gdk_win32_message_name (msg.message)));
-
+ GDK_NOTE (EVENTS, g_print ("PeekMessage: %p %s\n",
+ msg.hwnd, gdk_win32_message_name (msg.message)));
+#ifndef HAVE_DIMM_H
+ TranslateMessage (&msg);
+#else
if (active_imm_msgpump_owner == NULL
|| (active_imm_msgpump_owner->lpVtbl->OnTranslateMessage) (active_imm_msgpump_owner, &msg) != S_OK)
TranslateMessage (&msg);
+#endif
#if 1 /* It was like this all the time */
DispatchMessage (&msg);
void
gdk_flush (void)
{
+#if 0
MSG msg;
-#if 0
/* Process all messages currently available */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
- TranslateMessage (&msg); /* Translate virt. key codes */
- DispatchMessage (&msg); /* Dispatch msg. to window */
+ TranslateMessage (&msg);
+ DispatchMessage (&msg);
}
#endif