Commit Graph

48934 Commits

Author SHA1 Message Date
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
Matthias Clasen
e1cf6281fe 3.22.18 2017-08-07 19:36:19 -04: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
Debarshi Ray
1031fa914a docs: gtk_init_check will also fail if the commandline was invalid
The existing documentation seems to suggest that gtk_init_check will
ignore any failure to parse the commandline arguments, and that its
return value only depends on its ability to initialize the windowing
system. That's not true.

Be more explicit to avoid misunderstandings.

https://bugzilla.gnome.org/show_bug.cgi?id=771959
2017-08-07 19:34:55 +02:00
Daniel Boles
2b049d5d66 AccelLabel: set_accel_closure() arg is nullable 2017-08-07 10:33:05 +01:00
Daniel Boles
777caab077 AccelLabel: set_accel_widget() arg is nullable 2017-08-07 10:29:00 +01:00
Matej Urbančič
b5b0c57a95 Updated Slovenian translation 2017-08-07 09:13:06 +02:00
Daniel Boles
69576cd510 HeaderBar: Use less clashing appmenu fallback icon
process-stop-symbolic is unintuitive if represented as a stop sign as in
Adwaita, and completely ambiguous if represented as a cross like the
window close button in other icon themes.

Instead, use application-x-executable, which is already used elsewhere
as a fallback if no specific icon can be found for the application.

https://bugzilla.gnome.org/show_bug.cgi?id=784624
2017-08-06 18:07:30 +01:00
Daniel Boles
f70796dea3 docs: gtk/running: Document the GTK_CSD env var
It was not documented before.

https://bugzilla.gnome.org/show_bug.cgi?id=778791#c1
2017-08-06 17:42:17 +01:00
Daniel Boles
b03f787a99 AccelLabel: Fix typos of Ctl to Ctrl 2017-08-06 17:38:08 +01:00
Daniel Boles
fd5e929905 icon-browser: Add missing document-edit icon
https://bugzilla.gnome.org/show_bug.cgi?id=777515
2017-08-06 03:24:06 +01:00
Daniel Boles
9d532da2dd gdkdisplay: Remove a pointless assignment 2017-08-06 01:12:08 +01:00
Matthias Clasen
43195fd997 Enough with the beeping!
Don't beep when modifiers are released in entries.
This was an inadvertent change that snuck in with
the emoji support.

Also, don't beep while entering an emoji name.
There is entirely too much beeping here.
2017-08-05 19:33:28 -04:00
Daniel Boles
c48297ed12 AccelLabel: Fix displaying accel unichars >= 0x80
In GTK+ 2, the ch < 0x80 was ORd with klass->latin1_to_char, and that
was unconditionally set to TRUE in the class init function, so
effectively the ch < 0x80 never mattered before or served any purpose.

When klass->latin1_to_char was deleted from the class in commit
f760538f17, this check’s sense changed.

The resuls was that accel keyvals with gunichar value >= 0x80 stopped
being rendered as symbols, instead falling back to their keysym name.
Instead of recognisable symbols for these, we get raw, often obscure,
and untranslatable keysym names. This breaks accessibility as well as
client users who may be parsing such accels and migrating from GTK+ 2.

So, remove the < 0x80 to restore the behaviour from before said commit.

https://bugzilla.gnome.org/show_bug.cgi?id=783906
2017-08-05 20:28:08 +01:00
Matthias Clasen
a86de5905c Add support for entering emoji by name
This commit adds some basic support for entering emoji by name
to GtkIMContextSimple. To begin an emoji sequence, use Ctrl-Shift-e
instead of Ctrl-Shift-u that is used for hex input. Otherwise, the
behavior is the same: you can can let go of the modifier keys and
end the sequence with space or enter, or hold on to the modifier
keys and end the sequence by releasing them.

Only a limited, fixed set of names is supported at this time, see
the GtkIMContextSimple docs for a full list.
2017-08-04 14:57:05 -04:00
Timm Bäder
78b4885fe8 levelbar: Don't underallocate block widgets
https://bugzilla.gnome.org/show_bug.cgi?id=783649
2017-08-04 01:50:58 +01:00
Daniel Boles
46a8559cd4 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:18:49 +01:00
Daniel Boles
fe5f650088 widget-factory: Add tooltip to Entry icon
just to show we can.
2017-08-03 20:42:54 +01:00
Daniel Boles
9af612d314 Fix some nullable Returns annotations
based on reports and patches by Iñaki García Etxebarria:

