Commit Graph

1500 Commits

Author SHA1 Message Date
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
Andrea Azzarone
e1a7629a85 window: Fallback to CSD titlebar in focus-chain
CSD titlebar are included in the focus-chain. The logic used makes sure that the
initial focus avoids the titlebar, but tabbing around will eventually get there.
This logic fails in case the window has no other focusable widgets apart from
the ones in the header-bar. If this happens keynav focus will be lost. To handle
the above scenario, we need to fallback to focus the header-bar (if any).

Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/404
2018-07-30 09:30:26 +02:00
Timm Bäder
960717b273 window: Don't queue an allocate if the css clip changes
clips don't exist anymore.
2018-07-17 17:33:47 +02:00
Matthias Clasen
bf5f27c6d5 Handle configure events in gdk
The previous attempt at removing configure events entirely
was causing some dialogs not to show up under Wayland.
Presumably due to ordering issues with emitting ::size-change
out of the backend.

Instead, keep configure events in the event queue, but handle
them on the gdk side. This keeps the ordering intact, while
still removing configure events from the api. The dialogs
show up now.
2018-07-15 20:23:45 -04:00
Matthias Clasen
7a1073c3ae Revert "gdk: Drop configure events"
This reverts commit a8926c9d87.
2018-07-15 20:23:45 -04:00
Matthias Clasen
d148f26658 Drop gdk_surface_withdraw
'withdrawn' is an X11-centric concept, and the function
can just as well be replaced by gdk_surface_hide.
2018-07-15 15:29:58 -04:00
Matthias Clasen
a8926c9d87 gdk: Drop configure events
Replace configure events with a GdkSurface::size-changed signal.
This is part of the move to use events only for input.
2018-07-15 11:51:09 -04:00
Benjamin Otte
4456b06853 window: Update opaque region if background-color changes
The opaque region is only set when the background color is opaque. So
we need to do something about it when the background color changes.

However, in the case where a size allocation is going to happen, we
already do this update in size_allocate(), so in that case avoid doing
it twice.
2018-07-13 14:56:04 +02:00
Matthias Clasen
8755d884f3 Remove a lot of Since annotations
4.0 will represent a clean epoch. We don't want to have
lots of noise in the docs about 2.x or 3.x.
2018-06-25 19:55:04 -04:00
Carlos Garnacho
ffd89d29df gtkwindow: Queue popover resize on set_popover_position()
So the new position is eventually honored. Fixes magnifier and handles
staying in place after being shown.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
ca08cf94d3 gtkwindow: Move map/delete/configure event management to gtkmain
Toplevels are about the only widgets interested in these events,
just handle those without going through the capture/bubble handling
code.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
3d5dc16d63 gtkwindow: Simplify WM drag/resize handling
We still need a drag gesture both on front (capture) and back (bubble)
to handle dragging from both the GtkWindow widget and chrome in the
headerbar. But we can do it through 2 drag gestures, instead of special
event handling code.
2018-06-21 12:52:59 +02:00
Carlos Garnacho
aa09b0742e gtkwindow: Handle focus in/out through key controller
One less use of ::event in this widget, now mostly left to
map/delete/configure, those puny events.
2018-06-21 12:50:57 +02:00
Timm Bäder
29fee2e808 window: Remove priv pointer 2018-06-20 07:49:04 +02:00
Benjamin Otte
a1cee7fa65 surface: Kill event masks
In particular, this patch removes:
  gdk_surface_get_events()
  gdk_surface_set_events()
  gdk_surface_get_device_events()
  gdk_surface_set_device_events()

