Commit Graph

50397 Commits

Author SHA1 Message Date
Philip Chimento
df0e5cc8e6 quartz: Fix crash when realizing GtkOffscreenWindow
GtkOffscreenWindow doesn't have a NSView or NSWindow, so return NULL if
passed one of those.

Closes: #379
2018-10-19 05:38:28 +01:00
Dorota Czaplejewicz
28ac1a2cba imwayland.c: fix formatting 2018-10-17 12:51:07 +00:00
Matthias Clasen
00034c00be Merge branch '1371-flickering-tooltips-if-no-mouse-cursor-theme-loaded-gtk3' into 'gtk-3-24'
Tooltip: Fix the used cursor size if 0 in Settings

See merge request GNOME/gtk!374
2018-10-16 23:20:25 +00:00
Matthias Clasen
c0b5d66069 Merge branch '1397-gtknotebook-built-in-popup-menu-listing-tabs-doesn-t-use-tab-label-text-for-the-last-tab' into 'gtk-3-24'
Notebook: Ensure menu label updates with tab_label

See merge request GNOME/gtk!385
2018-10-16 20:52:04 +00:00
Benjamin Otte
2453e71fd3 Merge branch 'win32-fix-dnd-info-disposal' into 'gtk-3-24'
Fix DND info disposal

See merge request GNOME/gtk!390
2018-10-16 19:41:03 +00:00
Руслан Ижбулатов
4172138154 DnD: fix setting icon in drag-begin
Commit 1c96b703 changed the way icon
information is given to DnD. Previously an icon helper was kept at
the drag source site. Now an image definition is stored there.
The difference is that icon helper is an object that changes its
state in response to an icon being set, thus the object survived
multiple icon changes. Whereas image definition is destroyed and
re-created from scratch every time a drag icon is changed.
This created a problem where gtk_drag_begin_internal() would receive
the value of site->image_def when a drag just began, then it emits
"drag-begin" signal, in response to which an application can
set drag icon, changing the value of site->image_def. However,
gtk_drag_begin_internal() is unable to know about that change and
continues to use the old value it received from up the stack.

Not only does it prevent drag icon from being set from "drag-begin",
it also can induce a crash, since the old image_def value used
by gtk_drag_begin_internal() points to a freed memory region.

Fix this by only setting a default icon (which is created in-place)
in gtk_drag_begin_internal() if the caller does not care about icons.
Otherwise gtk_drag_begin_internal() will return a boolean that indicates
whether an icon needs to be set. Then the caller can invoke
gtk_drag_set_icon_definition() to set the icon, if needed.

Fixes #1407.
2018-10-16 19:04:54 +00:00
Dorota Czaplejewicz
3d6510329f imwayland: rearrange functions to remove prototypes 2018-10-16 16:38:24 +00:00
Dorota Czaplejewicz
c477201afc imwayland: Handle enter and leave events
Before this patch, imwayland would assume that text-input enter and leave events follow the general (wl_keyboard) focus, and was unable to handle the situation where they would not be provided at the same time.
2018-10-16 16:29:08 +00:00
Руслан Ижбулатов
5e00fd25da Fix GtkDragSourceInfo disposal
gtk_drag_clear_source_info() immediately unrefs the info attached
to the context (the very same info we're in the process of destroying
in gtk_drag_source_info_free()). If that reference was the last one,
then accessing the info object after that is a use-after-free error.
Also, change the order a bit to first free the event, and only then
unref the context.

Fix this by copying all the fields of the info that we need, and
then working with these copies.
2018-10-16 03:07:13 +00:00
LRN
05b11e9a5b Merge branch 'lrn/zorder-324' into 'gtk-3-24'
Don't let the OS maintain relative Z-order for windows

See merge request GNOME/gtk!196
2018-10-15 22:36:30 +00:00
Uli Schlachter
9ca38c4647 Fix race in GtkPlug window creation
According to the XEmbed specification, a window should be created
"elsewhere" and then reparented into the target parent window. Instead,
GTK+ creates the window directly in desired target parent window. This
allows some races to occur.

Another program that does not follow XEmbed is tabbed. XEmbed requires
an _XEMBED_INFO property on the to-be-embedded window, but tabbed does
not check for this property. Thus, as soon as GTK+ creates its window,
tabbed starts managing this window and now GTK+ setting up the window
races with tabbed starting to manage the window.

If tabbed is fast enough to map the window, GTK+ never sees a MapNotify
event, because it did not yet select StructureNotifyMask on its window.
This results in a black window inside of tabbed.

