Commit Graph

1500 Commits

Author SHA1 Message Date
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
Alexander Larsson
aa873e7709 GtkWindow: Use cairo_surface_t for icons 2017-10-22 22:57:21 +02:00
Timm Bäder
04c550bfb5 window: Make sure we query the window size before size-allocate'ing 2017-10-20 14:56:29 +02:00
Matthias Clasen
55df74a102 window: Remove dead code
GtkWindow never has a parent widget, so we never need to create
a child window for it.
2017-10-20 14:43:11 +02:00
Timm Bäder
c4c6a20998 popover: Explicitly call queue_allocate in tick callback
_gtk_window_set_popover_position is begin called in size-allocate.
2017-10-14 17:27:55 +02:00
Timm Bäder
d5fd2dca66 window: Remove widget parameter from popover_size_allocate
We already get that via the popover parameter.
2017-10-14 17:27:55 +02:00
Timm Bäder
f2ca2e1242 window: Make code snippets compile
Fix the wrong signature of a size_allocate signal handler
2017-10-12 15:42:03 +02:00
Matthias Clasen
ab22734159 Fix application window snapshot differently
As Timm Baedert pointed out, the previous fix made the
menubar go on top of popovers, which is just wrong. Instead,
make gtk_window_snapshot handle all direct children of the
window, taking care to stack popovers correctly.
2017-10-08 14:03:19 -04: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
177f3ef655 gtkwindow: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Daniel Boles
50106521d6 Window: Clarify documentation of set_application()
Clarify that ::destroy, not ::hide*, removes a window from its app, by
replacing the mention of open windows with the blurb on destruction from
:application, completing commit 7db4bee4b6

Also link to the equivalent gtk_application_(add|remove)_window() calls,
since Application.add_window() already links back to Window:application.

* unless you use gtkmm…

https://bugzilla.gnome.org/show_bug.cgi?id=639931
2017-09-19 00:20:17 +01: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
Georges Basile Stavracas Neto
b1c4e9afef window: Add individual CSS classes based on edge constraints
The last touch on this patch series is making GtkWindow able to
selectively adjust various UI details based on the different
tiled edges. The main driver here is that we don't want to show
shadows on edges that are constrained.

This patch adds the necessary code to do that, while still
maintaining compatibility with the old ways.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Georges Basile Stavracas Neto
45f4844880 window: handle tiled edges separately
GTK windows don't have their tiling states really
hooked into the client-side decoration code, and
the only effect it has is disabling the resizing
edges.

With the introduction of per-edge tiling information,
we are backed by much more precise data on how the
window manager wants the app to behave.

This patch, then, fixes GtkWindow to take into account
per-edge tiling information. For compatibility purposes,
the previous tiled field was kept, and thing will just
continue working if no edge information is supplied.

https://bugzilla.gnome.org/show_bug.cgi?id=783669
2017-09-17 23:16:48 -03:00
Daniel Boles
6984d0847b Window: Do not connect to NULL screen in init()
Do not connect to get_settings_for_screen() if we have no screen…

Use g_signal_connect(), not connect_object(), to match how set_screen()
makes this same connection, and how finalize() already disconnects it.

