Commit Graph

26725 Commits

Author SHA1 Message Date
Alexander Larsson
01d0bac83e Initial version of file chooser portal support
Implement GtkFileChooserNative for sandboxed applications
by talking to org.freedesktop.portal.FileChooser. Currently,
this supports OPEN and SAVE mode.

https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:07:42 -04:00
Matthias Clasen
e47957406d about dialog: Use gtk_show_uri_on_window
This allows us to handle things slightly better in
the portal case.

https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:07:11 -04:00
Matthias Clasen
c6416aec74 Add gtk_show_uri_on_window
The gtk_show_uri API doesn't let us specify a parent window. With
portals, there may be an intermediate dialog, for which it is nice
to have parent window information, to place it properly.

https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:07:07 -04:00
Matthias Clasen
96d8afbccb Add a portal helper
Instead of open-coding checks for sandboxing in multiple
places, add a helper function that caches the information.

https://bugzilla.gnome.org/show_bug.cgi?id=768499
2016-07-08 00:06:14 -04:00
Owen W. Taylor
b840a59766 Change the priority of the window-close idle to G_PRIORITY_DEFAULT
If we have an application that never goes idle (or takes a long time to
go idle), the close buttons in CSD decoration don't work properly.
While it's not clear why the usage of an idle was added in the first
place, keep on using it to avoid unexpected reentrancy problems, but
change the priority to G_PRIORITY_DEFAULT.

https://bugzilla.gnome.org/show_bug.cgi?id=768485
2016-07-06 09:50:21 -04:00
Matthias Clasen
3c4be3c912 Fix parsing of some css properties
Our property parser stops at the first match when looking for
enums, so we need to order our values so that we don't end up
with prefixes of longer names being found first.

I noticed this when the parser tried to interpret
background-blend-mode: color-burn; as "color, with junk at the end".

It also affects animation-direction, which is also fixed here.
2016-07-03 17:54:19 -04:00
Matthias Clasen
34986231f4 css parser: Improve an error message
Say what property we are dealing with when we complain about the
value.
2016-07-03 17:46:30 -04:00
Georges Basile Stavracas Neto
369db4a406 css: add background-blend-mode support
CSS supports blend modes, in which a series of layers are
merged together according to the given operation or set of
operations.

Support for blend modes landed on Cairo, which exposes all
the commons and also the exquisites blend modes available.
Adding support for blend modes, then, is just a matter of
using the available Cairo operations.

This patch adds the background-blend-mode CSS enum property,
and adapts the background rendering code to blend the backgrounds
using the available blend modes when they're set.

https://bugzilla.gnome.org/show_bug.cgi?id=768305
2016-07-03 17:24:47 -04:00
Matthias Clasen
c8a74a1f50 Simplify the xfce session manager support
We don't have to check name owners twice; reuse the information
we already have.
2016-07-03 17:22:14 -04:00
Eric Koegel
3c7cd7ac23 GtkApplication: Add support for the Xfce session manager
Xfce4-session-manager added support for managing dbus based clients.
This patch adds support for checking if Xfce session manager is
around after trying the gnome one.
https://bugzilla.gnome.org/show_bug.cgi?id=693203
2016-07-03 14:56:48 -04:00
Matthias Clasen
a43fce058c print dialog: Apply initial capabilities
I was struggling to understand why calling
gtk_print_unix_dialog_set_manual_capabilities (...,0)
was not having the expected effect of hiding the preview
button. The initial capabilities were not applied at all.
2016-07-02 18:08:38 -04:00
Chun-wei Fan
51444b7909 gtk/gtkstylecascade.c: Fix formatting
My previous patch on this file did not take into the account of the
formatting, sorry!
2016-06-30 18:00:47 +08:00
Ray Strode
386d17db6d headerbar: don't throw a warning if title widget is hidden
commit 0015ebc4a8 reworked
some of the titlebar size allocation code.  Those changes
inadvertently introduced a warning when the application sets
the headerbar title widget to be hidden.

This commit fixes that warning.

https://bugzilla.gnome.org/show_bug.cgi?id=768184
2016-06-29 09:27:33 -04:00
Timm Bäder
92de947d5e GtkWindow: Check for GtkWidget-window-dragging in multipress gesture
This partly reverts 9f5b9c0e07, which
removed the check for GtkWidget-window-dragging in the multipress
gesture. This check is still needed for widgets which have this style
property set (e.g. menubars and toolbars) can maximize the window on
double click -- but those widgets which have it set to FALSE shouldn't
maximize the window.
2016-06-28 21:42:55 +02:00
Ondrej Holy
0c1cc9832f gtkfilesystem: Improve heuristics to detect remote filesystem
Use G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE to detect remote filesystems
instead of hardcoded list of filesystem types.