Note that this cannot really be fixed in tabbed, since XEmbed says that
the _XEMBED_INFO property must be already present when the window
appears. Thus, patching tabbed to wait for _XEMBED_INFO to appear is not
something that the spec requires/allows.

Instead, this commit changes GTK+ so that it directly sets the right
event mask when the window is created. This means that there is no more
race between tabbed mapping the window and GTK+ selecting
StructureNotifyMask.

Note that the proper fix would be to do as XEmbed requires: Create the
window elsewhere and then reparent it into the target window. However,
that would require a more invasive patch, so this commit only takes the
"easy approach" of fixing this one race. Hopefully, all the other races
that can occur during window setup are harmless, because the
embedder/socket will hopefully watch for PropertyNotify events as
needed.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/757
See-also: https://github.com/awesomeWM/awesome/issues/2385
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-14 14:01:25 +02:00
Timm Bäder
dbbc7b3859 emojichooser: Pass chooser to add_emoji
https://gitlab.gnome.org/GNOME/gtk/issues/1398
2018-10-13 14:01:08 +01:00
Daniel Boles
2856fb86a9 Adwaita: Regenerate CSS for new window.devel style
Commit 955aa8d54b forgot this, again.
2018-10-12 23:55:02 +01:00
Daniel Boles
80a3d7090a Notebook: Ensure menu_label updates with tab_label
This was noticed in Firefox and demonstrated using a GtkBuilder ui file.
buildable_add_child() calls set_tab_label(), but the latter did nothing
to update the menu_label corresponding to that tab with the new text.
Using Builder to populate the tab child, only tabs other than last got
the right non-default labels, and even that was mostly coincidental, as
adding the main child called update_labels() via real_insert_page(), so
it took effect when the 2nd last main child is added, updating the rest
but leaving the last with the default label, not that given in Builder.

Fix by factoring out the code from child_reordered() to a new helper
menu_item_recreate() and calling that in set_tab_label(), so that
whenever the tab_label is updated, so is its corresponding menu_label.

This fixes the reported case and presumably others that we could write.

fixes https://gitlab.gnome.org/GNOME/gtk/issues/1397
2018-10-12 23:49:29 +01:00
Daniel Boles
82c5308947 Notebook: Don't notify 2x from set_tab_label_text
It calls set_tab_label(), which already does that.
2018-10-12 23:38:52 +01:00
Daniel Boles
d9f08c85f4 gtk-demo/main: Suppress implicit fallthru warning
Comments matched to reassure the compiler that fallthrough is
intentional are supposed to precede the case or default keywords, at
least in GCC, so the one here did not suppress the warning with GCC. We
can just the if condition and put the comment at the end to solve that.

https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
2018-10-12 22:09:42 +01:00
Ignacio Casal Quinteiro
247b38eb42 Merge branch 'fix-crash-osx' into 'gtk-3-24'
quartz: do not cache the screen in the gdkmonitor

See merge request GNOME/gtk!375
2018-10-11 20:45:49 +00:00
Ignacio Casal Quinteiro
2a392c220d quartz: do not cache the screen in the gdkmonitor
Instead we just cache the monitor number and get
out of it the nsscreen when it is needed. This is
a requirement since it nsscreen it is not supposed
to be cached.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1312
2018-10-10 12:44:29 +02:00
Jakub Steiner
955aa8d54b Adwaita: backport nightly styling
- nightly apps get a headerbar styling
2018-10-10 09:38:50 +02:00
LRN
caa5ba46ad Merge branch 'gtk-3-24.win.updated' into 'gtk-3-24'
gtkimcontextime.c: Fix Korean input

See merge request GNOME/gtk!356
2018-10-08 20:04:08 +00:00
Chun-wei Fan
1ece556200 gtkimcontextime.c: Fix Korean input
Commit c255ba68 inadvertently introduced a regression that broke Korean
text input because the changes there resulted that only the last input
string that we have from ImmGetCompositionStringW() for each time the
commit signal is emitted is kept, and also as a result the final Korean
character that is input by hitting space is also lost as a result, as we
didn't check for whether we are done with preediting.

Fix these issues by doing the following when we receive the
WM_IME_COMPOSITION message with GCS_RESULTSTR from Windows:
-Do not emit the commit signal during WM_IME_ENDCOMPOSITION, and...
-Emit the commit signal anyways, as we did before, c255ba68, however...
-We still save up the string to commit, because we need to re-compute
 the cursor position when we do ->get_preedit_string(), which needs to
 take the GCS_RESULTSTR string we get from WM_IME_COMPOSITION into
 account as well, so that we avoid getting the Pango criticals that
 occur during Chinese (and most likely Japanese) input as the cursor
 position is out-of-range.

