Commit Graph

830 Commits

Author SHA1 Message Date
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Michael Natterer
427b88f541 GdkScreen: fix precondition checks in the public API
Move g_return_if_fail() stuff from the backends to the public
functions in gdkscreen.c itself, and some fixes for ugly formatting in
the various gdkscreen-backend.c files.
2012-02-21 17:19:35 +01:00
Dieter Verfaillie
fe1907708c win32: fix gdk_win32_window_raise
When calling gtk_window_present(), gdk_win32_window_raise did not
actually raise the window anymore. Replacing BringWindowToTop() with
SetForegroundWindow() fixes this.

During testing, we also discovered that sometimes SetForeGroundWindow()
will (correctly) refuse to raise the window and fail(for example: sometimes
when dragging a different application at the time of a gtk_window_present()
call). To prevent a GdkWarning from being produced, usage of the API_CALL
macro has been removed for this case.

Additional goodies of SetForeGroundWindow:
- it brings the window to the front when the process owning the
  window to raise is the foreground process (for example when
  gtk_window_present is called from a GtkStatusIcon's activate
  signal handler)
- it limits itself to flashing the task bar button associated
  with the window if the process owning the window to raise
  is *not* the foreground process (for example when gtk_window_present
  is called from a g_timeout_add callback function)

https://bugzilla.gnome.org/show_bug.cgi?id=665760
2012-01-25 20:32:50 +01:00
Matthias Clasen
c6df2828b7 Add gdk_screen_get_monitor_workarea
The function returns the part of a monitors area that should be
used for positioning popups, menus, etc. The only non-trivial
implementation atm is in the X backend, all the other backends
just return the full monitor area. The X implementation is
currently suboptimal, since it requires roundtrips to collect
the necessary information. It should be changed to monitor
the properties for changes, when XFixes allows to monitor
individual properties.
https://bugzilla.gnome.org/show_bug.cgi?id=641999
2011-12-18 14:29:16 -05:00
Alexander Larsson
62b505174f win32: Make all GDK_WINDOW_TEMP always on top
This makes menus, popups and tooltips show above the windows
task bar.
2011-11-25 11:22:59 +01:00
Alexander Larsson
9275b87b6a win32: Don't double free stuff when finalizing drag context
We were freeing stuff that was already freed in the parent class
finalizer.
2011-11-21 15:03:53 +01:00
Alexander Larsson
0d94b974b3 win32: Don't dereference keyboard_grab if it is NULL
This fixes a crash in e.g. testdnd
2011-11-21 14:37:57 +01:00
Alexander Larsson
4760b3e2bd win32: Make gdk_drag_context_new static 2011-11-21 14:34:06 +01:00
Dieter Verfaillie
2fb8b97b65 win32: get rid of GdkDragContextPrivateWin32 and related machinery.
This turns GdkWin32DragContext into a proper GdkDragContext subclass.
Because we now correctly initialize GdkWin32DragContext in
gdk_drag_context_new, we no longer crash immediatly when a DnD
operation is initialized (the find_window, drag_status, ... vfuncs
where all pointing to 0x0 instead of their proper win32 implementations).

We now try to consistently refer to GdkDragContext as "context",
GdkWin32DragContext as "win32_context" and the ole2 related
target_drag_context and source_drag_context as "ctx".

Members of GdkWin32DragContext only used by the ole2 DnD codepaths
are now explicitly marked with a ole2_dnd_ prefix.
2011-11-21 14:34:06 +01:00
Alexander Larsson
361fcabbde win32: make fixup_event correctly ref all GdkWindow members
This fixes some crashes related to owner changes and selections.
2011-11-17 12:25:56 +01:00
Alexander Larsson
a2b879fe53 win32: Make grab cursors work again 2011-11-10 21:32:50 +01:00
Alexander Larsson
2f14732b1d win32: Fix gdk_win32_window_translate
We now do proper handling of existing invalid regions, and
we use ScrollDC which allows us to specify the right clip
region rather than just the bounding rect.
2011-11-10 17:41:13 +01:00
Dieter Verfaillie
68d28aad97 win32: fix pasting screenshots taken with PrintScreen or Alt+PrintScreen
These are found on the clipboard in the biCompression == BI_BITFIELDS &&
biBitCount >= 16 format. In this case the BITMAPINFOHEADER is followed
by three DWORD specifying the masks of the red green and blue components,
but bfOffBits was not being adjusted accordingly.

Based on Massimo's comment on bug 631384 and verified on
http://msdn.microsoft.com/en-us/library/dd183386%28v=VS.85%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=631384
2011-11-10 17:41:12 +01:00
Dieter Verfaillie
4e10d9604b win32: fix some typos 2011-11-10 17:41:12 +01:00
Alexander Larsson
52be8cb9e9 win32: Fix some warnings 2011-11-10 17:41:11 +01:00
Alexander Larsson
65002208b9 win32: Ensure newly mapped toplevels are inside the workarea
This is what e.g. metacity does, and its needed to e.g. get the inital
position of the gimp dock window right.
2011-11-10 17:41:10 +01:00
Alexander Larsson
c563765574 win32: Fix placement at initial position
Positioning windows at 0,0 post creation failed, because it
was mapped with CW_USEDFAULT, but private->x/y still said 0,
so moving it to 0,0 did nothing. We now always position the
window at the right place, even when not mapped, but we
create it at CW_USEDEFAULT initially and store that position
before moving it to the right place.