Bump required GLib version accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=767965
2016-06-28 10:55:06 +02:00
Timm Bäder
9f5b9c0e07 GtkWindow: Fix dragging on non-titlebar widgets 2016-06-27 19:23:12 +02:00
Timm Bäder
d52f6ff710 widget: Don't unnecessarily export function
_gtk_widget_get_translation_to_window is only used in gtkwidget.c
2016-06-27 14:43:53 +02:00
Chun-wei Fan
5f525839da gtk/gtkstylecascade.c: Declare variables at beginning of block 2016-06-27 11:58:42 +08:00
Chun-wei Fan
cd44f6d875 Fix build of commit f23e99b
Commit f23e99b made use of snprintf(), which is not universally available.
Fix this by using g_snprintf().
2016-06-27 11:53:30 +08:00
Lapo Calamandrei
ebccc8b23f Adwaita: color the selection of entries with error...
...or warning style class applied.
This particular style bit wasn't converted to the saner 3.20 way
so `entry:selected` used in place of `entry selection`.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=768025
2016-06-25 18:29:51 +02:00
Lapo Calamandrei
d74e4af1a2 Adwaita: restrict infobar styling to, well, infobars
we used to style infobars by using the .info, .question, .warning
and .error selectors directly, which used to be ok when we had just
styleclasses all over the place, now it needs to be more specific
or it interferes with everything with those styleclasses applied
like entries.
2016-06-25 18:17:59 +02:00
Ray Strode
0015ebc4a8 headerbar: support expand property for children
The header bar currently ignores the expand property on its
children. This commit changes the code to honor that property.

It divvies up any free space and distributes it equally to packed
children (with any left over space given out a pixel at a time
on a first come, first serve basis).

This commit also adds support for the title widget to be made
expandable.

It accomplishes this by using up the padding the title widget
is centered with.

https://bugzilla.gnome.org/show_bug.cgi?id=724332
2016-06-24 20:58:41 -04:00
Ray Strode
847a43c431 headerbar: compute nominal size of sides up front
In order to support the expand property on children, we're
going to need to look at the size of the packed children
on each side of the title widget, up front, before allocating
them (to compute how much extra allocation each expanded child
gets).

This commit lays the groundwork for that analysis by splitting
the size calculation of each side of the header bar outside
of the loop that allocates each child of the header bar.

https://bugzilla.gnome.org/show_bug.cgi?id=724332
2016-06-24 20:24:43 -04:00
Ray Strode
eccfce50d6 headerbar: simplify some size allocation code
With a headerbar, the widget in the center may be a label, constructed
internally, or a custom widget, constructed externally.  The size
allocation code needs to handle either case the same way for the most
part.  There's more than one place in the code that checks which of
the two widgets to use and does some operation on the selected one.

This commit simplifies the code by checking up front which one is the
center (title) widget and storing that in a temporary variable,
This allows reducing duplicated logic later on in the function.

https://bugzilla.gnome.org/show_bug.cgi?id=724332
2016-06-24 20:20:22 -04:00
Ray Strode
e0bebba470 headerbar: simplify calculation in size allocation code
There's some extraneous MIN() calls that have predetermined answers.

This commit drops them and then simplifies a few redudant checks into
one MIN call.

https://bugzilla.gnome.org/show_bug.cgi?id=724332
2016-06-24 20:19:32 -04:00
Matthias Clasen
8430be75ed Fix an array overrun
When I introduced the new input source enum value for
track points, I forgot that there is a fixed-size array
with names for those in the inspector.
2016-06-23 15:47:47 -04:00
Ray Strode
78eccd0db9 headerbar: don't use GTK_PACK_* as indices into array
The size allocation code maintains an array of two elements,
to track the allocation of children packed into the two sides
of a header bar. Sometimes this array is indexed with 0 and 1,
and sometimes its indexed with GTK_PACK_START and GTK_PACK_END.
The latter happen to have the values 0 and 1, respectively, but
that's not really obvious.

For clarity, this commit changes the code to index those arrays
consistently, sticking to 0 and 1 across the board.
2016-06-23 14:32:33 -04:00
Ray Strode
01eda209e1 headerbar: don't allocate both label and custom title
It's only possible to have a label or a custom title, not both.
The size allocate code confusingly treats them as independent.