Event masks so far still exist for grabs.
2018-06-18 23:49:52 +02:00
Руслан Ижбулатов
58fc1229c1 Remove unused variables (mostly in W32 code) 2018-06-10 21:21:01 +00:00
Christian Stadelmann
a70f0356e9 GtkWindow: Handle non-square icons with height > width correctly 2018-05-31 17:26:17 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +02:00
Benjamin Otte
5abc4749de gtk: Chain up in toplevels' realize
Don't call set_realized() manually.
2018-04-11 03:16:34 +02:00
Benjamin Otte
e0415fccd7 window: Don't queue resize handler
It's not needed, because the queue_allocate() call right above it does
this work.
2018-04-11 03:16:34 +02:00
Carlos Garnacho
ad5f0a63a3 gtkwindow: Perform key activation in gtk_main_do_event()
In a similar spirit to the previous commit, make window shortcut
activation happen by default on toplevels, without relying on
legacy controllers.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
b55696e551 gtkmain: Don't use special paths for key event propagation
Set the event_widget to the window focus, and let event capture/bubble
handling do the rest.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
58eaf5ca16 gtkwindow: Unset focus grab_widget if it ends up unmapped
This may result on the later emission of crossing events, with one of the
sides being already unmapped/unrealized. The widget being unmapped will
result on repick and emission of a set of crossing events anyway.
2018-04-05 19:26:04 +02:00
Benjamin Otte
374467c11c a11y: Fix headers
We were getting a gcc warning before.
2018-04-05 17:05:21 +02:00
Benjamin Otte
8cb0df7554 Merge branch 'window-activate' into 'master'
a11y: restore window:activate/deactivate emission

Closes #127

See merge request GNOME/gtk!77
2018-04-05 14:36:13 +00:00
Samuel Thibault
62f31015fc a11y: restore window:activate/deactivate emission
1b9aa1b708 ('a11y: drop the focus tracker') removed a bit too much.  We
still have to emit window:activate/deactivate events.  They are easy to
emit anyway.

Fixes #127
2018-04-05 15:19:04 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Benjamin Otte
7e078cd940 gtk: Remove debug updates
With the soon-to-arrive automatic updates (aka computing invalid region
from render nodes), this will no longer be necessary.
2018-04-05 14:56:38 +02:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Benjamin Otte
ee8e42f19b gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:57:07 +01:00
Timm Bäder
ad85a75c2e window: Use widget facilities to sort focus menubars 2018-03-17 12:09:30 +01:00
Benjamin Otte
3bb95a09bb a11y: Remove gtk.h include from container accessible 2018-02-09 00:42:38 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Carlos Garnacho
7d9af6d700 gtkwindow: Disconnect GdkSeat::device-removed callback on finalize
Otherwise dangling callbacks may lead to crashes.
2018-01-19 18:47:21 +01:00
Timm Bäder
8a432b42a2 window: Ignore gtk_window_close calls from close-request handlers 2018-01-18 15:10:49 +01:00
Matthias Clasen
7277d657d9 window: Stop using ::focus-in/out-event
We can just use the generic ::event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
59572e5fcf window: Stop using ::configure-event
We already have a generic ::event handler that we
can just press into service for this.
2018-01-16 14:14:10 -05:00
Matthias Clasen
ab53142c0f window: Stop using ::map-event
Use ::event here, since we want to drop the event-specific
signals, and we already have a handler for the generic signal.
2018-01-16 14:14:09 -05:00
Matthias Clasen
a739ee6905 Replace GtkWidget::delete-event by GtkWindow::close-request
The event is not useful at all, so we are better off
with a signal that doesn't have it, and it is only
relevant on toplevel windows, so we don't need it on
GtkWidget.

