Commit Graph

1118 Commits

Author SHA1 Message Date
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Benjamin Otte
ef5a6835b2 window: Set ALL_EVENT_MASK
This is a trivial commit that does a big change: We now ignore event masks.

Further commits will clean up code, but if bisection ends up here, you
know it's because code is getting delivered events that it weren't getting
before.
2017-11-13 23:41:37 +01:00
Matthias Clasen
f3150c3a43 Typo fix 2017-11-05 19:43:39 -05:00
Matthias Clasen
c08a6a062f Stop using the root window in gdk_window_create_similar_image_surface
Just create a plain image surface if we don't get a window.
This should work just fine and lets us drop another implicit
use of the root window.
2017-11-05 19:30:54 -05:00
Matthias Clasen
de83fc48bf Stop defaulting to the root window in gdk_window_get_geometry
This function is not documented as accepting NULL for the
window, and we don't want to have the root window sneakily
appear in the api like this.
2017-11-05 19:29:49 -05:00
Matthias Clasen
50cf11d398 Make toplevels have parent == NULL
This is a move towards removing root windows as a frontend
gdk concept.
2017-11-05 19:28:37 -05:00
Benjamin Otte
70846c85b3 window: Make icons GdkTextures
Cairo surfaces are bad, mkay?
2017-11-05 00:07:17 +01:00
Benjamin Otte
9323d098a6 gdk: Cursors no longer have a display
Change constructors to reflect that.

While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
2017-11-04 00:07:13 +01:00
Benjamin Otte
9c98adcd15 gdk: Remove GdkWindow.set_device_cursor() vfunc
That one calls through to GdkDevice.set_window_cursor(), so let's just
use that one.
2017-11-02 12:42:58 +01:00
Benjamin Otte
d380cf114b x11: Remove outdated functions from API
We don't want generic APIs that do random stuff on the default X display.
2017-11-02 12:42:58 +01:00
Matthias Clasen
1605d378e5 Don't use GdkScreen here
The GdkScreen api is going away, so avoid using it, both
in code and in documentation.
2017-11-01 19:44:28 -04:00
Matthias Clasen
08bd079938 Remove leftover code
Nothing is setting this object data anymore, so no point
in cleaning it up.
2017-11-01 19:44:28 -04:00
Benjamin Otte
bd6b6ed93c gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
Matthias Clasen
606345cbaa Change the fullscreen-on-monitor api
Use GdkMonitor here, since that is our primary monitor
object now, and GdkScreen is going away.
2017-11-01 14:17:20 -04:00
Matthias Clasen
0411cc5620 Drop GdkVisual
This type was unused except for serving as a parent
for GdkX11Visual. Just move the fields to that type.
2017-10-31 22:44:15 -04:00
Matthias Clasen
67cea50383 Drop gdk_get_default_root_window
This is a trivial convenience function, and it is barely used.
2017-10-31 21:30:59 -04:00
Matthias Clasen
463fba18a6 Port to gdk_display_get_root_window
This is the replacement for the GdkScreen api of the same name.
2017-10-31 21:27:24 -04:00
Matthias Clasen
68a61e9ac6 Drop gdk_screen_get_toplevel_windows 2017-10-31 20:49:50 -04:00
Matthias Clasen
2d6bd1ae6d Drop gdk_window_get_screen
This includes removing the GdkScreen argument from the
create_window_impl display vfunc.
2017-10-31 17:25:01 -04:00
Matthias Clasen
a3cffa5072 Drop GdkScreen from GdkDevice apis
Returning the screen does not add anything here and
GdkScreen is going away.
2017-10-31 12:30:38 -04:00
Andrea Azzarone
b6c41e57e2 gdk: Clear GL context when window is withdrawn
Some clients (e.g. gnome-online-accounts) quickly unmap and map
a window. With some backends the backend surface will be replaced
causing the application to crash because the GL context is still
using the old surface. Clearing the GL context when a window is
withdrawn fixes this.

https://bugzilla.gnome.org/show_bug.cgi?id=789141
2017-10-25 09:37:36 -04:00
Alexander Larsson
d3fc937b4d GtkWindow/GdkWindow: Finish converting icons to surfaces
There were some parts left, for instance gdk_window_set_icon_list.
2017-10-23 13:45:25 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
f3b0a3780e gdk: Coalesce 2 GdkWindow fields in GdkPointerWindowInfo struct
One used to point to the toplevel and the other to the client-side window
that the pointer pointed to. The latter was made to be like the former in
most places, so put those together, and fix the remaining cases where the
variable might not end up with a toplevel/native window.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
0317b0d18d gdk: Remove implicit touch grab accounting
This is not necessary now that there's no client-side windows to track.
The only removed piece that could make sense is emission of grab broken
events, but it's already an stretch since the semantics of those with
multi-touchpoint is unclear.

Anyhow, This should be fixed at the GTK level, while we let GDK deal with
seat/device level grabs.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
44cb3ccfa1 gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
3e1f672170 gdk: Drop generation of synthesized crossing events on grabs
GDK just needs to care about toplevels nowadays, which means these events
are already delivered from the windowing. We don't need to generate
intra-window crossing events ourselves.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
403a724164 gdk: Remove array of event masks
This has been unused since all events are just forwarded instead of
checking client-side windows evmasks.
2017-09-19 18:40:50 +02:00
Georges Basile Stavracas Neto
0bdaebef1e window: Improve detection of edge constraint support
Instead of relying on special values of edge constraints, this
patch adds an internal-only gdk_window_supports_edge_constraints()
function that by default returns FALSE, and is implemented by
GdkWindowWayland and GdkWindowX11.

This way, we can properly detect server-side support for this
feature and adapt accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Rui Matos
e702ee8fa6 gdkwindow: Avoid re-setting the opaque region if it doesn't change
This avoids, at least, needless chatter with the compositor and the X
server in X11's case.