https://bugzilla.gnome.org/show_bug.cgi?id=705640
2017-08-31 20:26:44 +01:00
Timm Bäder
54c362bf48 gtkwindowprivate: Remove _gtk_window_keys_foreach
Unused outside of gtkwindow.c
2017-08-14 14:24:29 +02:00
Carlos Garnacho
4f31afcd9c window: Fix traversal of popovers during picking
These need to be traversed in the opposite direction. Given the order is
opposite to rendering, use a GQueue so it's cheap to traverse/add either
way.
2017-08-06 22:44:40 +02:00
Daniel Boles
01e587da22 Window: Also quote Window address in Popover error
This is symmetrical with how we already do that for the Popover, and it
could be useful for debugging.
2017-08-03 21:10:22 +01:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
3aeaeef070 window: Fix resizing with solid-csd
We can't use a 20px resize handle in that case so fall back to the
padding area of the window. Still ugly but it works.
2017-07-19 21:27:15 -04:00
Timm Bäder
5fb27e2bd7 window: Fix annotations in get_size and get_position 2017-07-19 21:27:15 -04:00
Timm Bäder
451a991488 window: Move updates debugging to GtkWidget
Which has the necessary information.
2017-07-19 21:27:15 -04:00
Timm Bäder
8dd29d755c window: Don't use allocated size in snapshot
Those are the wrong values.
2017-07-19 21:27:14 -04:00
Timm Bäder
2cbaa998db widget: Fix drawing invalidation with windowed widgets
E.g. popovers. Find the parent of the given widget with the window and
invalidate the given region in that window.
2017-07-19 21:27:14 -04:00
Timm Bäder
79797cd162 window: Stop wrapping popovers in another window
GtkPopover is already a windowed widget.
2017-07-19 21:27:14 -04:00
Timm Bäder
b8cc22a552 window: Remove dead code
This case can never happen since GtkWindow instances never have a
parent.
2017-07-19 21:27:13 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cd1a984cf set clip of more widgets 2017-07-19 21:27:11 -04:00
Carlos Garnacho
9de7c9f595 gtkwindow: Free pointer foci on dispose
That means the whole hierarchy is getting destroyed, leaving those
behind incurs not only in a leak, but also on weak refs (and unintended
repick) to happen in the wrong moment.
2017-07-19 18:16:18 +02:00
Carlos Garnacho
4772fc2d42 gtkwindow: Do not leak GtkPointerFocus
gtk_window_add_pointer_focus() increments the refcount, which means
the caller should be dropping its own.
2017-07-19 18:16:18 +02:00
Carlos Garnacho
b894c35008 gtk: Make GtkPointerFocus refcounted
In order to make it really sure the GtkPointerFocus is valid while being
removed from a GtkWindow.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
0d7fe2ec09 gtk: Check implicit grab status before sending crossing events
As we now refrain from sending the crossing events if there's an
implicit grab, those events must be sent on button release when
the implicit grab is broken.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
e892e20841 gtk: Rework pointer cursor selection
Check the grab widget (both explicit and implicit) and check for a cursor
from the target widget up to this grab widget. If the target widget is
outside the grab widget, only the grab wigdet's cursor will be checked.

This also means that we have to ensure the cursor is updated on button
releases, as an implicit grab being deactivated must trigger a cursor
lookup from the target widget.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
47e505781e gtkwindow: Implement ::pick to extend picking to popovers.
This makes interaction possible with popovers again.
2017-05-25 16:25:59 +02:00
Timm Bäder
f5e8d7a4e2 window: Hide titlebox when undecorated
We don't draw or size-allocate the titlebar when the window is
fullscreen or undecorated, so reflect this by setting it to
!child_visible. This can happen when changing the value of the decorated
property while the window is shown.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
599344d428 gtkwindow: Add private API to update pointer cursors 2017-05-25 16:25:59 +02:00
Carlos Garnacho
1858f310aa gtkwindow: Implement window resizing sans-GdkWindow
We can just replace window comparisons with coordinate matching, the
cursor corresponding to edges is now set in a capture-phase motion
handler, as cursors aren't set on GdkWindows anymore.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
95bf1379c0 gtkwindow: Ignore implicit grabs going away if there is no focus
There should be no circumstances where an implicit grab is requested but
no focus exists, there's however circumstances (like windowing grabs taking
input to a different window) where we might get implicit grabs being undone
when then new window didn't create a focus for the pointer itself.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
b7fee9f9d2 gtkwindow: Revoke implicit grabs when activating an explicit one
Only if they fall outside the grab widget, in that case the widget holding
the implicit grab won't be receiving events anymore, so we can just undo
it.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
3dfab962fa gtk: Implement per-focus implicit grabs
Unlike GTK+ grabs which are global to all/one device, the implicit grab
is per focus, which means each may have implicit grabs on different or
the same widget.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
8f24df1c19 gtk: Update GtkPointerFocus targets on mapping/sensitivity changes
Those are situations that must cause foci on these widgets to repick
themselves.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
17aa0ca76e gtkwindow: Add management functions for GtkPointerFocus instances
Each toplevel will keep its own tracking of the current ongoing foci,
add the plumbing that will allow to create/update/remove those as they
come and go.
2017-05-25 16:25:58 +02:00
Jonas Ådahl
477556aac2 GtkWindow: Don't double free export user data
The user data passed when exporting a Wayland window was supposed to be
freed using the destroy_func, as is commonly done. This was previously
broken, as the user data was just NULL:ed when exported, and only
actually destroyed when unexporting before having exported.

