Commit Graph

1423 Commits

Author SHA1 Message Date
Руслан Ижбулатов
2ace3113d6 GDK W32: Ensure correct stacking of popup windows
1) In the SetWindowPos() function (and the WINDOWPOS struct) the
   "hWndInsertAfter" argument/field means the window that will be
   directly above after the change, not the window that will be
   directly below. MSDN says "precedes" for SetWindowPos(), but
   WINDOWPOS documentation is more precise: this is the window
   behind which the affected window will be placed. Apparently,
   Z-axis goes back-to-front.
   Therefore, logging should be reworded correctly.

2) When we switch away from the application and then switch back
   to a transient window, we need to bring up its transient-owner
   (and its transient-owner's owner and so forth) as well,
   otherwise our transient (modal) window might be transient for
   something that might not be visible.

3) When we bring up a window, we should bring all of its children
   (popup windows) on top of it.
   Because Windows doesn't provide a function to bring one window
   on top of the other, we have to work around this by calling
   SetWindowPos() twice, swapping the windows between the calls.
2019-06-01 19:23:30 +00:00
Matthias Clasen
c7f06dd35e win32: Stop using gdk_event_get_root_coords
It seems we want local coords here anyway.
2019-05-31 23:36:35 +00:00
Matthias Clasen
51396533a1 Fix the win32 build
gdk_display_get_monitor_at_point was used
in this backend.
2019-05-29 18:04:13 +00:00
Matthias Clasen
987e7878a2 Drop gdk_surface_get_frame_extents
No longer used.
2019-05-29 18:04:08 +00:00
Руслан Ижбулатов
84739dde99 GDK W32: Fix indentation and placate GCC 2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
d14e987c6c GDK W32: Correctly log popups 2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
b12d521bce GDK W32: Only use owner windows for popups
GTK4 doesn't have WS_CHILD windows anymore, so hWndParent argument
to CreateWindowEx() is always interpreted as the owner window,
not the parent window.

A window with an owner:
* is above the owner in Z-order
* is destroyed when the owner is destroyed
* is hidden when the owner is minimized
This is enforced by the OS.

GTK can only allow this for popup windows.

Desktop window must never[0] be an owner.

[0]: https://devblogs.microsoft.com/oldnewthing/20040224-00/?p=40493
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
493b30c2a8 GDK W32: No more child windows
We don't have child windows (the window-inside-a-window kind of windows)
anymore. Remove all the code related to that.
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
5ff7c3431b GDK W32: Don't handle WM_ACTIVATE for popup windows
Popups can't be active or inactive, so emitting GDK events
in response to WM_ACTIVATE makes no sense for these kinds
of GDK surfaces.

The jury is still out on whether we should block (return 0)
or ignore (don't return anything) this message.

Blocking WM_NCACTIVATE (which we currently ignore) is definitely
not an option - it completely breaks input somehow.
2019-05-28 20:25:17 +00:00
Руслан Ижбулатов
6ab565b84a GDK W32: Adjust to new popup surfaces
1) Handle GDK_SURFACE_POPUP in RegisterGdkClass()
   (for now pretend it's the same as GDK_SURFACE_TOPLEVEL)

2) Remove useless code from GDK_SURFACE_TOPLEVEL case in _gdk_win32_display_create_surface()
   (now there's just GDK_SURFACE_TOPLEVEL there, no need for a type check)

3) Have a separate case for GDK_SURFACE_POPUP and ensure that
   it doesn't get WS_CHILDWINDOW (and neither should GDK_SURFACE_TEMP).
2019-05-28 20:25:17 +00:00
Matthias Clasen
07b0da615b win32: Disconnect the frame clock
The frame clock can now survive the surface,
so we need to disconnect when the surface goes away.
2019-05-28 20:25:17 +00:00
Matthias Clasen
78c94f9357 win32: Set surface type early enough
We need to set the surface type before
the frame clock.
2019-05-28 20:25:17 +00:00
Matthias Clasen
2c43f87ef7 win32: Set the surface type
This is copying some code from the corresponding
create_surface implementations of the other backends.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
138104de27 GDK W32: Fix the code to compile
Somewhat change the order of initialization (to be closer
to what Wayland backend does).

