Commit graph

21,750 commits

Author SHA1 Message Date
Daniel Boles
fac72327f9 ComboBox: Fix wrongly matched signal disconnect()s
Various disconnections had the wrong flags and/or data, so we failed to
disconnect a pile of signals, shown by 0 returned by the disconnect_*()
functions. Fix this, and use the nicer disconnect_by_*() while here.
2017-08-28 19:59:39 +01:00
Daniel Boles
2759e89611 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 real_popup(). Also do the same
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 19:59:27 +01:00
Daniel Boles
faa69b3547 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 broke opening some combos in the Inspector in GTK+ 3.

Fix this by moving the call to set_screen() to real_popup(), 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:02:59 +01:00
Andika Triwidada
1297710879 Update Indonesian translation 2017-08-28 15:20:56 +00:00
Daniel Boles
47bea2deaa 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:03:33 +01:00
Daniel Boles
2166e25f2e ComboBox: Clarify documentation of get_active_iter
https://bugzilla.gnome.org/show_bug.cgi?id=618160
2017-08-25 20:59:50 +01:00
Daniel Boles
bf8c1c212e 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:20:51 +01:00
Matthias Clasen
e6d2655e1e GtkLabel: make patterns work a little better
When a pattern has been set, we must not throw away
the attributes that contain it.

https://bugzilla.gnome.org/show_bug.cgi?id=658111
https://bugzilla.gnome.org/show_bug.cgi?id=676550
2017-08-06 19:07:24 +01:00
Jasper St. Pierre
491d79d540 recentchooserdefault: Clean up load_id when we have nothing left to do
Returning FALSE from a GSourceFunc will implicitly remove it, so we need
to do this in order to make the new g_source_remove happy.

https://bugzilla.gnome.org/show_bug.cgi?id=779605
2017-08-05 19:23:06 +01:00
Daniel Boles
277c8286a1 GtkFixed: Update documentation intro
• Add GtkLayout as a @See_also since it includes fixed-pos functionality
• Explain how to work around the problems with RTL text
2017-08-03 13:15:04 +01:00
Daniel Boles
bb3b34af30 Layout: Add GtkFixed to docs as a See_Also 2017-08-03 13:15:04 +01:00
Daniel Boles
fdb701837f 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:13:00 +01:00
Daniel Boles
8302b71381 Entry: Warn about corner case hiding icon tooltips
https://bugzilla.gnome.org/show_bug.cgi?id=785672#c4
2017-08-01 18:12:59 +01:00
Daniel Boles
28cc9735de Entry: Fix a misspelt method name in a doc comment 2017-08-01 18:12:52 +01:00
Chun-wei Fan
ca2e62da22 build/win32/replace.py: Fix replacing items in files with UTF-8 content
Some files that this script will process might have UTF-8 items in
there, which can cause problems on Python 3.x as it is more strict and
careful on unicode issues.

Fix this by:
-Doing what we did before on Python 2.x
-Opening the file with encoding='utf-8' on Python 3.x
2017-05-09 18:37:58 -07:00
Balázs Úr
268e3ecc09 Update Hungarian translation 2017-05-05 18:49:47 +00:00
Daniel Boles
94929bc0e0 Scale: Explain how to round value when !draw-value
Scale:digits is (now, again) ineffective if Scale:draw-value is FALSE.
To get rounding in that case, the base Range:round-digits must be used.
2017-05-02 12:36:05 +01:00
Piotr Drąg
9ecbf966a4 Update Polish translation 2017-04-30 19:52:43 +02:00
Christoph Reiter
aac544b742 Scale: Fix documentation of digits per last revert
Add a clarifying note that, under the original behaviour, :digits only
rounds the Adjustment if :draw-value is TRUE at the time of the change.

This is based on a similar commit made by Daniel Boles for the gtk3
branches like 1cd0a8de0b70

https://bugzilla.gnome.org/show_bug.cgi?id=781605
https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-04-30 19:32:03 +02:00
Christoph Reiter
7191a048c1 Revert "Scale: Always sync ::digits to Range::round-digits"
This reverts commit fd218fee46.

https://bugzilla.gnome.org/show_bug.cgi?id=781605
2017-04-30 19:32:00 +02:00
Michael Schumacher
bb39a1292c Use the actual mime type to determine if an icon is a SVG file.
https://bugzilla.gnome.org/show_bug.cgi?id=781020
2017-04-08 01:36:23 -04:00
Daniel Boles
4435fb3c61 TextView: Drop an unnecessary #include 2017-03-27 19:30:38 +01:00
Daniel Boles
fd939f0052 TextView: Be const-correct when passing a pointer
The TextIter is passed by pointer for efficiency. We neither need to
modify it, nor should we leave it possible to accidentally do so. So,
it should be passed as a pointer-to-const.
2017-03-27 19:20:44 +01:00
Daniel Boles
4e14926153 TextView: Get line direction in more efficient way
We do not need to go through the heavyweight process of constructing a
TextLineDisplay just to get the direction out of it, when we can simply
use TextIter API to get the text and then get its direction using Pango.

