Commit Graph

1403 Commits

Author SHA1 Message Date
Matthias Clasen
d45996c728 Avoid root coordinates in begin_drag/move apis
Change the all the begin_drag and begin_move apis in
GdkSurface and GtkWindow to expect surface coordinates.

Update the x11 implementation to translate to root
coordinates where it matters. Wayland is ignoring the
coordinates anyway.
2019-03-26 15:57:11 -04:00
Matthias Clasen
558405e1bc window: Update state flags
When the window gets active / inactive, we
don't propagate events, but just send focus-in / -out
to the current focus_widget. Improve this by updating
its state flags as well.
2019-03-19 21:33:38 -04:00
Matthias Clasen
6ddb61119a Use root in gdk_synthesize_crossing_events 2019-03-16 21:30:48 -04:00
Matthias Clasen
888b92674f Move maintaining the focus chain
Put this code in the same place where we generate
the crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4238a04c7b window: Use gtk_synthesize_crossing_events
Emit focus change events in the same way as crossing events.
Also change the code to only emit focus change events for
the master keyboard - we only maintain a single focus location,
so sending multiple focus change events for different devices
seems confusing.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7ca24f12d7 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-16 21:24:45 -04:00
Matthias Clasen
f68855341e window: Remove ::set-focus
The focus-widget is now a property, so we don't need
this signal anymore.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7819a5aab9 Drop gtk_widget_send_focus_change
Replace this with gtk_widget_set_has_focus + gtk_widget_event.
2019-03-16 21:24:44 -04:00
Matthias Clasen
029ec38e63 Move a check to gtk_window_set_focus
gtk_widget_grab_focus is just a wrapper for
gtk_window_set_focus. We should do all the enforcement
there.
2019-03-16 21:24:44 -04:00
Matthias Clasen
bd44831987 window: Implement the root focus api
This just uses the existing get/set_focus functions.
We keep them public for now.
2019-03-16 21:24:44 -04:00
Matthias Clasen
92f1bdcf45 Redo focus handling
GtkWindow has a focus_widget that points to the current input focus.
GtkWidget has a focus_child that points to the child that contains
the input focus. Following the focus_child chain from the toplevel
always leads to the focus_widget. We never unset focus_child, we only
set it. We bubble focus change events.
2019-03-16 21:24:44 -04:00
Benjamin Otte
78d013f8d3 window: Return no item for no item name 2019-02-27 08:53:33 +01:00
Matthias Clasen
b4ae491b45 window: Undo the deprection of gtk_window_present
After considerable discussion, we came to the conclusion
that the convenience of this API wins over the correctness
of gtk_window_present_with_time(), in particular since we
don't have a good mechanism to carry timestamps from the
events to the places where we present windows.
2019-02-26 14:11:16 -05:00
Bastien Nocera
14890fad47 window: Warn when gtk_window_present_with_time() is passed 0
When 0 or GDK_CURRENT_TIME is passed to gtk_window_present_with_time(),
print a warning so that the application developer knows that this isn't
a supported use of the function, but carry on working for now.
2019-02-25 17:38:08 +01:00
Bastien Nocera
5a6a7b50af all: Don't warn about deprecated gtk_window_present usage
Avoid compilation warnings about internal users of gtk_window_present().
2019-02-25 17:38:08 +01:00
Bastien Nocera
8438880906 window: Deprecate gtk_window_present()
And expect gtk_window_present_with_time() to be used instead.
2019-02-25 17:38:08 +01:00
Matthias Clasen
a3901f2563 Drop the anchored field
We can just change priv->root instead.
2019-02-23 09:43:57 -05:00
Piotr Drąg
ffee2d4567 window: Rename GTK+ Inspector in user-visible strings 2019-02-21 17:49:44 +01:00
Benjamin Otte
285aba6ece widget: Make width, height and transform be widget-relative
Previously, those numbers stored the values relative to the margin box
of the widget. Now they store values relative to the content box,
thereby getting rid of the last remains of weird coordinate systems.
2019-02-15 06:53:22 +01:00
Benjamin Otte
86978d2654 widget: Store the render node in the widget's coordinate system
Also require gtk_widget_snapshot() to be in the widget's coordinate
system.
2019-02-15 06:53:17 +01:00
Benjamin Otte
694d7c378b root: Move the renderer to the root 2019-02-15 06:53:17 +01:00
Benjamin Otte
446713fb8b root: Add gtk_root_get_surface_transform()
The function isn't used yet, so this is just infrastructure.
2019-02-15 06:53:17 +01:00
Benjamin Otte
2fbdd8b849 root: Add GtkRoot:get_display vfunc
And use it.
2019-02-15 06:53:17 +01:00
Benjamin Otte
aeda099f47 widget: Remove toplevel flag
Instead, rely on GTK_IS_ROOT().