With this commit, delete events no longer go through the
::event, ::delete-event, ::event-after widget signals,
but just cause the ::close-request signal on GtkWindow to be
emitted.
2018-01-16 14:14:09 -05:00
Matthias Clasen
75271c44c2 inspector: Stop using ::delete-event signal
We can just use GtkWindow::hide-on-close instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
c04f192113 window: Add a hide-on-close property
This lets us avoid ::delete-event signal handlers for just
this purpose.
2018-01-16 14:14:09 -05:00
Daniel Boles
e0f69353bb Window: Mention GtkHeaderBar in set_titlebar() doc
This is the typical thing passed here and what most users want, so we
should mention it here, rather than requiring users to figure it out.
2018-01-13 20:06:20 +00:00
Daniel Boles
339d355dda Window: Clarify resize() doc about titlebar widget
Clarify the reference to HeaderBar, as it applies to any custom title
widget; HeaderBar is only the most common one used. Also, fix a typo.
2018-01-13 20:06:20 +00:00
Timm Bäder
c910a955d1 window: Fix tooltip allocation
Using get_preferred_size here does not work since it computes the
minimum height for the minimum width, but we want to know the minimum
height for the current width.
2018-01-12 22:34:22 +01:00
Timm Bäder
33162eee1a window: Fix an event widget/target mixup
This makes dragging inside a GtkEntry in the window decoration work
again.
2018-01-04 13:16:24 +01:00
Matthias Clasen
a25357007e Fix pointer obscuring in text view
The code for hiding the mouse cursor until the next motion
event was not working, probably due to a typo here.
2018-01-02 21:52:43 -05:00
Matthias Clasen
12e4f4256d Drop an unused enum value
We haven't had a GtkWindow::frame-event since the
linux-fb backends demise.
2018-01-02 18:14:13 -05:00
Matthias Clasen
d072201b12 docs: Don't mention non-longer-existing signals
The ::window-state-event signal no longer exists.
2018-01-02 18:05:19 -05:00
Timm Bäder
c1573a1fda window: Avoid a set-but-not-used warning 2017-12-29 08:59:53 +01:00
Timm Bäder
b488329104 GskRenderer: Remove viewport property 2017-12-21 18:25:52 +01:00
Timm Bäder
fcbbaae63c window: Make sure an event has a display
This fixes a crash happening later on when something tries to access the
event's display.
2017-12-19 07:39:29 +01:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
1e1904a9b8 gtk: Stop using GdkEventWindowState
We can instead use the new GdkWindow::state property
change notification. The event is going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Benjamin Otte
d7f34874ab x11: Make unsetting transient-for work
... and just unset it from GtkWindow instead of fiddling with
properties.
2017-12-14 03:05:34 +01:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
b9db0b55cb gdk: Refurbish GdkEvent struct hierarchy
Make all specific event structs contain a GdkEventAny, so the base
struct can be extended without modifying structs all over the place.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
8233cf3688 gtkwindow: Allow edge resizing from corners if constraints forbid either side
The fix is twofold. First, when checking that a corner is resizable, we must
check the constraints on both edges. Second, when checking either edge we
must include both perpendicular sides in order to allow those to be
resizable when the constraint does not allow resizing the edge being
checked.
2017-12-09 22:19:57 +01:00
Carlos Garnacho
6b4dd4be6c gtkwindow: Use shadow border when calculating resize areas positions
This way resize areas are correctly positioned right outside the visible
window edge on all sides.
2017-12-09 17:33:44 +01:00
Carlos Garnacho
f6ef18ac74 gtkwindow: Do not account handle size when checking content area
This is necessary to bring back the L-shaped resize corners. On all edges
(not corners) the handle width is determined by the border size.
2017-12-09 17:32:02 +01:00
Matthias Clasen
b3ebffa07d Switch the order for cursor lookup
When looking for the cursor to apply, start from the innermost
widget and go up. This is the right behavior for cases like
entry icons. The top-down order we were using so far is the
right behavior for cases like global wait cursors. Since we
have entry icons in gtk, but not global wait cursors, lets
pick the other order for now.
2017-12-09 08:35:23 -05:00
Matthias Clasen
029a84aa74 Fix fallout from the show-close-button rename
I had overlooked ui files. We should really
validate those during build.
2017-12-08 11:29:14 -05:00
Timm Bäder
1aa811ce12 Remove all gtk_widget_get_content_size usages
And remove the function itself. Make everything use gtk_widget_get_width
and gtk_widget_get_height instead.
2017-12-06 07:56:12 +01:00
Руслан Ижбулатов
6a770517cc Only register application/x-rootwindow-drop on X11
application/x-rootwindow-drop is not useful anywhere else,
so put it under #ifdef GDK_WINDOWING_X11

On W32 this prevents toplevels from automatically becoming valid
drop targets with a useless drop type.

(This commit is cherry-picked from the gtk-3-22 branch)

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:31 +00:00
Timm Bäder
ff35fbf120 window: Plug a memory leak 2017-12-01 07:30:25 +01:00
Matthias Clasen
4db2426336 window: Stop using GdkPixbuf
We can get by with just using GdkTexture.
2017-11-29 17:28:15 -05:00
Matthias Clasen
83ab83043e Cosmetic formatting fixes 2017-11-29 17:28:15 -05:00
Kjell Ahlstedt
7ef5858f8d GtkWindow: Fix the down-scaling in icon_from_list()
Must use floating-point division to get the correct scale factors.
cairo_set_source_surface() must be called after cairo_scale().

