Commit Graph

27264 Commits

Author SHA1 Message Date
Daniel Boles
1301723905 Revert "combobox: remove superfluous GTK+ grabs"
This reverts commit 46b4e5d388.

Apparently these weren’t so redundant, because their removal introduced
at least 2 bugs in list-mode ComboBoxes: failure to close the popup upon
clicking out of it, and failing to receive mouse input in the popup of a
CB in a modal window. It may also have caused (even more!) stuck grabs.

https://bugzilla.gnome.org/show_bug.cgi?id=738387
https://bugzilla.gnome.org/show_bug.cgi?id=776793
2017-08-28 20:00:59 +01:00
Daniel Boles
c789bf7718 ComboBox: Really set list-mode popup transient-for
set_transient_for(toplevel) was only called in list_setup(). It was easy
to make a test showing a NULL :transient-for instead of the correct one.

So, move the call from list_setup() to popup_for_device(). Also do that
for window_group_add_window(), which means not calling it redundantly.

(I tried using a ComboBox:parent-set handler, but the Inspector’s CB
didn’t like that: it calls popup_for_device() twice and closes on button
release. Anyway, using popup() is much more concise than a new handler.)
2017-08-28 20:00:17 +01:00
Daniel Boles
70534de382 ComboBox: List-mode popup must open on CB’s screen
The screen for the list-mode popup_window was only being set in
set_popup_widget(), i.e. when changing modes, so if the ComboBox was
moved to a different screen later, the popup would appear on the
original one, which is wrong.

Worse, this (somehow) broke opening some combos in the Inspector.

Fix this by moving the call to set_screen() to popup_for_device(), so
the popup_window is put on the correct screen each time around.

https://bugzilla.gnome.org/show_bug.cgi?id=468868
https://bugzilla.gnome.org/show_bug.cgi?id=786771
2017-08-28 19:33:54 +01:00
Julius Härtl
f68421376b gtkplacessidebar: remove oversight of old code
https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-08-28 08:13:12 +02:00
Carlos Garnacho
26d8a6dfba menu: Avoid cancelling the menu on GTK+ grabs inside the GtkMenu
Allows again sliders as menuitems, broken by commit 9b032073.

https://bugzilla.gnome.org/show_bug.cgi?id=786029
2017-08-27 20:43:11 +01:00
Daniel Boles
d1d8658898 PlacesSidebar: Avoid warning about unused variable
end_icon is only used if HAVE_CLOUDPROVIDERS is defined, so only declare
it under the same condition.

https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-08-27 15:37:34 +01:00
Daniel Boles
53e0bd91e6 SidebarRow: need config.h for HAVE_CLOUDPROVIDERS
https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-08-27 15:37:34 +01:00
Matthias Clasen
45b54041ed emoji: Use the right gettext domain
Otherwise, strings are not translated.

https://bugzilla.gnome.org/show_bug.cgi?id=786841
2017-08-26 10:26:47 -04:00
Julius Härtl
a446da7eb6 gtkplacessidebar: implement libcloudproviders support
Add integration of the libcloudproviders DBus API to the
GtkPlacesSidebar by showing name and sync status of the cloud providers.
The exported menu is rendered as a GtkPopover.

The sidebar will be updated if the list of cloudproviders changes e.g.
by adding or removing an account. If any cloud provider changes detailed
information like sync status only the individual sidebar row gets
updated.

Co-authored-by: Carlos Soriano <csoriano@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-08-25 16:58:21 -04:00
Daniel Boles
696b9a5df7 ComboBox: Use iter before popdown() may invalidate
Bad actors, such as our very own FileChooserButton, may connect to the
:popped-up property and alter the model as the menu becomes in/visible.

We were getting an iter to the model while popped-up, then doing
popdown(), then using the iter, which may have just been invalidated by
the errant notify::popped-up handler. If so, we quickly crash fatally.

This is clearly bonkers, but until such patterns are removed, we have to
work around them. So, set_active() from the clicked item while it is
known to be valid, by moving the call to set_active() before popdown().

While here, change set_active_iter(iter) to set_active_internal(path) to
avoid pointlessly going through the iter to get the path we already have