While e016d9a5db fixed this, it introduced
a regression, as GtkWindow was nice enough to free the memory anyway
after having received the exported handle, causing it now to double
free.

https://bugzilla.gnome.org/show_bug.cgi?id=782109
2017-05-09 23:23:11 +08:00
Timm Bäder
1a7a089e2c window: Stop using gtk_widget_get_preferred* 2017-05-05 11:18:24 +02:00
Emmanuele Bassi
c05fcdbba0 window: Remove property definition
Commit 92b0d2e8ea removed the
hide-titlebar-when-maximized property handlers, but it still installed
the GParamSpec into the GtkWindow class.
2017-05-03 15:58:49 +01:00
Timm Bäder
df965304d4 meson: make gtk buildable
x11 only
2017-05-03 15:10:51 +01:00
Matthias Clasen
92b0d2e8ea Remove GtkWindow::hide-titlebar-when-maximized
This was only every implemented under X11, and with CSD,
this is clearly in the application realm. We should not
pretend that we can support it on the toolkit level.

https://bugzilla.gnome.org/show_bug.cgi?id=775061
2017-05-01 13:26:46 -04:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Timm Bäder
efa9601a10 window: Make sure the decoration node stays at the beginning
Otherwise, the gtk_widget_set_parent call might add the widget node of
the child before the decoration node.
2017-04-25 20:30:36 +02:00
Timm Bäder
68383cfcd3 window: Expand CSS node docs 2017-04-24 16:24:12 +02:00
Timm Bäder
1affd425a1 window: Simplify _set_focus 2017-03-31 09:50:39 +02:00
Timm Bäder
cc05fc574c window: Remove _gtk_window_set_is_toplevel
All GtkWindow instances are toplevels.
2017-03-31 09:50:39 +02:00
Timm Bäder
270d957380 window: Fold update_has_focus in to set_is_active
We're now only ever setting has_focus to the same value we set is_active
to, so also remove that field from the private struct.
2017-03-31 09:50:39 +02:00
Timm Bäder
0ce9f26dc5 window: Remove has-toplevel-focus property
Since embedded toplevels don't exist anymore, :has-toplevel-focus is
equivalent to :active.
2017-03-31 09:50:39 +02:00
Timm Bäder
ebdbb6873a window: Remove check_resize special case for embedded toplevels
Those don't exist anymore.
2017-03-31 09:50:39 +02:00
Timm Bäder
49bbf67195 window: Remove gtk_quark_embedded
Unused.
2017-03-31 09:50:39 +02:00
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Timm Bäder
69ca360b59 window: Remove pointless ternary operator
we're already checking for orientation == GTK_ORIENTATION_HORIZONTAL
right before this line, so just pass GTK_ORIENTATION_VERTICAL.
2017-03-20 14:59:14 +01:00
Timm Bäder
ab051fd53f Don't hide windows and popovers in init()
Instead, don't make them visible in gtk_widget_init in the first place.
2017-01-20 21:51:05 +01:00
Timm Bäder
ea897c6df4 Remove gtk_widget_show_all 2017-01-20 21:37:04 +01:00
Timm Bäder
33d41fccdd Hide popovers and toplevels by default 2017-01-20 21:33:37 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Timm Bäder
5f98597a0c Add gtk_widget_set_focus_child
With a very useful implementation, but at least now we don't get runtime
warnings.
2017-01-07 17:19:30 +01:00
Benjamin Otte
071c9a8221 API: gdk: Add gdk_rgba_is_clear() and gdk_rgba_is_opaque()
I want to use these inside GSK, and I'm not a fan of putting GdkRGBA
APIs into it or duplicating it into GTK.