Fixes issue #1350.
2018-10-08 15:55:44 +08:00
Hugo Lefeuvre
adbaee796d gtkstack: fix null pointer dereference
The gtk_stack_snapshot_slide() function dereferences the
last_visible_child pointer without proper != NULL ckeck. This might
result in NULL pointer dereference and crash if last_visible_child is
invalid.

Add a != NULL check before dereferencing the pointer.

cherry-picked from https://gitlab.gnome.org/GNOME/gtk/merge_requests/361
2018-10-07 18:31:03 +01:00
Daniel Boles
9b7d886b72 Tooltip: Fix the used cursor size if 0 in Settings
Before the recent rework of positioning in GtkTooltip, the widget always
used the cursor_size of the GdkDisplay. That work redid this to instead
take GtkSettings::gtk-cursor-theme-size. But that property's doc says:

> Size to use for cursors, or 0 to use the default size.

and has 0 as its default. This is quite a likely scenario for anyone
whose desktop or settings.ini does not explicitly provide a cursor size,
which is the case for XFCE and win32, to name just two common platforms.

Then, it seems getting a cursor_size of 0 causes GtkTooltip to freak out
and hide/show itself at a very rapid speed, thus making it unusable.

So, we should check whether the Settings return 0 and, if so, still use
gdk_display_get_default_cursor_size (display) to ensure we get a size.

https://gitlab.gnome.org/GNOME/gtk/issues/1371
2018-10-07 18:26:30 +01:00
Aurimas Černius
b10cde7bdc Updated Lithuanian translation 2018-10-07 16:56:11 +03:00
Руслан Ижбулатов
885672520a gtkselection: add a W32 tip about image/bmp support 2018-10-07 12:23:16 +00:00
Руслан Ижбулатов
f0959c9c8d GDK W32: Be honest about supported clipboard formats
Do not lie to W32 about the formats that we provide or accept.

Originally the logic behind such lies was that GdkPixbuf allows
us to convert any supported image to BMP or PNG, and therefore
we should announce that we always provide/accept BMP and PNG along
with other formats.

But that's not how it works. The conversion between formats happens
at GTK level in GtkClipboard or, if GtkClipboard is not used, with
gtk_target_list_add_image_targets() to announce all supported image
formats, and with gtk_selection_data_set_pixbuf() to convert from
any GdkPixbuf formats to the format requested by the selection, and
with gtk_selection_data_get_pixbuf() to convert from the selection
format to GdkPixbuf, if supported.

GDK simply does not play any role in this. Therefore W32 GDK backend
should only offer formats that it can actually do conversion for
by itself (such as image/bmp <-> CF_DIB,
or text/uri-list <-> CFSTR_SHELLIDLIST).
2018-10-07 12:15:41 +00:00
LRN
259c8e6373 Merge branch 'win32-runtime-immodule-swap' into 'gtk-3-24'
GDK W32: Support switching input modules at runtime

See merge request GNOME/gtk!366
2018-10-06 15:52:52 +00:00
Руслан Ижбулатов
d26c11f099 GDK W32: Support switching input modules at runtime
This leverages the normal input module switching mechanism in GTK
by making it think that the gtk-im-module setting changed.
The backend returns gtk-im-module value as "ime" if W32
IME API says that an IME is in use. Otherwise it returns
and empty string - this still triggers an input module
loading code, which, not being able to load the desired module
(which is and empty string), falls back to looking at current
keyboard layout.

Paired with the code that signals gtk-im-module change on keyboard layout
switches, this is sufficient to make GTK capable of loading appropriate
input modules at runtime. At least, the kinds of modules that specify
languages for which they are loaded automatically by default, and the
IME module.

Loading other kinds of input modules might still work via specifying
the gtk-im-module setting in gtk ini file, but doing so will likely
make GTK incapable of loading the IME input module that is used
for Korean, Chinese and Japanese (and some other languages).

Until someone figures out a way to actually change gtk-im-module
setting on Windows at runtime with meaningful values, the behaviour
introduced by this commit seems like a sufficient workaround.
2018-10-06 12:44:24 +00:00
Yi-Jyun Pan
220f77d8c1 Update Chinese (Taiwan) translation 2018-10-03 14:24:30 +00:00
Jeremy Bicha
4f424d0ead widget-factory: Add Keyboard Shortcuts menu item
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/916
2018-09-30 20:50:51 -04:00
Jeremy Bicha
5a78039ab3 widget-factory: Rename About menu item to About Widget Factory
This follows the recommendation in
https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
2018-09-30 20:50:49 -04:00
Jeremy Bicha
9882bc9638 widget-factory: Move app menu contents to primary menu
GNOME Shell 3.32 will remove support for the app menu
so we need to move its contents to the primary (hamburger)
menu.

