Commit Graph

1189 Commits

Author SHA1 Message Date
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
Timm Bäder
7823406db4 window: Remove decoration-resize-handle style property 2016-10-18 00:29:20 +02:00
Timm Bäder
b082fb598d gtkwindow: Stop checking gtk-menu-bar-accel 2016-10-18 00:29:18 +02:00
Timm Bäder
a9367b705e Stop checking GtkSettings:gtk-enable-mnemonics 2016-10-18 00:29:18 +02:00
Timm Bäder
77f50ec5d7 window: Remove reshow_with_initial_size 2016-10-18 00:29:17 +02:00
Benjamin Otte
a8d7b0d32e window: Use gdk_window_new_child() and gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
1f132607f7 gtk: Use appropriate constness for variables 2016-10-17 11:44:11 +01:00
Emmanuele Bassi
5880d1b990 gtk: Cast static strings assigned to non-const variables
GtkTargetEntry.target is particularly egregious, and it should really be
constified.
2016-10-17 11:44:10 +01:00
Benjamin Otte
d4d3374729 container: Remove gtk_container_set_resize_mode() 2016-10-16 18:18:58 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Timm Bäder
9fd1a1bbe3 widget: Remove cursor-aspect-ratio/window-dragging style properties
And replaces its usages in GtkTextView/GtkStyleContext with a hard-coded
0.04 which was the default value for cursor-aspect-ratio.  Also remove
the public gtk_draw_insertion_cursor which used draw_insertion_cursor
which in turn looked up cursor-aspect-ratio
2016-10-16 18:17:21 +02:00