So public API it is.
2016-12-20 18:01:12 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Benjamin Otte
cb8483b0a6 gtk: Remove unneeded gtk_snapshot_push()/pop() calls 2016-12-09 21:39:43 +01:00
Benjamin Otte
5563841603 gsk: Add gsk_renderer_new_for_window()
and remove gsk_renderer_get_for_display().

This new function returns a realized renderer. Because of that, GSK can
catch failures to realize, destroy the renderer and try another one.

Or in short: I can finally use GTK on Weston with the nvidia binary
drivers again.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2016-11-30 15:56:00 +01:00
Benjamin Otte
ce98df881f gsk: Change gsk_renderer_realize()
Instead of having a gsk_renderer_set_window() call, pass the window to
realize(). This way, the realization can fail with the wrong window.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2016-11-30 15:55:45 +01:00
Matthias Clasen
3414f10bad Drop the GDK_PRIVATE_CALL mechanism
We don't need to do this extra complication anymore, since
we're now living inside a single shared library.
2016-11-23 19:31:16 -05:00
Benjamin Otte
8cb96dec7e window: unrealize renderer before destroying GDK window
We need to unrealize the children manually for that to happen, but so it
goes.

The order is necessary because we want the renderer to still be alive
while children are unrealizing.
2016-11-23 18:47:58 +01:00
Matthias Clasen
b0303c539c Make unknown window types fatal
This helps gcc to see that there's no point in warning about
gdk_window being used uninitialized.
2016-11-19 21:23:17 -05:00
Benjamin Otte
703d80eac0 window: Unrealize renderer last
We want to unrealize the renderer only after all widgets have been
unrealized. Otherwise, the widgets cannot release rendering resources
like textures.
2016-11-15 17:49:19 +01:00
Benjamin Otte
79d2d0e40d snapshot: Add gtk_snapshot_render_background()
and gtk_snapshot_render_frame() to be direct replacements for the
old gtk_render_*() functions.

Use them to replace Cairo usage completely in gtk_window_snapshot().
2016-11-15 17:48:45 +01:00
Benjamin Otte
d1fec79c00 snapshot: Completely reengineer API
We now try to emulate cairo_t:

We keep a stack of nodes via push/pop and a transform matrix.

So whenever a new node is added to the snapshot, we transform it
by the current transform matrix and append it to the current node.
2016-11-15 17:48:45 +01:00
Benjamin Otte
bb9626dc29 window: Implement snapshot() 2016-11-15 17:48:45 +01:00
Timm Bäder
4e445e8e53 window: Properly propagate for_size=-1 2016-11-12 20:37:30 +01:00
Timm Bäder
9a0513d911 window: Use gtk_widget_measure 2016-11-12 20:37:14 +01:00
Benjamin Otte
24d0baec38 API: gdk: Add gdk_window_new_popup()
... and use it.
2016-11-06 23:47:56 +01:00
Benjamin Otte
b30afff511 API: wayland: Add gdk_wayland_window_new_subsurface()
... and use it instead of gdk_window_new().
2016-11-06 21:36:43 +01:00
Benjamin Otte
87f07bac6b API: gdk: Add gdk_window_new_toplevel()
... and use it in GTK.
2016-11-06 17:40:59 +01:00
Benjamin Otte
7a6cab14eb gdkwindow: Remove GdkWindowAttr.type_hint
Instead, let the callers call gdk_window_set_type_hint(). Which is
surprsingly what every backend did.
2016-11-06 16:22:21 +01:00
Timm Bäder
846cf681e8 Remove gtk_widget_set_mapped
Let all the remaining callers chain up.
2016-11-05 11:56:36 +01:00
Benjamin Otte
9707f4d3b3 API: gdk: Remove title from gdk_window_new()
Use gdk_window_set_title() afterwards instead.
2016-11-05 03:32:27 +01:00
Benjamin Otte
a0e63b8a07 rendernode: Require passing a renderer to get_draw_context()
This is in preparation of making render nodes independent of the
renderer, so that they can be rendered multiple times with different
renderers.
2016-11-01 16:32:26 +01:00
Timm Bäder
5071206d60 widget: Remove app-paintable 2016-10-31 19:28:28 +01:00
Benjamin Otte
d249e77bcb API: screen: Remove gdk_screen_is_composited()
Switch code to use gdk_display_is_composited() instead.