This fixes the window sizing test in testgtk and the inital
position for the gimp toolbar.
2011-11-10 17:41:10 +01:00
Alexander Larsson
d441044569 win32: Fix synaptics trackpad issues
The synaptics trackpad driver has some weird behaviour on scroll.
It pops up a window over the mouse pointer (looking like a scrollbar).
This has two problems:
* We get extra enter/leave events for the trackpad window
* We get back the trackpad window when we look for the window
  under the mouse to deliver the mousewheel message.

So, we add some trackpad specific hacks to avoid this (sigh) based
on the trackpad window window class.

This fixes bug #542777 and was partially based on a patch there
from Peter Clifton.
2011-11-10 17:41:09 +01:00
Alexander Larsson
487ace0aca win32: Add gdk_win32_window_get_impl_hwnd
This is needed to fix the ms-windows theme not to create
native windows for all child windows.
2011-11-10 17:41:08 +01:00
Alexander Larsson
1737ffeeb9 win32: Fix modal_hint handling
Modal hints are not really a stack. All windows that are modal
are allowed to get input, not just the top one.

This fixes bug #604156
2011-11-10 17:41:07 +01:00
Alexander Larsson
2788efeb5e win32: Don't use API_CALL for SetWindowLong
This can return 0 without it being an error.
Should fix the last issue with bug #142874
2011-11-10 17:41:07 +01:00
Alexander Larsson
a1828e8b60 win32: Make flush/sync work like in X
gdk_flush() should gdk_display_sync() on all open displays.

Both for display_flush and display_sync it seems useful to call
GdiFlush, but we don't have anything extra to do for display_sync,
as there is no inherent roundtrip on win32.

This should close bug #84314
2011-11-10 17:41:06 +01:00
Alexander Larsson
d27b402a85 win32: Add custom placements for some window types
Windows with transients: center on parent
Splash screens: center on monitor
Also properly ignores initial moves of unmapped
windows that are not override redirect or HINT_POS