https://bugzilla.gnome.org/show_bug.cgi?id=729651
2017-08-25 21:00:51 +01:00
Daniel Boles
32553ad3a2 Expander: Also hide child GdkWindow when collapsed
Just adding/removing to/from the BoxGadget is not sufficient; that
leaves the GdkWindow hanging around, taking input, changing the cursor,
and all sorts of other nefarious shenanigans.

Resolve by ensuring the child’s GdkWindow is unmapped if collapsed.

Note: the reflexive solution is just to set_visible(child, expanded),
but it is best to avoid messing with the child’s :visible property.

https://bugzilla.gnome.org/show_bug.cgi?id=776937
2017-08-24 21:18:55 +01:00
Daniel Boles
4ac58badf6 ComboBox: Clarify documentation of get_active_iter
https://bugzilla.gnome.org/show_bug.cgi?id=618160
2017-08-24 20:57:01 +01:00
Daniel Boles
947bca195c Popover: Include window shadows in overshoot calcs
.update_position() enforces that non-Wayland platforms must position a
Popover within its parent Window. We use the allocation of the Window
to translate the position and check for overshoot on each of its sides.
Calling Widget.get_allocation() of a CSD Window includes its shadows.

But shadows were not excluded from the area in which we can position.
Thus, Popovers could get positioned in the shadow of CSD windows, where,
at least on X11, no input is received. Therefore, positioning a Popover
over a shadow meant its child widgets within that area became unusable.

Fix by calling Window.get_shadow() and including it in the overshoot on
each side. This adjusts for how the allocation includes shadows, making
overshoots with and without shadows the same. Thus, we avoid considering
shadows as viable for positioning, favouring a side where input works.

https://bugzilla.gnome.org/show_bug.cgi?id=786209
2017-08-24 20:57:01 +01:00
Daniel Boles
0969419610 SidebarRow: Add Unmount tooltip to eject_button
It was reported that the lack of a tooltip made its purpose unclear.
This can be solved by just copying PlacesViewRow’s eject_button tooltip.

https://bugzilla.gnome.org/show_bug.cgi?id=766909
2017-08-23 21:41:47 +01:00
Tom Schoonjans
b9b4684740 GtkFileChooserNativeQuartz: restore parent focus after closing dialog
Tested for both modal and non-modal dialogs

https://bugzilla.gnome.org/show_bug.cgi?id=785306
2017-08-23 10:45:30 -04:00
Tom Schoonjans
bed1bd1a0c GtkFileChooserNativeQuartz: improve support for file filters
Instead of using conditional compilation, use respondsToSelector to
check at runtime for setAccessoryViewDisclosed.

https://bugzilla.gnome.org/show_bug.cgi?id=785306
2017-08-23 10:45:30 -04:00
Tom Schoonjans
fb59b090d6 GtkFileChooserNativeQuartz: add support for Mountain Lion and Mavericks
https://bugzilla.gnome.org/show_bug.cgi?id=784723 introduced support for
native file chooser dialogs on macOS, but due to the use of generics in
the patch, there will be compilation errors on pre-Xcode 7 platforms,
such as Mountain Lion and Mavericks.

I strongly recommend to revert this patch when the oldest supported
macOS release is bumped to Yosemite (10.10).

https://bugzilla.gnome.org/show_bug.cgi?id=785306
2017-08-23 10:45:30 -04:00
Matthias Clasen
cfdb9f95dc Handle emoji data change in emoji chooser
Update the settings schema to follow the change in Emoji data,
and make the emoji chooser code handle the new format.
2017-08-22 08:20:03 -04:00
Matthias Clasen
bdff792462 Add shortnames to emoji data
The json file is from

https://github.com/emojione/emojione/tree/master/extras/alpha-codes

It is under the MIT license.
2017-08-22 08:19:56 -04:00
Matthias Clasen
7a3126f4bb Don't consume too many key releases
The Emoji input support in GtkIMContextSimple was
unintentionally consuming too many key release
events. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=786594
2017-08-22 06:41:31 -04:00
Carlos Garnacho
2218b5a116 gtkbutton: Avoid keyboard grabs
Seems to be there for the sole purpose of ensuring the button
shall receive the key release on keyboard-triggered activation.