Adapted from a patch by Mehdi Sadeghi for GtkSourceView:

https://bugzilla.gnome.org/show_bug.cgi?id=779081#c20
2017-03-26 16:28:20 +01:00
Daniel Boles
062983c057 TextBuffer: Add missing transfer full annotations 2017-03-26 16:26:41 +01:00
Piotr Drąg
c6212761bd Update Polish translation 2017-03-25 23:06:24 +01:00
Colomban Wendling
e6afe1165e GtkMenuShell: always 'activate' menu shells
Failing to do so can leave us with a stuck grab in some cases.
https://bugzilla.gnome.org/show_bug.cgi?id=554057

Cherry-picks f5eee56b56e2f371a0dc659f2d402b0cfc1c42c2,
9833fbd77a63ee5dd8f6b5519831db2a4b29ebb9 and
4eac7f24177d947852574f11ef483b1c43fd17e5 from GTK3.
2017-03-16 22:30:40 -04:00
Balázs Úr
9f4b178d69 Update Hungarian translation 2017-03-15 16:57:10 +00:00
TingPing
1fb9e0390e Properly use GContentType
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-08 22:44:27 -05:00
Chun-wei Fan
cfc41158cd build/Makefile.msvcproj: Remove MSVC 2017 projects before re-generation
This ensures a fresh version from the 2010 projects are copied and
processed.
2017-03-03 17:37:20 +08:00
Daniel Boles
3e92a78332 TextView—Avoid pointless Pango in iter_line_is_rtl
Get the direction that was already worked out and stored in the
TextLineDisplay, rather than making Pango figure it out again.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:29:08 +00:00
Daniel Boles
8248a3f904 TextView—Plug a memory leak
Thanks to Nelson Benitez for pointing this out.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:29:07 +00:00
Piotr Drąg
0dd0ff05f5 Update Polish translation 2017-02-19 18:24:39 +01:00
Daniel Boles
4cc50bd2eb TextView: Fix build failure
as per previous commit
2017-02-19 14:44:48 +00:00
Daniel Boles
4577a35e1e Entry: Fix build failure
I hadn’t paid enough attention when cherry-picking
commit f7da9dba1d from GTK+ 3/4.

Thanks to Javier Jardón for letting me know.
2017-02-19 14:35:16 +00:00
Daniel Boles
5b0fd246a2 TextView—Fix inverted movements by arrows in RTL
Using Ctrl + left/right to skip between words, or left/right to cancel a
selection, were causing movement on the screen in the opposite direction
of the glyph on the key. This was surprising and awful UX for RTL users.

This is based on a patch covering the former case by:
Author:    Mehdi Sadeghi <mehdi@mehdix.org>
Date:      Sat Feb 18 02:16:00 2017 +0000

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-19 12:38:42 +00:00
Daniel Boles
f318a4f8db Entry: Add newlines to ease reading huge switches
These are monstrosities!
2017-02-19 12:38:42 +00:00
Daniel Boles
f7da9dba1d Entry—Fix inverted movements by arrow keys in RTL
Using Ctrl + left/right to skip between words, or left/right to cancel a
selection, were causing movement on the screen in the opposite direction
of the glyph on the key. This was surprising and awful UX for RTL users.

This is based on a patch covering the former case by:
Author:    Ori Avtalion <ori@avtalion.name>
Date:      Tue Apr 20 08:06:23 2010 +0000

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-19 12:38:42 +00:00
Daniel Boles
3cde425a22 Scale: Fix signal documentation syntax
Oops, sorry. Thanks to Cristoph Reiter for correcting me on this.
2017-02-19 10:12:37 +00:00
Daniel Boles
35744d1d9b Scale: Improve docs of format-value signal 2017-02-19 09:25:33 +00:00
Daniel Boles
fd218fee46 Scale: Always sync ::digits to Range::round-digits
The documents state that gtk_scale_set_digits() “causes the value of the
adjustment to be rounded off to this number of digits, so the retrieved
value matches the value the user saw.” Note the lack of any condition.

But in fact, if draw-value was false, rounding was disabled on the base
Range, so values that weren’t displayed weren’t rounded. This made the
docs wrong and made an apparently cosmetic detail alter functionality.