Also remove the wrapper field that is no longer needed -
it used to hold a pointer to the main GdkWindow instance,
which wrapped GdkWin32ImplWindow. Since impls are gone,
nothing is wrapping anything anymore.

Fix a substitution error, where wrong pointer was added
to the hash table. Added a comment to ensure that future readers
(including myself) won't be confused by the fact that we're
inserting a pointer instead of the handle itself.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
d5e26cdb76 GDK W32: be able to handle NULL cursor 2019-05-28 20:25:16 +00:00
Matthias Clasen
09ec88d0ce win32: Build fixes 2019-05-28 20:25:15 +00:00
Matthias Clasen
d2951d3aac Rename surface constructors
We want to use a gdk_surface_new_popup for popups,
and align the constructor names with the surface
types, so rename

gdk_surface_new_popup -> gdk_surface_new_temp
gdk_surface_new_popup_full -> gdk_surface_new_popup

The temp surface type will disappear eventually.
2019-05-28 20:25:14 +00:00
Matthias Clasen
47fb092393 gdk: Drop GdkWindowAttr
All the information in it is already contained
in the surface object we pass along, and none
of the backend implementations were using the
attributes at all.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2855729cb4 gdk: Drop input-only surfaces
We are not creating such surfaces anymore, and
they were only ever meaningfully implemented
on X11. Drop the concept, and the api for determining
if a surface is input-only.
2019-05-28 20:25:14 +00:00
Matthias Clasen
0f5a6a3927 surface: Small cleanup
Every surface has an impl now, no need to check.
2019-05-28 20:25:14 +00:00
Matthias Clasen
989792cbc0 Drop child surfaces
Drop gdk_surface_child_new and the child surface type,
since we no longer use them. Deprecate surface apis
that only make sense with child surfaces.
2019-05-28 20:25:13 +00:00
Benjamin Otte
143bba075f win32: Remove outdated workaround
The function that was missing in 2016 does exist now.

Fixes gcc complaining about a wrong declaration.
2019-05-21 07:33:57 +02:00
Benjamin Otte
0877b29e8e win32: Actually pass y variable for y parameter 2019-05-21 07:23:30 +02:00
Benjamin Otte
1793546d7a win32: Remove unused variables 2019-05-21 07:23:30 +02:00
Benjamin Otte
7ae675b469 build: Install the backend headers in the backend directories
That's where they are in the sources and we include them from other
headers. So make sure the directories match.
2019-05-06 20:14:53 +02:00
Chun-wei Fan
efed2641f4 Merge branch 'fix-win32-gl-resize' into 'master'
Fix win32 gl resize

See merge request GNOME/gtk!694
2019-04-30 03:35:16 +00:00
Chun-wei Fan
b8127670df Merge branch 'fix-gdkwin32-move-drag' into 'master'
gdksurface-win32.c: Acquire root coordinates on drag/move

See merge request GNOME/gtk!693
2019-04-25 15:44:59 +00:00
Matthias Clasen
51b2759eb1 surface: Drop group api
This was only ever implemented on X11, and
GTK is not using it at all. Relegate it to
x11-specific api.
2019-04-20 02:28:46 +00:00
Matthias Clasen
fed2db1493 window: Drop some x11-specific apis
The skip-taskbar, skip-pager and urgency hints were
only ever implemented for X11, and are not very useful
with modern desktops. Relegate the functionality to
x11 backend api, and drop the GtkWindow api.
2019-04-20 02:28:46 +00:00
Benjamin Otte
0791924bf7 Convert fallthrough comments to G_GNUC_FALLTHROUGH
This way it's very obvious that fallthrough is indeed what we want.

