There is no particular reason to special case this, we want to handle all
sort of normal events. The only special thing we keep is that
as an optimization we pump the message loop extra during a WINPOSCHANGED
in a modal operation as that will cause us to repaint faster.
Also, bump the arbitrary number of mainloop iterations for the timer.
I don't see why we need it at all, but at least doing more than one
iteration if needed should be nice.
When you start a window resize or move via the window menu and
don't actually change anything we're not getting an exitsizemove.
In order to work around this we also look for WM_CAPTURECHANGED.
This moves all the code from WM_SIZE, WM_MOVE, and WM_SHOWWINDOW into
one place, cleans up the code and makes sure we only send a single
configure event even if both size and position changes.
Calling PeekMessage can cause reentrant calls into the window procedure
for sent (as opposed to posted) messages, so its not safe to call
when we're not expecting reentrancy. Instead we call GetQueueStatus
when we're just looking for availible messages.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=552041
TrackMouseEvent is present in user32.dll in all Windows versions we
support. No need to look it up dynamically. No need to fallback to
_TrackMouseEvent from comctrl32.dll.
The button highlighting in testgtk works again, even with
GDK_NATIVE_WINDOWS. Unfortunately testgtk:menus still does
not work for the forced-native-window-case.
WM_KILLFOCUS means that a keyboard grab (not a pointer grab), if any,
has been broken. I don't think this bug has matterd much as gtk
generates a grab-broken-event signal for both keybord and pointer
grabs being broken anyway.
Includes fixing all callers to use the cairo region API instead. This is
usually just replacing the function names, the only difference is
gdk_region_get_rectangles() being replaced by
cairo_region_num_rectangles() and cairo_region_get_rectangle() which
required a bit more work.
https://bugzilla.gnome.org/show_bug.cgi?id=613284
Intermediate commit of work in progress on integrating the old code
for OLE2-based generic drag and drop from Arhaeopteryx Software, from
a long time ago in the GTK+ 1.3 timeframe. Does still not work and is
as before not compiled in unless OLE2_DND is defined in
gdkdnd-win32.c. (Thus, for inter-process DND, still only WM_DROPFILES
style dropping of files on GTK+ apps works.)
Related slight refactoring of other code that shouldn't change how it
works. Add more global variables for run-time constants (once
initialized) representing well-known GdkAtoms and registered Windows
clipboard formats, as they with the generic DND code will be needed in
several source files. Some improved debugging output.
Resurrcetion and adaption of find_window_for_mouse_event(). The window
receiving the WM_MOUSEMOVE, WM_?BUTTONDOWN is not necessarily the one
interested in GDK_(ENTER|MOTION|LEAVE)_NOTIFY
http://bugzilla.gnome.org/show_bug.cgi?id=588373
Also added some more more TODO_CSW and disabled print_event(): it can not
cope with the new _gdk_windowing_got_event() eating/morphing events.
2009-03-17 Tor Lillqvist <tml@novell.com>
Bug 575700 - Crash when moving a GtkWindow
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Fix
embarrassing crasher bug introduced on 2009-03-11. A variable was
assigned a value only inside a GDK_NOTE but still used outside
that.
svn path=/trunk/; revision=22568
2009-03-11 Tor Lillqvist <tml@iki.fi>
Bug 570896 - gdkevents-win32.c(2947) : error C4053: one void
operand for '?:'
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Fix
compilation error with MSVC. While at it add clarifying comments
and fix a typo in the debugging output.
svn path=/trunk/; revision=22515
2009-03-11 Tor Lillqvist <tml@iki.fi>
Bug 574794 - Can not resize shaped windows on Windows
* gdk/win32/gdkevents-win32.c (gdk_event_translate): On handling
WM_WINDOWPOSCHANGED, don't do anything if the position and size
hasn't changed. I am not exactly sure I understand why this helps
this particular bug.
svn path=/trunk/; revision=22511
2009-01-29 Tor Lillqvist <tml@novell.com>
Bug 559408 - Transparency lost when images are copied between GTK+
and the clipboard on Windows
The code in gdkselection-win32.c is simplified quite a lot. When
an image is stored on the clipboard from GTK+, only the "PNG" and
CF_DIB formats are advertised. PNG is our preferred format because
it can losslessly represent any image that gdk-pixbuf can handle,
even with alpha, unambiguously. CF_DIB is also advertised because
of its ubiquitous support in Windows software.
Delayed rendering is used as before, so for other data than text
nothing is actually stored on the clipboard until some app asks
for it.
It's pointless to advertise images formats like "image/png" or
"image/x-MS-bmp" that no other Windows application is going to
look for anyway. Likewise it's pointless to store text under
formats like "text/plain" or "UTF8_STRING". Just store
CF_UNICODETEXT. CF_TEXT will be available as a synthesized format
anyways.
Office 2007 offers and asks for images in PNG format using the
registered clipboard format name "PNG", so we do likewise. If the
"PNG" format is available that is preferred when copying to GTK+
from the clipboard.
Unfortunately Word 2007 still uses CF_DIB without handling
alpha. But PowerPoint 2007 uses PNG if available and handles alpha
correctly. Both Word and Powerpoint offer PNG with alpha nicely.
Firefox and IE7 offer images that contain alpha as 32-bit version
3 BI_RGB DIBs with the undocumented "extra" bytes actually being
alpha. Also, alpha is premultiplied into the RGB bytes, presumably
because that is how AlphaBlend() wants such DIBs. That is also
taken care of. At least for Firefox it easy to be sure that a
CF_DIB on the clipboard is from Firefox.
Also some general stylistic cleanup, comment improvements, and
improvements of debugging printout especially in the clipboard
handling. Those are not detailled below.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c
* gdk/win32/gdkgmain-win32.c: Move some globals that were used
only in gdkselection-win32.c to be local to that file.
* gdk/win32/gdkproperty-win32.c (gdk_property_change): Don't
bother checking if text to be placed on the clipboard consists of
only ASCII.
* gdk/win32/gdkselection-win32.c: Add static variables for a list
of GdkPixbuf-supported formats, well-known registered clipboard
formats for images, and for GdkAtoms for well-known image and text
formats.
(_gdk_win32_selection_init): Initialize above static variables.
(selection_property_store) (gdk_selection_property_get)
(_gdk_selection_property_delete): Don't use a FIFO of GdkSelProps
for a window after all, it breaks testtext. See bug #163844.
(gdk_selection_convert): When converting to the TARGETS format,
i.e. when the caller wants to know what clipboard formats are
available, if PNG is available we report just that and skip
CF_DIB, JPEG and GIF even if advertised.
If CF_UNICODETEXT is available, report only UTF8_STRING.
When converting to the UTF8_STRING format, i.e. when the caller
wants text from the clipboard, try just CF_UNICODETEXT. There is
no point in trying CF_TEXT as Windows will synthesize
CF_UNICODETEXT from CF_TEXT anyway, if some app has stored just
CF_TEXT.
When converting to the image/bmp format, i.e. when the caller
wants an CF_DIB image from the clipboard, we check if the DIB is a
version 3 32-bit BI_RGB one that is likely to actually contain
alpha in the "extra" bytes. Such a DIB is likely to have
premultiplied alpha even, at least in the case of Firefox 3 and
IE7. We then edit the DIB in-place into a version 5 one in
BI_BITFIELDS format and undo the alpha premultiplication.
In any case, prepend a BMP file header before letting go of the
data which will be fed to the gdk-pixbuf bmp loader by upper
levels.
(gdk_win32_selection_add_targets): If some kind of pixmap image
format is being added, actually advertise just PNG and
CF_DIB. Note that alpha won't be stored on the clipboard through
CF_DIB. This is because gdk-pixbuf's bmp loader doesn't save
alpha. Furthermore, few if any non-GTK+ Windows apps seem to
understand a version 5 DIB with proper alpha anyway.
(_gdk_win32_selection_convert_to_dib): Simplified muchly.
svn path=/trunk/; revision=22255
2008-11-04 Tor Lillqvist <tml@novell.com>
Bug 557212 - Problem with which window gains focus and is visible
* gdk/win32/gdkevents-win32.c (ensure_stacking_on_activate_app):
Only do the restacking for the active window of the
application. Seems to fix the problem.
(gdk_event_translate): Only call ensure_stacking_on_activate_app()
when the application is being activated, not deactivated.
svn path=/trunk/; revision=21756
2008-11-01 Tor Lillqvist <tml@novell.com>
Bug 558278 - Crash when calling a callback set by
gdk_add_client_message_filter()
* gdk/win32/gdkevents-win32.c (apply_event_filters): Rename from
apply_filters() so that it is clear that this function is for
GdkEventFilters only.
(print_event): Print more information for GDK_CLIENT_EVENT events.
(gdk_event_translate): When handling client filters, don't use
apply_event_filters(). Use similar code as in the X11 backend,
although not exactly, as the parameter list and return value
semantics of gdk_event_translate() is different.
svn path=/trunk/; revision=21748
2008-10-18 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): On
WM_WINDOWPOSCHANGING, don't dereference windowpos in the debugging
output without setting it first.
2008-10-18 Tor Lillqvist <tml@novell.com>
Bug 556578 - GIMP windows stay on top of other windows
* gdk/win32/gdkevents-win32.c (ensure_stacking_on_unminimize)
(ensure_stacking_on_window_pos_changing)
(ensure_stacking_on_activate_app): Ignore unmapped windows in the
loops where we look for the lowest "transient-type" window.
(gdk_event_translate): Don't call
ensure_stacking_on_window_pos_changing() or
ensure_stacking_on_activate_app() for unmapped windows.
svn path=/trunk/; revision=21676
2008-10-04 Tor Lillqvist <tml@novell.com>
Bug 132501 - Make utility window translate to tool window in win32
Implement the utility window type hint. Such windows are kept on
top of other windows. Makes GIMP's toolbox and dock windows behave
more like in GNOME under metacity. Apply the same logic also to
windows marked with the dialog window type hint, and windows that
are transient for some other window. I'll call such windows
"transient-type" below.
* gdk/win32/gdkevents-win32.c (doesnt_want_key): Drop unused
variables.
(ensure_stacking_on_unminimize)
(ensure_stacking_on_window_pos_changing)
(ensure_stacking_on_activate_app): New functions to implement the
desired stacking order. Make sure that a window that is not
transient-type stays below any transient-type windows of the
application. When activating a non-transient-type window make sure
it rises as high as possible.
(gdk_event_translate): Call above functions on
WM_WINDOWPOSCHANGING, WM_ACTIVATEAPP and on WM_SIZE when
unminimizing. Improve debugging printout.
* gdk/win32/gdkwindow-win32.c (get_effective_window_decorations):
Handle utility windows like toolbar windows.
(gdk_window_new_internal) (update_style_bits): Give utility
windows the WS_EX_TOOLWINDOW extended style.
(gdk_window_set_title): If debugging "misc" or "events", make the
handle of top-level windows show up in their title bars. Very
useful when looking at debugging output.
(gdk_window_set_keep_above) (gdk_window_set_keep_below)
(gdk_window_set_modal_hint) (gdk_window_set_skip_taskbar_hint)
(gdk_window_set_skip_pager_hint): Add and improve debugging
printout.
(gdk_window_set_type_hint): Print hint symbolically in GDK_NOTE().
2008-10-04 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkmain-win32.c (_gdk_win32_window_exstyle_to_string)
(_gdk_win32_window_pos_bits_to_string): New debugging printout
functions. Decode the WS_EX_* and SWP_* bits.
* gdk/win32/gdkprivate-win32.h: Declare them. Define
GDK_DEBUG_MISC_OR_EVENTS for use in GDK_NOTE() to match either
"misc" or "events".
svn path=/trunk/; revision=21587
2008-08-27 Cody Russell <bratsche@gnome.org>
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkwindow-win32.c (show_window_recurse): Check if
the window's state has GDK_WINDOW_STATE_MAXIMIZED set before
calling ShowWindow (), and show using SW_SHOWMAXIMIZED or
SW_RESTORE accordingly. This fixes an issue where maximized
windows that are iconified do not restore back to maximized
when you click the taskbar. (#528975)
svn path=/trunk/; revision=21218
2008-08-21 Cody Russell <bratsche@gnome.org>
* gdk/win32/gdkevents-win32.c (doesnt_want_key): Remove the checks
to see if the window is modally blocked. This doesn't get us anything,
and it confuses the search window in GtkTreeView (and potentially other
utility windows in other apps). (#520165)
svn path=/trunk/; revision=21180
2008-08-05 Tor Lillqvist <tml@novell.com>
Bug 544684 - Win64 issue, window handles are assumed to be 32-bit
* gdk/win32/gdkcursor-win32.c
* gdk/win32/xcursors.h: Change some gchar* to guchar* and vice
versa to avoid gcc 4.4 signedness warnings.
* gdk/win32/gdkevents-win32.c: Add some guchar and char pointer
casts to get rid of gcc 4.4 signedness warnings. Print GdkAtom
values in debugging output using the %p format.
* gdk/win32/gdkkeys-win32.c
* gdk/win32/gdkfont-win32.c
* gdk/win32/gdkmain-win32.c: Add some casts to avoid gcc warnings.
* gdk/win32/gdkwindow-win32.c: Use SetWindowLongPtr() instead of
SetWindowLong().
* gdk/win32/gdkwin32id.c (gdk_handle_hash): Use all 64 bits of a
HANDLE on Win64.
svn path=/trunk/; revision=20994
2008-07-24 Cody Russell <bratsche@gnome.org>
Bug 544510 – SetTimer callback signatures has the wrong type
* gdk/win32/gdkevents-win32.c: Fix modal_timer_proc() and
sync_timer_proc() to use UINT_PTR for the 'id' parameter
instead of 'id'. Patch by Richard Hult.
svn path=/trunk/; revision=20903
2008-07-21 Cody Russell <bratsche@gnome.org>
Bug 153567 – Repaint glitches in widgets
* gdk/win32/gdkevents-win32.c: Set a sync timer when
we receive WM_SYNCPAINT, and RedrawWindow() once
the timer expires.
svn path=/trunk/; revision=20881
2008-07-02 Cody Russell <bratsche@gnome.org>
Bug 541162 – [Win32] Update for the new GdkWindowImpl stuff
* gdk/win32/gdkprivate-win32.h:
* gdk/win32/gdkgeometry-win32.c:
* gdk/win32/gdkevents-win32.c:
* gdk/win32/gdkwindow-win32.c: Update Win32 backend according to
the newly refactored GdkWindow code.
svn path=/trunk/; revision=20729
2008-07-01 Cody Russell <bratsche@gnome.org>
Bug 539164 – Windows' System Menu blocks main loop
* gdk/win32/gdkevents-win32.c: Use a modal timer proc in between
receiving WM_ENTERMENULOOP and WM_EXITMENULOOP and pump the
GLib mainloop from there.
svn path=/trunk/; revision=20726
2008-05-30 Tor Lillqvist <tml@novell.com>
Bug 533108 - leak of GDI region in function 'handle_wm_paint'
* gdk/win32/gdkevents-win32.c (handle_wm_paint): Patch by Daniel
Atallah.
svn path=/trunk/; revision=20250