https://bugzilla.gnome.org/show_bug.cgi?id=781246
https://bugzilla.gnome.org/show_bug.cgi?id=785423
2017-08-03 20:26:20 +01:00
Daniel Boles
4ba86706be GtkFixed: Update documentation intro
• Add GtkLayout as a @See_also since it includes fixed-pos functionality
• Drop mention of the long-gone Linux framebuffer port
• Explain how to work around the problems with RTL text
2017-08-03 13:02:20 +01:00
Jiri Grönroos
ef7ee16368 Update Finnish translation 2017-08-03 09:51:38 +00:00
Timm Bäder
8a17848f02 entry: get_icon_area returns in entry coordinates
Document what the returned coordinates are relative to.
2017-08-03 10:23:27 +01:00
Daniel Boles
5acee3a3e0 Layout: Tweak documentation blurb
Being addable to a ScrolledWindow is not interesting; now that SW
auto-adds a Viewport if needed, so can DrawingArea and any other widget.

Mention GtkFixed in case the reader just wants that bit of functionality
2017-08-03 10:18:14 +01:00
Olivier Fourdan
1c23bce350 wayland: add shortcut inhibitor support
This adds support for the shortcut inhibitor protocol in gdk/wayland
backend.

A shortcut inhibitor request is issued from the gdk wayland backend for
both the older, deprecated API gdk_device_grab() and the new gdk seat
API gdk_seat_grab(), but only if the requested capability is for the
keyboard only.

https://bugzilla.gnome.org/show_bug.cgi?id=783343
2017-08-02 12:38:52 +02:00
Daniel Boles
7dd3349751 bindings: Avoid iterating array if it is never set
If query.return_type is not one we want, binding_compose_params() is
not called, and so params remains a NULL pointer. However, the code was
then unconditionally iterating it regardless. Don't if it is still NULL.

CID 1452218 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
15. var_deref_op: Dereferencing null pointer params.
2017-08-01 20:41:23 +01:00
Daniel Boles
6063a89235 cssselector: Ensure we do not index out of bounds
This would only happen if the last element was deprecated, but it should
be avoided anyway.