Fixes bugs #324254 and #612359
2011-11-10 17:41:06 +01:00
Alexander Larsson
2662fe37df win32: More robust way to ensure we get a configure event after move/resize
There were still cases where we didn't get a WINDOWPOSCHANGED after
a SetWindowPos() call, like e.g. with a larger minimum size than
the set size (bug #574935)

So, we revert the previous fix and now just always manually emit
a configure notify after the move_resize call. Also, we inhibit
the WINDOWPOSCHANGED configure event during the move_resize operation
to avoid multiple Configures.
2011-11-10 17:41:05 +01:00
Alexander Larsson
2dbc05f756 win32: Ensure we always send a configure event when changing size/pos
There are some cases where we don't get a WINDOWPOSCHANGE such that
we generate a configure event, even if we called gdk_window_move_resize()
or similar. For instance:
* The window is fullscreen
* The window is maximized
* The specified pos/size is the same as the current one

However, as per X11 ConfigureNotify semantics we *always* want one, or
we could run into issue like e.g. bug #537296 where we're waiting for
the CONFIGURE to call gdk_window_thaw_toplevel_updates_libgtk_only().
2011-11-10 17:41:04 +01:00
Alexander Larsson
4c061a5270 win32: By default, allow windows larger than the screen 2011-11-10 17:41:04 +01:00
Alexander Larsson
6be876cdea win32: Fix size or style changes during fullscreen
When we're fullscreen we should update the cached hints, and we
should not apply the normal hints to the style.

This fixes bug #516822
2011-11-10 17:41:03 +01:00
Alexander Larsson
820721500b win32: Use WM_NCDESTROY instead of WM_DESTROY
WM_NCDESTROY gets called after children are destroyed, which is
the semantics DestroyNotify has in X11.
2011-11-10 17:41:03 +01:00
Alexander Larsson
4690aa28d0 win32: Don't remove the window from the handle table on destroy
We always get the WM_DESTROY message anyway, and we remove it there.
Bug #336416 even claims this could be a leak if the WM_DESTROY
message was not seen before the DestroyWindow call returned, as
the WM_DESTROY message could not be handled later without the
window in the handle table. I'm not sure this can happen, but we
might as well remove it.
2011-11-10 17:41:02 +01:00
Alexander Larsson
725379192d win32: Make set_keep_above work also for non-mapped windows
This fixes bug #171456
2011-11-10 17:41:01 +01:00
Alexander Larsson
ab615105b6 win32: Send window-state-changes before configure events
This is requires to that the state of the window is right when
you get the configure event (and to match what X does).

Fixes bug #169811
2011-11-10 17:41:01 +01:00
Alexander Larsson
8f50944904 win32: Send initial configure
We need to send a configure event when a window is shown.
2011-11-10 17:41:00 +01:00
Alexander Larsson
36a28d616f win32: Ignore client requested window move/size during SIZEMOVE
This will just be fighting the user like in e.g.
https://bugzilla.gnome.org/show_bug.cgi?id=64428
2011-11-10 17:41:00 +01:00
Alexander Larsson
538ab4fca7 win32: Remove most special casing of WINPOSCHANGED during modal ops
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.
2011-11-10 17:40:59 +01:00
Alexander Larsson
429bd4e5d5 win32: Fix missed resize exit message
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.
2011-11-10 17:40:59 +01:00
Alexander Larsson
ad374a595c win32: Handle all window changes in WINDOWPOSCHANGED
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.
2011-11-10 17:40:58 +01:00
Alexander Larsson
66f7e5d163 win32: Fix up window_show
We don't pass in raise anymore, but already_mapped.
Also, already_mapped must be used rather than MAPPED, as we already
synthesize the MAPPED in the generic code (and thus we don't have
to synthesize it again).
2011-11-10 17:40:57 +01:00
Dieter Verfaillie
1df95b4c0a win32: Call GetQueueStatus instead of PeekMessage PM_NOREMOVE
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
2011-11-10 17:40:55 +01:00
Alexander Larsson
d66ad8c39d win32: Better crossing events and grab destination reporting
We new report to the right window during !owner_event grabs, and
we send proper enter and leave events.
2011-11-10 17:40:55 +01:00
Alexander Larsson
73c527aef0 win32: Record the native event mask in use 2011-11-10 17:40:54 +01:00
Alexander Larsson
321acc3286 win32: in window_at_pointer, ensure that we handle non-client areas correctly
We should not return a window if the pointer is in the non-client area,
like the titlebar.
2011-11-10 17:40:53 +01:00
Alexander Larsson
f0f7c07f4d win32: Handle implicit grabs 2011-11-10 17:40:53 +01:00
Alexander Larsson
6668ba6914 win32: Update input device code to use the new property names in constructor 2011-11-10 17:40:52 +01:00
Alexander Larsson
ade6d093e2 win32: Fix up initialization order of input subsystem
We were getting warnings due to windows being created before input
subsystems were fully initialized.
2011-11-10 17:40:51 +01:00
Dieter Verfaillie
5406955f7c win32: Fix DnD when drag icon is below the pointer
By reverting gdk_drag_find_window_for_screen logic to what it was
before eb21a7df29.
The old logic knew how to ignore drag_window when searching
for dest_window, but that code was removed (I guess by accident).

https://bugzilla.gnome.org/show_bug.cgi?id=616544
2011-11-10 17:40:51 +01:00
Dieter Verfaillie
86b8a1ddc8 win32: dnd should not be registerd for offscreen windows
https://bugzilla.gnome.org/show_bug.cgi?id=616544
2011-11-10 17:40:50 +01:00
Peter Clifton
05e982a11a Win32: Fix _gdk_windowing_window_at_pointer to correctly return a toplevel
Commit 5ebb32d1ff didn't add the correct
code to find the toplevel window. The WindowFromPoint() function does
not return the toplevel window in the hierarchy, it returns the deepest
non-disabled, non-invisible child. As we don't use invisible or disabled
windows, we don't actually need to use the ChildWindowFromPoint walk for
the non get_toplevel case, so we can remove that code path.

To find a toplevel, we need to start from the desktop and work up, using
ChildWindowFromPointEx (to ignore invisible and disabled windows). If we
don't ignore invisible and disabled windows (as is the case with the
ChildWindowFromPoint call, we are liable to get returns of hidden or
disabled children of the desktop which don't belong to us, but notionally
occupy the same area under the pointer.

An alternative might be to start our walk with one of the children of the
desktop owned by our process and thread - which we can enumerate using,
the EnumThreadWindows call, or (presumably) determine internally. This
would not work when we are inside a GtkSocket though, as the children of
the desktop would belong to the process owning the GtkPlug - we would
have to rely on our own list of windows.

For correctness, this commit adds tests to ensure that we don't try to
return either x or y window coordinates if that corresponding pointer is
NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=658842
2011-11-10 17:40:50 +01:00
Peter Clifton
f9d8f9758b Win32: Ensure native back-end for windows where the user requests their handle
https://bugzilla.gnome.org/show_bug.cgi?id=658841
2011-11-10 17:40:49 +01:00
Chun-wei Fan
b18718ac7e Add G_ENABLE_DEBUG #ifdef check in gdkdisplay-win32.c
Commit 88707e6912 used
_gdk_win32_cf_to_string, which is only defined when G_ENABLE_DEBUG
is defined, so add G_ENABLE_DEBUG #ifdef around that part.
2011-11-10 17:40:49 +01:00
Marc-André Lureau
1afc29d869 win32: resurect Windows clipboard selection notification
This is a rewrite of e6fa7394ba, with
misc fixes that should help with some bugs Tim was talking about.

https://bugzilla.gnome.org/show_bug.cgi?id=652239
2011-11-10 17:40:48 +01:00