For the cases where this makes sense (eg. comboboxes, menubuttons,
...) gtk+ already does ensure the menu is popup after key release.
This makes the grab pretty useless, and there's many other cases
where it doesn't make sense (eg. button being activated
programmatically from an event handler in another widget).

Fixes button activation unintendedly triggering shortcut inhibition
on wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=786480
2017-08-18 20:45:07 +02:00
Daniel Boles
99c8e30c02 ScrolledWindow: Bin unreachable ternary branches
We already checked that the child is not NULL above.

Coverity CID 1454191
2017-08-15 20:32:56 +01:00
Daniel Boles
3249b351af Widget: Fix outdated comments about tooltips
They are not usually yellow anymore, the previous advice about how to
style them was for pre-3.20 versions, and the immediate replacement (CSS
class .tooltip) does not seem ready for primetime.

https://bugzilla.gnome.org/show_bug.cgi?id=784421
2017-08-15 19:17:33 +01:00
Chun-wei Fan
7b240ae298 gtk/gtkemojichooser.c: Don't use g_autoptr()
We can't use g_autoptr() on non-GCC-style compilers.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-08-15 23:40:18 +08:00
Matthias Clasen
4cb9ba57b4 Remove an erroneous unref
This was leftover by accident.
2017-08-15 06:41:19 -04:00
Matthias Clasen
c56545f721 Redo emoji data slightly
No longer store variation sequences explicitly. Instead, put a 0
in the sequence where the modifiers will be inserted. This is more
compact, and it allows us to put variations directly into the
recent section. Update the type of the recent-emoji setting to
match these changes.
2017-08-15 06:41:19 -04:00
Matthias Clasen
f27d928e33 Don't update headings in an idle
It is not necessary since flow box invalidation is
all synchronous currently. If that ever changes,
this code will need adjustment.
2017-08-15 06:41:18 -04:00
Matthias Clasen
c7061d88a2 emoji: Fix a leak
We were leaking the list of recently used Emoji here.
Pointed out by Timm Bädert.
2017-08-13 07:52:31 -04:00
Matthias Clasen
66d9f4fe95 emoji: Start search on the first character
There is no need to wait for a longer prefix here.
We already display all the content anyway, it will
only get less.
2017-08-13 07:52:19 -04:00
Matthias Clasen
3b493d2937 Drop a redundant helper
We already had a function that does exactly what
is needed here.
2017-08-13 07:52:04 -04:00
Matthias Clasen
e6fd4837a2 Remove an unused field
Nothing uses bubble_window, so it can go.
2017-08-13 07:52:04 -04:00
Daniel Boles
127cc11e30 InfoBar: Fix wrong/uninit var use in code example
https://bugzilla.gnome.org/show_bug.cgi?id=786144
2017-08-12 21:08:05 +01:00
Daniel Boles
e85cea7b3d Adwaita: Sync CSS files with current SASS
A recent commit for emoji also updated seemingly unrelated parts of the
generated CSS files, presumably due to other things that changed in
master. The CSS files should be kept in sync with their SASS sources.
2017-08-12 15:49:07 +01:00
Daniel Boles
53ce02344c LevelBar: Avoid unnecessarily copying allocation
Just use the original allocation, instead of copying it and passing that
2017-08-12 14:25:56 +01:00
Daniel Boles
bfafe9aaee convert-emoji: Add missing braces 2017-08-12 14:06:09 +01:00
Daniel Boles
929108d31a convert-emoji: Don’t pointlessly do rest of loop
skip can never become FALSE again, so break as soon as it becomes TRUE.
2017-08-12 14:04:35 +01:00
Piotr Drąg
9b49baa992 emojichooser: Add context to the Objects category string
To disambiguate it from Objects in the Inspector.
2017-08-11 22:18:50 +02:00
Matthias Clasen
d56505f74d entry: Add support for an Emoji chooser
Add an "Insert Emoji" item to the context menu in entries.
We also add a show-emoji-icon property, which when set to
TRUE, will add an icon that can be clicked to bring up
the Emoji chooser.
2017-08-11 15:43:49 -04:00
Matthias Clasen
340c520bd0 Fix a problem with focus handling in modal popovers
When the popover is dismissed, we return the focus to
where it came from. However, by using gtk_widget_grab_focus,
we were messing up the selection if that widget happens to
be an entry. Special-case GtkEntry and use
gtk_entry_grab_focus_without_selecting to avoid this issue.
2017-08-11 15:42:54 -04:00
Matthias Clasen
45b2e162ae Add an Emoji chooser widget
Add a popover that shows color Emoji, with a search entry.
The recently-used Emoji are stored in a GSetting.
2017-08-11 15:42:54 -04:00
Matthias Clasen
a584bcb88e Add Emoji data
The json file is imported from the (MIT-licensed) emoji.json[0] node
module, which generates it from the emoji list published by the
Unicode Consortium.