Also implement GtkRoot on GtkWindow and GtkInvisible, the two widgets
that used to set the toplevel flag before.
2019-02-15 06:53:17 +01:00
Benjamin Otte
e0ec5caaf8 container: Drop gtk_container_check_resize()
Instead, hardcode GtkWindow for now.
The code for non-windows was entirely broken.
2019-02-15 06:53:17 +01:00
Benjamin Otte
2ba928e142 window: Properly detect if size allocation is needed
Instead of looking at the allocation, just look at the alloc_needed
widget flag that tracks if an allocation is needed.
2019-02-15 06:46:04 +01:00
Timm Bäder
14feafe3a9 window: Remove GList link directly
Instead of walking the list again and looking for the GList pointer we
already have.
2019-02-10 10:31:27 +01:00
Timm Bäder
057144cfdd window: Inline function into only caller 2019-02-05 08:11:43 -05:00
Timm Bäder
9b91041025 window: Remove remaining icon_list handling 2019-02-05 08:11:43 -05:00
Timm Bäder
b215384064 window: Remove default_icon_serial
Now unused.
2019-02-05 08:11:43 -05:00
Timm Bäder
e6c5b9348d window: Remove default icon list 2019-02-05 08:11:43 -05:00
Timm Bäder
55b99e9916 window: Remove icon list 2019-02-05 08:11:43 -05:00
Timm Bäder
e82d97f069 window: Remove set_default_icon 2019-02-05 08:11:43 -05:00
Timm Bäder
490bb4c2ea window: Remove icon property 2019-02-05 08:11:43 -05:00
Timm Bäder
79664567c4 window: Remove _set_default_icon_from_file 2019-02-05 08:11:43 -05:00
Timm Bäder
7abcd5ba3b window: Remove set_icon_from_file
Not all backends support setting window icons from raw pixel data, so
remove the public API in GtkWindow for it.
2019-02-05 08:11:43 -05:00
Emmanuele Bassi
25fd230327 gtk: Drop the "plus"
Source names should use "[gtk]" without the plus.
2019-02-05 11:26:20 +01:00
Timm Bäder
374e93ef96 window: Directly find the cursor in the widget hierarchy
Instead of recording the way up from the target widget to the grab
widget (or toplevel) and then walking that path upwards, just walk the
parent chain and look at the cursor.
2019-01-16 19:01:40 +01:00
Timm Bäder
c1c764255f window: Don't manually queue a draw on the new focus widget
This is either unneeded and OK to remove, or it is needed and there's a
bug somewhere else.
2019-01-16 19:01:38 +01:00
Carlos Garnacho
b52dea7a10 Merge branch 'fix-corner-resize' into 'master'
Fix resize corners

See merge request GNOME/gtk!481
2019-01-07 18:14:33 +00:00
Timm Bäder
66d3aa8101 window: Fix state_flags_changed impl name
This is unrelated to GdkSurface and was changed by accident.
2019-01-03 08:56:34 +01:00
Matthias Clasen
dc68d04c32 Fix resize corners
I was stuck in an X session and noticed that my resize corners
all got east or north cursors. It turns out that gnome-shell
does not properly advertise support for edge constraints under X11,
and the absence of that makes the code for determining the edge
under the cursor misbehave.

This change should fix that.
2019-01-02 19:08:02 -05:00
Timm Bäder
fb6adaaa62 window: Don't try to size-allocate unmapped popovers
The gtk_widget_size_allocate call won't do anything anyway.
2018-12-02 13:25:43 +01:00
Zander Brown
ea487b2233
window: Actually emit notify::transient-for
Because it seems we weren't doing that
2018-11-19 21:17:01 +00:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Benjamin Otte
05e752e096 inspector: Turn object tree into a GtkListBox
The code gets rid of the GtkTreeView and replaces it with a GtkListBox.

Most of the logic is now done via GListModel subclasses.

A big change is that this new list is now tracking updates itself and
doesn't need to be manually updated. All code that used to cause rescans
or add forgotten objects to the tree has been removed.

If objects are missing from the object tree, the logic for tracking them
needs to be added.
2018-09-16 18:50:17 +02:00
Benjamin Otte
63e5b827ed window: Add gtk_window_get_toplevels()
This one returns a list of all toplevel windows.
2018-09-16 18:50:17 +02:00
Matthias Clasen
a7aed5af4b Drop gtk_window_set_use_subsurface
This is no longer used.
2018-08-18 23:24:59 -04:00
Yi-Soo An
b3c8c8e592 window: Fix memory leak
https://gitlab.gnome.org/GNOME/gtk/issues/1268
2018-08-13 17:21:42 +09:00
Carlos Garnacho
f15224926a gtkwindow: Replace captured event handler with motion controller 2018-07-30 13:14:12 +02:00