The new code also doesn't use a vfunc to query the property but rather
requires the backend to call set_composited()/set_rgba() to change the
value.
2016-10-29 04:49:47 +02:00
Benjamin Otte
a334316d5e API: widget: Remove GtkWidget::composited-changed signal
Nobody uses it.

If you need the functionality, listen to display changes on
your widget and then connect to the display's notify::composited.
2016-10-29 04:49:47 +02:00
Benjamin Otte
48f5df5318 gtk: Add back infrastructure for GTK_DEBUG=updates
Includes the ability to turn on updates in the inspector. Animations are
now run via a tick function which allows us to neatly overlay a
semi-transparent red rectangle and fade it out over time.

It also probably enables way more, but somebody with more UI neatness
than me needs to figure out what it eanbles first...
2016-10-27 05:07:23 +02:00
Benjamin Otte
27ab75250c widget: Redo how gtk_widget_queue_draw() works
Before, we would immediately invalidate the GdkWindow of the widget, now
we call the parent's GtkWidgetClass.queue_draw_child() function.
This allows the parent to track redraw queueing of children.

By default GtkWidgetClass.queue_draw_child() will again chain up to its
parent while respecting the GdkWindow hierarchy for clipping.
GtkWindow is then the only widget actually invalidating the GdkWindow.

This essentially moves redraw queueing from GDK to GTK.
2016-10-27 05:07:23 +02:00
Alexander Larsson
70935f0952 Drop support for offscreen GdkWindows
These complicate a lot of GdkWindow internals to implement features
that not a lot of apps use, and will be better achieved using gsk.
So, we just drop it all.
2016-10-25 09:54:37 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
ca305bb596 window: Don't leak the GskRenderer 2016-10-21 14:32:31 +02:00
Emmanuele Bassi
f764d03cfd gsk: Remove :use-alpha from GskRenderer
It's unused, and we always assume we render with an alpha channel
enabled because it's 2016.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
ce67336577 gsk: Drop modelview/projection from GskRenderer API
The details of the modelview and projection matrices are only useful for
the GL renderer; there's really no point in having those details
available in the generic API — especially as the Cairo fallback renderer
cannot really set up a complex modelview or a projection matrix.
2016-10-18 11:49:14 +01:00
Emmanuele Bassi
1ab1fd4391 Use the projection to flip around the content
Since we use an FBO to render the contents of the render node tree, the
coordinate space is going to be flipped in GL. We can undo the flip by
using an appropriate projection matrix, instead of changing the sampling
coordinates in the shaders and updating all our coordinates at render
time.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
3d90a070d5 gsk: Tie render nodes to renderers
Render nodes need access to rendering information like scaling factors.
If we keep render nodes separate from renderers until we submit a nodes
tree for rendering we're going to have to duplicate all that information
in a way that makes the API more complicated and fuzzier on its
semantics.

By having GskRenderer create GskRenderNode instances we can tie nodes
and renderers together; since higher layers will also have access to
the renderer instance, this does not add any burden to callers.

Additionally, if memory measurements indicate that we are spending too
much time in the allocation of new render nodes, we can now easily
implement a free-list or a renderer-specific allocator without breaking
the API.
2016-10-18 11:49:10 +01:00
Emmanuele Bassi
f0c04cdd09 gtk: Port GtkWindow to render nodes
WARNING: BROKEN COMMIT
2016-10-18 11:49:09 +01:00
Emmanuele Bassi
b997f4c575 gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-10-18 11:49:06 +01:00
Emmanuele Bassi
258af60c18 gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-10-18 11:49:06 +01:00
Timm Bäder
301e1a4d55 window: Remove decoration-button-layout style property
GtkSettings has a gtk-decoration-layout property for this.
2016-10-18 00:29:20 +02:00