Also bump the glib requirement to 2.59 which introduced
G_GNUC_FALLTHROUGH.
2019-04-15 14:40:25 +02:00
Matthias Clasen
64fd5158bf gdk: Change some async dnd api
The pattern we generally follow is to put the
async result right after the source object, in
finish functions. Do this for gdk_drop_read_finish.
2019-04-02 15:11:06 +00:00
Matthias Clasen
8e4e4401c5 gdk: Change some async clipboard api
The pattern we generally follow is to put the
async result right after the source object, in
finish functions. Do this for gdk_clipboard_read_finish.
2019-04-02 15:10:53 +00:00
Chun-wei Fan
7a45768efe gdkglcontext-win32.c: Fix Resizing and moving
We preiously did not apply the resizes and moves as they were previously
only done in the Cairo drawing context on Win32.  Fix this by applying
this too in the GL drawing context.
2019-04-01 14:51:29 +08:00
Chun-wei Fan
3a56da60dd gdk/win32/gdkcairocontext-win32.c: Make functions shared in backend
Make gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() not static functions, as we
want to use them in gdkglcontext-win32.c, to fix resizing and moving.
2019-04-01 14:51:13 +08:00
Chun-wei Fan
896104939b gdksurface-win32.c: Acquire root coordinates on drag/move
As in commit d45996c, the x and y coordinates passed into begin_drag and
begin_move are no longer root coordinates but are now surface
coordinates.

Use the x and y surface coordinates to acquire the root x and y
coordinates so that resizing and moving can work as expected.
2019-04-01 14:22:38 +08:00
Chun-wei Fan
4784c5a980 gdk/win32/gdkdrag-win32.c: Include math.h
We need that for round().
2019-03-29 16:50:53 +08:00
Matthias Clasen
bbb6772934 win32: Drop set_role
One overlooked (non-)implementation of set_role.
2019-03-27 18:48:59 -04:00
Matthias Clasen
3600d129bf win32: Add a missing include
We are using round() now, so include math.h.
2019-03-27 18:47:56 -04:00
Matthias Clasen
c0aaa43122 Rename gdk_device_get_surface_at_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
9021e7d3cd gdk: Stop using gdk_device_get_surface_at_position
We should always use the double variant.
2019-03-26 18:12:55 -04:00
Matthias Clasen
03eb455c93 Rename gdk_device_get_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
8dece0e940 gdk: Stop using gdk_device_get_position
We should always use the double variant of this api.
2019-03-26 18:12:55 -04:00
Matthias Clasen
21580309d3 Rename gdk_surface_get_device_position_double
Drop the _double suffix, now that the int version is gone.
2019-03-26 18:12:54 -04:00
Matthias Clasen
54a969e0ad gdk: Stop using gdk_surface_get_device_position
Use the double variant instead.
2019-03-26 17:55:29 -04:00
Christoph Reiter
0638dca29a win32: remove another call to gdk_device_warp()
Inline the implementation (untested). To fix the build.
2019-03-26 08:20:07 +01:00
Christoph Reiter
ae68dc7a7d win32: remove unused gdk_display_warp_device
to fix the build
2019-03-26 07:59:01 +01:00
Matthias Clasen
20b4a8b38c Yet another win32 build fix
So much empty warping.
2019-03-25 23:29:34 -04:00
Matthias Clasen
4dfe2a8aa8 Fix the windows build
There was another warp implementation that needed to be removed.
This commit also addresses a number of compiler warnings
in passing.
2019-03-25 20:06:08 -04:00
Matthias Clasen
f2dff5115f win32: Drop the warp implementation
We no longer support pointer warping.
2019-03-25 10:16:14 -04:00
Руслан Ижбулатов
8da56cef79 GDK W32: Fix property setting to correctly use static strings
The strings that are set are static, so g_value_set_static_string() should
be used to set them instead of g_value_set_string().
2019-03-22 16:59:03 +00:00