Fix by ensuring the number of digits set on Scale is always propagated
along to gtk_range_set_round_digits(), thus rounding to it in all cases
when the value changes, regardless of whether the value is displayed.

This doesn’t address the other idea from Bugzilla: that changing the
number of digits should clamp the _existing_ value if it’s more precise.
This contradicts digits docs in the base Range, but the above from Scale
can be read as implying it’ll happen. For now, that’s an open question.

https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-02-19 09:25:31 +00:00
Nelson Benítez León
f680ce1f43 textiter: fix bug in gtk_text_iter_backward_line()
gtk_text_iter_backward_line() checks the value of
real->line_char_offset without previously calling
ensure_char_offsets (real) to make sure the former
is up-to-date.

As a consequence of this, when gtk_text_iter_backward_line()
is called after a gtk_text_buffer_insert_range() in the
first line of buffer, the iter is not moved to the start of
the line, and the return value is wrong.

Fixed by adding the ensure_char_offsets() call.
2017-02-18 20:05:44 +00:00
Daniel Boles
7df629dccf tests: Remove executable bit from C files 2017-02-18 20:05:44 +00:00
Chun-wei Fan
e3cd67d258 Visual Studio builds: Support Visual Studio 2017
Update the autotools scripts so that we can copy the Visual Studio
2010 and update items as necessary to obtain the Visual Studio 2017
projects.

Note that the toolset version string format has changed for Visual
Studio 2017, so a custom toolset version string is allowed and used
if specified, otherwise the toolset version string is generated as
we did before.

Note also that Visual Studio 2017 aims to be compatible with Visual
Studio 2015 on the CRT level, so it should be possible to use 2017-
compiled binaries with 2015-compiled binaries without problems.
2017-02-17 14:24:11 +08:00
Ingo Brückl
c9aadabe83 Use UTF-8 encoding for tooltips on files in the "recently used" list
g_file_get_path() returns the local pathname and it is entirely possible
that this pathname isn't in UTF-8 encoding, but in a different one
defined by G_FILENAME_ENCODING. Using a string in GLib file name
encoding rather than UTF-8 encoding as tooltip text will produce an
erroneous output.

Use the parse name instead. This is a UTF-8 string that describes the
file suitable for use in the user interface.

https://bugzilla.gnome.org/show_bug.cgi?id=778542
2017-02-15 16:11:10 -05:00
James Clarke
9b111339eb Don't use guint32 with XChangeProperty
Fixes bug 777683.
2017-01-27 10:06:04 +01:00
Руслан Ижбулатов
516c1ba159 GDK W32: Handle CapsLock as part of the key shift level
Instead of using some kind of flawed logic about modifying a keypress result
when CapsLock is toggled, just add a CapsLock shift level (and all derived
shift levels, i.e. Shift+CapsLock and CapsLock+AltGr and Shift+CapsLock+AltGr)
and query Windows keyboard layout API about the result of keypresses involving
CapsLock.

Keysym table is going to be (roughly) twice as large now, but CapsLock'ed
keypresses will give correct results for some keyboard layouts (such as
Czech keyboard layout, which without this change produces lowercase letters
for CapsLock->[0,2,3,4...] instead of uppercase ones).

Keymap update time also increases accordingly.

This is a backport of commit ca79296061e2ddc0a2738a1fba4e9aa495d71d56 from the gtk-3-22 branch.

https://bugzilla.gnome.org/show_bug.cgi?id=165385
2017-01-23 19:02:18 +00:00
Руслан Ижбулатов
79b2a92fe5 GDK W32: Replace wcscpy_s with wcsncpy for XP compatibility
https://bugzilla.gnome.org/show_bug.cgi?id=768722
2017-01-18 09:18:01 +00:00
Руслан Ижбулатов
cc2d701289 W32: Ensure that gtkwin32keys.h is not needed by GTK+ users
Throw away the gdkwin32keys.h-must-not-be-included-by-itself check,
include gdkwin32keys.h directly instead of including gdkwin32.h,
remove gdkwin32keys.h inclusion from gdkwin32.h

https://bugzilla.gnome.org/show_bug.cgi?id=775163
2016-11-27 09:39:55 +00:00
Руслан Ижбулатов
962d3dffc1 GDK W32: Special handling for VK_PAUSE
Similar to VK_DIVIDE, this key can't be mapped to a scancode by
MapVirtualKeyEx(). Googling suggests that this is a known bug.

https://bugzilla.gnome.org/show_bug.cgi?id=769214
2016-11-25 16:34:46 +00:00