That is confusing, because, as the code is written, it makes it
look like the space for the custom title isn't getting accounted
for.

This commit else-ifies some parts of the size allocate code for
clarity.
2016-06-23 14:32:33 -04:00
Emmanuele Bassi
40ee61a686 gtk: Keep Firefox working in the DrawingContext world
Firefox does a bunch of interesting things with GTK.

If the top-level GtkWindow does not have a "csd" style class associated,
Firefox will happily draw the contents of the container used to render
HTML and XUL directly on the top level's GdkWindow; on the other hand,
if a "csd" style class is found, the MozContainer will create a new
child window, and draw on it.

Then, Firefox will proceed to disable double buffering on both the
top-level window and the MozContainer (unless they are backed by the
same GdkWindow, in which case only the top-level will be
single-buffered) *and* it will add a GDK_EXPOSURE_MASK flag to the
MozContainer events for good measure (even if this is only needed for
GTK+ 2.x).

After landing the GdkDrawingContext API in GdkWindow, GTK enabled
automatic double buffering on all top-level windows backed by a native
surface, ad most users of single buffering rely on child widgets instead
of top-levels, and we'd still like to have the same double buffering
behaviour for all top-levels on all backends. Obviously, with Firefox
disabling double buffering on the top-level window, the change broke
their drawing mechanism.

Ideally, Firefox could be fixed to not disable double buffering on the
top-level window when MozContainer has a separate GdkWindow — i.e. the
CSD case — but since we did introduce a slight change of behaviour in
fringe users of the GTK+ API, let's keep backwards compatibility with
the old code for a little while longer, and create an intermediate Cairo
context unbound from the GdkDrawingContext, like we used to do until
GTK+ 3.20.
2016-06-22 11:41:59 +01:00
Carlos Garnacho
f44b9ef1f0 GtkColorEditor: Keep ref on pre-popup focus widget
And ensure it's still visible before returning the keyboard focus to it.
Because of the extra ref, add a dispose handler that will ensure the
ref is lost (by popping down), although this should be already ensured
through other paths (eg. when the popup widget loses visibility).

This fixes a possible crash in dispose paths, where we might be restoring
focus on an already destroyed widget, and at a time where, if the toplevel
is being itself disposed, no new focus should be set.

https://bugzilla.gnome.org/show_bug.cgi?id=767849
2016-06-21 17:56:34 +02:00
Carlos Garnacho
ed227f9e7b GtkPopover: Honor widget margins when calculating tail position
If there are widget margins set, the whole popover will be displaced.
However the calculation of the tail position doesn't have this into
account, ending up with the tail being detached from the popover if
the margin grew too big.

We should not render the arrows invariably next to the GdkWindow edge,
but optionally displaced inside it depending on the widget margins.
Fixes the gtk3-demo "Popovers" demo case, whose GtkEntry popovers set
widget margins for some reason.

https://bugzilla.gnome.org/show_bug.cgi?id=767851
2016-06-21 17:54:42 +02:00
Christian Hergert
3724592efb listbox: short-circuit if no sort function is set
do_sort will crash if sort_func is not defined. Instead of adding a check
there in the hot path, just check for sort_func before invalidating the
sort of the underlying GSequence.
2016-06-20 18:51:42 -07:00
Matthias Clasen
8a2812217b shortcuts: Try harder to disambiguate search items
I noticed that some of the gestures did not show up in the
search results in the builder example in gtk3-demo, because
they share the same title and don't have an accelerator to
disambiguate. Include the shortcut type to handle this case.
2016-06-19 23:24:44 -04:00
Carlos Garnacho
e33e23a6d9 treeview: Ensure the treeview has the implicit grab before grabbing focus
The cellrenderer signals might be taking the grab somewhere else, at which
point it's dubious we should attempt to take the keyboard focus into the
treeview.

This concretely breaks popovers triggered from cellrenderer signals on
button press, because the treeview will attempt to grab focus
inconditionally then.

https://bugzilla.gnome.org/show_bug.cgi?id=767468
2016-06-19 20:54:18 -04:00
Matthew Leeds
51799d41e4 GtkActionHelper: Change a message to a warning
It's almost certainly a programmer error if an action isn't
activatable because its target and parameter type don't match.
This commit changes the existing g_message to a g_warning.

https://bugzilla.gnome.org/show_bug.cgi?id=767705
2016-06-19 20:06:13 -04:00
Philip Chimento
76bacfde6e style cascade: Allow cascades with more ancestors
Previously a style cascade's parent could not have a parent itself. That
represented the two levels at which you could add a style provider: at
the screen level, with gtk_style_context_add_provider_for_screen(), and
at the style context level, with gtk_style_context_add_provider().