https://bugzilla.gnome.org/show_bug.cgi?id=786469
2017-08-18 19:01:00 +02:00
Matthias Clasen
124b790a77 Fix a bootstrapping problem without root windows
We create various windows during the initial creation of display
objects, which causes some bootstrapping issues when we try to
find the default screen to get its root window. To work around this,
pass the display object into gdk_window_new.

This is not an API change, since gdk_window_new is no longer public API.
2017-08-12 09:42:19 -04:00
Matthias Clasen
0eaf861420 Remove root window getters from public API
These are now just used internally in GDK.
2017-08-11 15:45:24 -04:00
Timm Bäder
5874a30c73 GdkWindow: Remove gdk_window_new_input
Not needed anymore.
2017-08-09 15:19:46 +02:00
Carlos Garnacho
312773a927 gdkwindow: Update cursor for tablet tools in the window
This check must be done explicitly on Wayland as the master device for
tablet tools differ from the Core Pointer. This ensures that whenever a
tablet tool is inside a window and the cursor is programmatically changed,
it will be visually updated too.

https://bugzilla.gnome.org/show_bug.cgi?id=785375
2017-07-26 13:08:50 +02:00
Timm Bäder
bf22dea2ce GdkWindow: Default to unfocused
Don't set the have_focused field of the window's toplevel to TRUE by
default and don't set the FOCUSED state in gdk_window_map. This a means
toplevel window's state is what the WM expects, and the FOCUSED state
will be set anyway when we map the window and receive a _NET_WM_STATE
message.
2017-07-19 21:27:16 -04:00
Carlos Garnacho
3a15c8241e gdk: Remove synthetic crossing event emission due to geometry changes
This just applied to child windows, but now GDK should just take care of
toplevels, which shall get crossing events from the windowing when the right
conditions apply.

Removing this code fixes confused crossing state in widgets and messed up
window_under_pointer tracking (Which now is meant to be toplevels) when any
of the remaining child GdkWindows trigger these crossing events.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
61dd925b32 gdk: Ensure to implicitly deactivate grabs when an impl window is hidden
For some reason this wasn't done on windows with an impl, but it totally should.
Probably hidden by grabs in menus and somesuch being done on a child window.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
f57f48d61f gdkwindow: Drop csw-side event translation
Now that gtk_main_do_event() is able to handle pointing events in toplevel
coordinates, forward all of these as is. Just minimal handling is still done
on the gdk side for GDK grab accounting, and toplevel tracking for each
pointer.
2017-05-25 16:25:58 +02:00
Olivier Fourdan
19ce6a8bc5 gdkwindow: subsurface in gdk_window_get_parent()
When the GtkWidget hierarchy does not match the GdkWindow hierarchy, the
GtkWidget code may find a common ancestor that cannot be found while
traversing the GdkWindow tree using gdk_window_get_parent().

This happens with for example on Wayland, a GtkPopover has another
GtkPopover as parent, in this case, the GdkWindow parent is the root
window, whereas the GtkWidget parent is the other GtkPopover.

That confuses the gtk_widget_translate_coordinates() logic which will
bail out in this case and won't return the translated coordinates.

Make gdk_window_get_effective_parent() aware of subsurfaces and use the
transient_for which represents the actual parent (whereas the parent
might be pointing to the root window).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=774148
2017-03-30 15:46:25 +02:00
Timm Bäder
e1592c599e gdkwindow: Plug memory leak
gdk_drawing_context_get_clip returns a newly allocated cairo_region_t,
so we have to destroy it.
2017-03-02 15:16:08 +01:00
Benjamin Otte
7ade6e3f46 gdk: Remove testing functions
They were unused and unimplemented.
2017-01-08 03:46:30 +01:00
Benjamin Otte
4749eedc08 docs: Remove a line that's not true anymore 2017-01-08 00:48:13 +01:00
Debarshi Ray
339f6e141a Mention that gdk_window_create_similar_image_surface inherits the scale
https://bugzilla.gnome.org/show_bug.cgi?id=776132
2016-12-17 22:50:18 +01:00
Alexander Larsson
330c7feaa2 gdk: Drop gdk_window_reparent
We're not currently using this, and dropping it allows us to loose
a bunch of code which leads us towards the goal of having GdkWindow
only for toplevels (and reparenting makes not sense for toplevels).
2016-12-16 12:35:03 +01:00
Alexander Larsson
5bf28a3869 gdk: Drop support for native (and thus foreign) subwindows
We can't really support these on e.g. wayland anyway, and we're trying
to get rid of subwindow at totally in the long term, so lets drop this.
It allows us to drop a lot of complexity.
2016-12-16 12:28:44 +01:00
Benjamin Otte
b6227aa998 gdk: Add GDK_VULKAN env variable
Also add 2 flags:

GDK_VULKAN="disable" will disable Vulkan usage.

GDK_VULKAN="validate" will enable VK_LAYER_LUNARG_standard_validation.
2016-12-09 18:35:51 +01:00
Benjamin Otte
6d1d6e6792 vulkan: Add more infrastructure
gdk_window_create_vulkan_context() now exists and will return a Vulkan
context for the given window. It even initializes the surface. But it
doesn't do anything useful yet.
2016-12-09 18:35:51 +01:00
Benjamin Otte
ca78f5d3cb gdk: Make gdk_window_begin_draw_frame() take a draw context
... instead of a gl context.

This requires some refactoring in the way we mark the shared context as
drawing: We now call begin_frame/end_frame() on it and ignore the call
on the main context.
Unfortunately we need to do this check in all vfuncs, which sucks. But I
haven't found a better way.
2016-12-05 15:02:47 +01:00