CID 1388852 (#1 of 1): Out-of-bounds read (OVERRUN)
12. overrun-local: Overrunning array pseudo_classes of 16 32-byte
elements at element index 16 (byte offset 512) using index i + 1U (which
evaluates to 16).
2017-08-01 20:16:40 +01:00
Daniel Boles
a381a06b12 Notebook: Remove null check after dereference
This function clearly assumes the parameter children cannot be NULL, and
the call sites seem to perform enough checks to confirm this.

CID 1388869 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking children suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
2017-08-01 20:15:15 +01:00
Daniel Boles
cd7e5fae22 Calendar: Add default case to appease Coverity
CID 1432024 (#1 of 1): Uninitialized scalar variable (UNINIT)
2. uninit_use_in_call: Using uninitialized value rect.x when calling
calendar_arrow_rectangle.

Add a default case to the switch which will bail out with
g_assert_not_reached(), which should reassure Coverity that the method
is always called with a valid value that is handled in the switch.
2017-08-01 20:15:15 +01:00
Daniel Boles
5e6293e54f cssbordervalue: Fix possible use of uninitialised
If value->values[i] is NULL, then values[i] was left uninitialised.
The code then reads each element of values[].

CID 1432029 (#1 of 1): Uninitialized pointer read (UNINIT)
11. uninit_use: Using uninitialized value values[i].
2017-08-01 20:12:44 +01:00
Timm Bäder
0b230d34c4 scrolledwindow: Remove useless function call
We never use the result.
2017-08-01 19:10:10 +01:00
Daniel Boles
1088056a5d Widget: Do not dereference before type check 2017-08-01 18:54:12 +01:00
Timm Bäder
505d5e41c2 gtkapplication: g_dbus_proxy_new_sync can return NULL
Specifically, in the case where @error is set.
2017-08-01 18:54:12 +01:00
Daniel Boles
df10ec7b9b Entry: Fix unset icon tooltip hiding Entry tooltip
Our ::query-tooltip handler first checks whether the pointer is over any
of the icons, returning their tooltip if so, and if not chains up to
Widget::query-tooltip in order to show the text for the widget overall.

But ensure_has_tooltip(), which exists to update :has-tooltip based on
whether ::query-tooltip is needed, only set :has-tooltip to TRUE if any
icon had a tooltip, without caring whether the widget as a whole does.

That is asymmetrical and meant that if the Entry had a tooltip, but
subsequently all icons had their tooltips unset, :has-tooltip would be
set to FALSE, and hence the tooltip for the widget would become lost.

The fix is to set :has-tooltip to TRUE if the widget has a tooltip of
its own, and we only need to check the icons if that is not the case.

https://bugzilla.gnome.org/show_bug.cgi?id=785672
2017-08-01 18:10:38 +01:00
Daniel Boles
ce792384c5 Entry: Warn about corner case hiding icon tooltips
https://bugzilla.gnome.org/show_bug.cgi?id=785672#c4
2017-08-01 18:10:38 +01:00
Daniel Boles
3680e3d40b Entry: Fix get_icon_at_pos()
This was comparing the input position, which is documented as being
relative to the top-left of the Entry allocation, to icon allocations
that were not adjusted accordingly. This could result in tooltips for
icons not being shown in various conditions, since the ::query-tooltip
handler uses get_icon_at_pos() to check whether to show an icon tooltip.

The fix is to compare to the icon border box, not border allocation, as
CssGadget::get_border_box() adjusts relative to the widget. Better yet:
we can just make CssGadget::border_box_contains_point() compare for us.

Delegating to Entry::get_icon_area(), which manually reimplements
CssGadget::get_border_box(), would also work, but this is simpler.

https://bugzilla.gnome.org/show_bug.cgi?id=780938
2017-07-31 20:05:11 +01:00
Daniel Boles
ad06a08b99 testentryicons: Set tooltips on all icons
Just to test tooltips in all cases; what was already here
should have been sufficient, but this doesn't hurt.

While here, also add some instructive placeholder text.

https://bugzilla.gnome.org/show_bug.cgi?id=780938
2017-07-31 20:05:11 +01:00
Timm Bäder
d9170e1978 entry: make sure priv->current_pos is valid
We can e.g. get the entry dispose()d and a focus_out event after that
(because the toplevel unsets the focus which previously was the entry).
We then later use priv->current_pos in a call to pango API which makes
sure the given index is valid for the given layout. Since we lazily
create a GtkEntryBuffer in get_buffer() and a PangoLayout lazily in
gtk_entry_create_layout, these 2 are always valid but don't match
priv->current_pos in this situation.

Fix this by resetting priv->current-pos in dispose().

https://bugzilla.gnome.org/show_bug.cgi?id=785255
2017-07-31 20:05:04 +01:00
Matej Urbančič
a30220d4e3 Updated Slovenian translation 2017-07-27 15:53:08 +02:00
Matej Urbančič
c0d88a5b7b Updated Slovenian translation 2017-07-27 15:51:09 +02:00
Carlos Garnacho
9b032073cb gtkrange: Instaurate GTK+ grabs while manipulating ranges
It should not be necessary for most situations, except while there's
GDK grabs coercing events in a different way.

https://bugzilla.gnome.org/show_bug.cgi?id=782870
2017-07-26 12:53:33 +02:00
Carlos Garnacho
54c26e0983 gtkgesture: Do not ignore events from other GdkWindows than the widget's
There's GDK grab situations (eg. pointer motion outside the grab window
in combination with a GTK+ grab) where a gesture may receive events from
windows that are not the widget's.

The _update_widget_coordinates() still does work for those situations, so
just let these events go through instead of ignoring them.

https://bugzilla.gnome.org/show_bug.cgi?id=782870
2017-07-26 12:48:44 +02:00
Carlos Garnacho
d6d4217f3d gtklabel: Fix touch link handling under wayland
Refactor the code updating the active link under the current coordinates
into a separate function, and call it on GtkGestureMultiPress::pressed
so the link is updated on GDK_TOUCH_BEGIN. Based on a patch by
Jan-Michael Brummer <jan.brummer@tabos.org>.

https://bugzilla.gnome.org/show_bug.cgi?id=776903
2017-07-25 18:36:12 +02:00
Carlos Garnacho
0daf796763 gtklinkbutton: Set cursor on button's event window
Setting the cursor on the widget window (i.e. the parent widget's) is
finicky because the cursor needs to be updated on crossing events, and
will yield the wrong result for other master devices that happen to be
in other areas of the same parent widget's window.

Just set it always on the event window created by the GtkButton parent
class. That window was causing the crossing events, so the rectangle
that gets the hand cursor set will be the same size, and we don't need
to track pointer crossing state that way.

https://bugzilla.gnome.org/show_bug.cgi?id=785375
2017-07-25 18:36:12 +02:00
Carlos Garnacho
b53a6fb092 wayland: Clear tablet tool cursor on proximity out
This ensures that the tablet tool will get the cursor updated even if it
happens to fall within the same window again on the next proximity in.

https://bugzilla.gnome.org/show_bug.cgi?id=785375
2017-07-25 18:36:12 +02:00
Carlos Garnacho
18eeaf704e gdkwindow: Update cursor for tablet tools in the window
This check must be done explicitly on Wayland as the master device for
tablet tools differ from the Core Pointer. This ensures that whenever a
tablet tool is inside a window and the cursor is programmatically changed,
it will be visually updated too.

https://bugzilla.gnome.org/show_bug.cgi?id=785375
2017-07-25 18:36:12 +02:00