This commit also adds a little tool to convert the data into
a compact GVariant, and the result of that conversion, which is
added to libgtk as a resource. The following commits will make use
of it.

[0] https://github.com/amio/emoji.json
2017-08-11 15:04:07 -04:00
Daniel Boles
8a22e3598d Revert "levelbar: Don't underallocate block widgets"
This reverts commit 78b4885fe8.

That commit causes a block always to be shown at the min side, even when
the value is 0, in which case, no fill should be shown.

https://bugzilla.gnome.org/show_bug.cgi?id=783649
2017-08-08 18:59:03 +01:00
Chun-wei Fan
7f065b379c gtk/gtkfilechoosernativewin32.c: Declare variables at top-of-block
Since GTK+-3.22.x is not advertised to use C99, make sure that the build
works on pre-C99 compilers such as pre-2013 Visual Studio.
2017-08-08 17:13:34 +08:00
Matthias Clasen
f534c971df Avoid the use of g_autofree
We can't use this in code that may be built on win32,
so lets just not use it at all.
2017-08-08 17:10:00 +08:00
Daniel Boles
a6a547c2e0 Layout: Fix documentation on getting the GdkWindow
Members are not public like they used to be, so accessors must be used.
2017-08-08 00:00:55 +01:00
Daniel Boles
4ce5bed724 Revert "Widget: Remove obsolete hack-arounds for HandleBox"
This reverts commit 12805a4fbf.

I must have been looking at the wrong tree because HandleBox is only
deprecated in GTK+ 3, not removed.
2017-08-07 19:38:12 +01:00
Daniel Boles
cf955a5459 Container: Don’t scroll to unset focus child coord
In gtk_container_real_set_focus_child(), we try to scroll to the
position of the new :focus-child if we have h or v adjustments.

gtk_widget_translate_coordinates() returns FALSE if neither widget is
realized or in other situations that cause output parameters x and y not
to be set. Thus, if the caller did not initialise x/y and uses them even
if the function returns FALSE, they are using uninitialised variables.

In gtk_container_real_set_focus_child(), we did not check the return
value but merrily went ahead and used x and y regardless. This is UB, as
caught by Valgrind, as well as being pointless.

The trivial fix is to exit early if (!gtk_widget_translate_coordinates).

https://bugzilla.gnome.org/show_bug.cgi?id=776909
2017-08-07 19:21:03 +01:00
Daniel Boles
12805a4fbf Widget: Remove obsolete hack-arounds for HandleBox
It is long gone. The commit c9d9db0fcc
identified these as ugly-but-functional workarounds for it, only.

https://bugzilla.gnome.org/show_bug.cgi?id=776909
2017-08-07 18:48:18 +01:00
Debarshi Ray
65b18a4fc1 main: Set the error if gtk_init_with_args fails
This fixes a fallout from 8a7d0ab481 where the error wasn't being
set when a display couldn't be opened right after parsing the
commandline.

It also fixes an older bug where the error would be left unset if the
commandline had already been parsed before (ie. when gtk_initialized
is TRUE).

https://bugzilla.gnome.org/show_bug.cgi?id=771959
2017-08-07 19:34:55 +02:00
Debarshi Ray
66b24f29e1 docs: gtk_init_with_args will also fail if the commandline was invalid
Be more explicit to match the gtk_init_check documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=771959
2017-08-07 19:34:55 +02:00