https://bugzilla.gnome.org/show_bug.cgi?id=790287
2017-11-26 18:54:59 -05:00
Matthias Clasen
7c0a1ddb05 window: Don't use GdkDeviceManager
We can just as well use GdkSeat to enumerate (attached)
devices. Note that this change excludes floating devices
from consideration.
2017-11-25 11:04:14 -05:00
Benjamin Otte
9a6ec4e959 contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
2017-11-20 23:12:33 +01:00
Benjamin Otte
c863ac0f90 dnd: Remove GtkTargetEntry and GtkTargetFlags
warning: We don't do any same-app checks anymore so you currently can
copy local data into external apps.

This will be fixed later.
2017-11-20 23:12:33 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Matthias Clasen
dca8c8e189 gtk: Stop using gdk_notify_startup_complete_with_id
This function is about to go away. Instead, use the
display-specific function that this is a wrapper of.
2017-11-16 22:45:04 -05:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
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
Matthias Clasen
a381ee6a55 Fix a typo 2017-11-08 22:09:23 -05:00
Benjamin Otte
cf2d549e92 widget: Implement gtk_widget_pick()
... and use it.
2017-11-05 05:13:17 +01: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
Carlos Garnacho
b8d3f88ddb gtkwindow: Use event target widget for WM handling special paths
The check used to achieve discarding events not meant for the window
widget itself (because they are handled in the regular paths). Using
the target widget is the equivalent now.
2017-11-03 22:19:13 +01:00
Kjell Ahlstedt
23014438d6 GtkWindow: Tidy up after icon became a cairo surface
Use g_value_set/get_boxed() in gtk_window_get/set_property(), case PROP_ICON.
icon_from_list() shall always add a reference to the returned icon.
gtk_window_set_icon() must accept icon != NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=789870
2017-11-03 20:05:28 +01:00
Matthias Clasen
81cda3dcf7 Use x11-specific api to get at the screen
gdk_display_get_default_screen is going away.
2017-11-01 19:44:28 -04: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
Benjamin Otte
b880296354 window: Unset transient parent in set_display()
If somebody changes a window's display, the transient parent cannot
stay if it's on a different display.
2017-11-01 18:17:11 +01:00
Benjamin Otte
8059f9bb3a window: Clear the renderer un unrealize
We disconnect from the GDK window, so the renderer can't keep any useful
state.

Plus, we might be using an entirely different window next time we
realize (after a call to gtk_window_set_display() for example) that should
use a completely different renderer anyway.
2017-11-01 15:48:00 +01: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
Benjamin Otte
07164e098a window: Turn gtk_window_set_screen() into gtk_window_set_display()
And have a priv->display instead of a priv->screen.

Includes turning gtk_menu_set_screen() into gtk_menu_set_display(),
because that function just forwards to its window.
2017-10-31 08:25:37 +01:00
Benjamin Otte
c8986e66ce window: Remove gtk_window_get_screen()
It's identical to gtk_widget_get_screen(), just use that one.
2017-10-31 04:33:54 +01:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
Matthias Clasen
dc0570cc17 gsk: Drop the GskRenderer::scale-factor property
This is can always be obtained from the window that is already
associated with the renderer, no need to maintain a separate
property for it.
2017-10-28 11:49:39 -04:00
Drew DeVault
1b279e3d4a Wayland: Implement KDE's SSD protocol
If the compositor prefers server-side decorations and the client doesn't
customize the title bar, we disable client-side decorations and let the
compositor know. Otherwise, we continue to use client-side decorations.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781909
2017-10-26 15:51:56 -04:00
Timm Bäder
7ee2ab32b8 window: Use correct destroy notify for icon list
The list contains cairo_surface_t instances now, not GdkPixbuf anymore.
2017-10-23 14:43:47 +02: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
Matthias Clasen
8eea3e2ddd window: Correct the property definition for icon
cairo surfaces are boxed types, not objects.
2017-10-23 07:39:12 +02:00