widget-factory already had a primary menu.

The only item in the app menu was About.

https://gitlab.gnome.org/GNOME/Initiatives/issues/4
2018-09-30 20:50:48 -04:00
Carlos Garnacho
c8d47b0c84 imwayland: Collect return value from ::delete-surrounding signal
There's not much we can do about the signal not being handled, but
we should fetch the return value anyway.
2018-09-28 18:05:53 +02:00
Andrea Azzarone
2e24349fc6 entry: Handle no-window events in gtk_entry_event
gtk_entry_event's goal is to detect if a specific event concerns one of the two
entry icons. It can happen that this function is called during initialization
and/or before the entry is realized. In this case the entry icons (and the
event) will not yet have an associated window. The code should consider the
aforementioned situation and avoid matching a icon and an event with no
associated windows.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1366
2018-09-27 14:19:34 +02:00
Michael Catanzaro
b4464e1274 wayland: Avoid crashes inside wl_proxy_marshal()
Suggested by Garnacho. Hopefully fixes #1349.

Note: I'm riskily committing this via web UI not because I'm lazy
(though I am :) but because I'm seeing a weird host key when I try to
push or pull from GitLab.
2018-09-24 20:19:26 +00:00
Rafael Fontenelle
41f2815e20 Update Brazilian Portuguese translation 2018-09-24 19:48:20 +00:00
Benjamin Otte
4ef082d2ed Merge branch 'wip/arnaudb/fix-dashed-border' into 'gtk-3-24'
Make dashed border-style work correctly

See merge request GNOME/gtk!349
2018-09-24 18:21:02 +00:00
Daniel Boles
ed57e564a9 SidebarRow: Set ::no-show-all on end_icon_widget
All the other conditionally visible child widgets have this. Without it,
it seems some cases can wrongly reveal it, with a nonsensical home icon.

https://gitlab.gnome.org/GNOME/gtk/issues/1345
2018-09-22 19:57:59 +01:00
Arnaud B
0feebcf145 Make dashed border-style work correctly
There’s a short-path done for focus rectangles, but it can be taken in other conditions, and then fail occasionally to render a dashed line if the border-width is too big.
2018-09-21 12:25:23 +00:00
Emin Tufan Çetin
36656ea13a Update Turkish translation 2018-09-19 11:09:51 +00:00
Matthias Clasen
f5ad1786e8 3.24.1 2018-09-18 21:42:55 -04:00
Stas Solovey
ac41c3895f Update Russian translation 2018-09-18 20:09:23 +00:00
LRN
d7cf221d8a Merge branch 'win32-scroll-both' into 'gtk-3-24'
GDK W32: send both smooth and discrete scrolling events

See merge request GNOME/gtk!335
2018-09-18 13:50:29 +00:00
Carlos Garnacho
6183f48ab3 Merge branch 'imwayland_serial' into 'gtk-3-24'
imwayland: Don't reset serial while text-input is alive

See merge request GNOME/gtk!339
2018-09-17 13:19:58 +00:00
Dorota Czaplejewicz
af46ba27cc imwayland: Don't reset serial while text-input is alive
The serial number is a persistent property of the text-input object.
2018-09-14 20:33:38 +00:00
Matthias Clasen
8fd2d461fc gtk_application_inihit: allow no reason
We document this argument as nullable, so treat it as such.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1327
2018-09-13 23:32:45 -04:00
Eduard Braun
46dfd139ef GDK W32: fix direction of horizontal smooth scrolling events
Commit 359df028be changed the
code to send GDK_SCROLL_SMOOTH with deltas instead of
GDK_SCROLL_(UP|DOWN|LEFT|RIGHT).

Windows defines deltas inversed for vertical direction
(positive values mean the wheel was turned forward)
but not for horizontal direction
(positive values mean the wheel was turned towards the right).

This commit fixes behavior as both axes were inverted previously.
2018-09-13 19:30:41 +00:00
Rūdolfs Mazurs
86751c4a25 Update Latvian translation 2018-09-13 15:30:28 +00:00
Matthias Clasen
b1d3beedc3 Add a missing include
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1325
2018-09-12 23:02:26 -04:00
Matthias Clasen
f393d371e5 Merge branch 'wip/carlosg/issue-1317' into 'gtk-3-24'
modules: Check current context before retrieving surrounding

See merge request GNOME/gtk!326
2018-09-13 01:40:58 +00:00