This commit changes no functionality, but this change will be necessary
for adding style providers in the future that apply to a subtree of the
widget tree. It relaxes the requirement that a style cascade's parent
must not have a parent, since in the future a style context may be
affected by any number of parent widgets' style contexts.

https://bugzilla.gnome.org/show_bug.cgi?id=751409
2016-06-19 19:47:05 -04:00
Matthias Clasen
1c6b878e09 shortcuts window: Fix handling of significant xml chars
We are using markup in the labels, so we need to escape things
like < and >.

https://bugzilla.gnome.org/show_bug.cgi?id=767795
2016-06-19 17:49:03 -04:00
Emmanuele Bassi
c3f4fe334d Deprecate gtk_widget_send_expose()
We have various replacements for what this function does, and we are not
calling it internally any more.
2016-06-10 16:13:27 +01:00
Tristan Van Berkom
a9a59ac55e scrolledwindow: Fix calls to gdk_window_move_resize()
This is a bit of fallout from 34feba1, now that we resolve
the has_indicators value earlier than realize, it becomes
possible to call gdk_window_move_resize() before realization.

Just added the appropriate checks.
2016-06-10 21:16:53 +09:00
Stefan Sauer
32675db490 docs: point to suggested api for deprecated functions
We deprecated a bunch of _focus_on_click() functions. Point to the new API
in GtkWidget.
2016-06-09 22:44:44 +02:00
Emmanuele Bassi
c9916fbc58 docs: Add deprecation notice for GtkButton.set_focus_on_click()
To match the deprecation annotation on the function declaration.
2016-06-09 21:35:36 +01:00
Emmanuele Bassi
c5d0522a23 Deprecate the gdk_window_begin/end_paint family of functions
They are replaced by the more appropriate gdk_window_begin_draw_frame()
and gdk_window_end_draw_frame() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
dda6a0d385 Associate the drawing context to the Cairo context
Instead of associating the GdkWindow that created the GdkDrawingContext
we can directly bind the Cairo context to the GDK drawing context.

Cairo contexts created via gdk_cairo_create() go back to not having a
GdkWindow associated to them, like they did before we introduced the
gdk_window_begin_draw_frame() API.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
a7ef37da2a Add GdkDrawingContext
Instead of giving out Cairo contexts, GdkWindow should provide a
"drawing context", which can then create Cairo contexts on demand; this
allows us to future proof the API for when we're going to use a
different rendering pipeline, like OpenGL.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Emmanuele Bassi
2c7b21718f Simplify the widget rendering entry point
Now that GDK has the appropriate API, we can simplify the widget drawing
code into a single function.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Tristan Van Berkom
34feba1e7c scrolledwindow: Resolve whether we use overlay scrollbars early.
Widgets should support size requests before being realized in general,
otherwise this can cause flicker/resize at initial display time as
the toplevel window can make a request before realize/allocate.

This also makes the added testsuite/gtk/scrolledwindow.c test work again,
this was broken because we only ever calculate whether we are going
to use overlay scrollbars once the scrolled window is realized (and
the test case does not realize any window).
2016-06-09 14:57:10 +09:00
Tristan Van Berkom
d7e242eec0 scrolledwindow: Bug 766569 - General size request fixes.
This patch does a couple of things:

  o Removes the obscure 'extra_width' and 'extra_height' variables
    making the request code exceedingly difficult to read

  o Fixes the max-content-size properties introduced in bug 742281
    so that they do not grow the minimum request.

  o Cleanup of request code in general:
    - min/max content sizes are clamped around the child request as needed
    - scrollbar requests are only added in one place, after child request
      sizes are calculated and without the extra_width/height thing.
2016-06-09 14:57:10 +09:00
Jakub Steiner
6de0ecb78e HC: focus outline more prominent
- make visible regardless of colors used
- make larger and more inset

https://bugzilla.gnome.org/show_bug.cgi?id=767310
2016-06-08 08:38:19 -04:00
Lapo Calamandrei
199ad2c14b Adwaita: .osd button.color
remove box-shadow from colorbutton colorswatch when an ancestor has
the osd styleclass applied.
2016-06-08 13:39:39 +02:00
Lapo Calamandrei
a0ee8f7f0a Adwaita: centralize outline-color
define outline-color generally using alpha(currentColor, 0.3),
which avoids setting it in a bunch of different places.
2016-06-08 13:28:07 +02:00