Commit Graph

21729 Commits

Author SHA1 Message Date
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 f5eee56b56,
9833fbd77a and
4eac7f2417 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 ca79296061 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
Руслан Ижбулатов
61de4e7b67 W32: Prefer the deadkey combinations that the OS uses
Pick the W32 API for possible deadkey+<something> combinations
and prefer these to other sources of deadkey combos.
Specifically, if W32 API supports at least one combo for a particular
deadkey, only use that data and do not attempt to do other, unsupported
combinations, even if they make sense otherwise.
This is needed to, for example, correctly support US-International
keyboard layout, which produces a combined character for <' + a>
combo, but not for <' + s>, for example.

This is achieved by stashing all the deadkeys that we find in
an array, then doing extra loop through all virtual key codes and
trying to combine them with each of these deadkeys. Any combinations
that produce a single character are cached for later use.

In GTK Simple IM context, call a new GDK W32 function to do a lookup
on that cached combination table early on, among the "special cases"
(which are now partially obsolete).

A limitation of this code is that combinations with more than
one deadkey are not supported, except for combinations that consist
entirely of 2 known deadkeys. The upshot is that lookups should
be relatively fast, as deadkey array stays small and the combination
tree stays shallow.

Note that the use of ToUnicodeEx() seems suboptimal, as it should
be possible to just load a keyboard library (KBD*.DLL) manually
and obtain and use its key table directly. However, that is much more
complicated and would result in a significant rewrite of gdkkeys-win32.
The code from this commit, though hacky, is a direct addition to
existing code and should cover vast majority of the use-cases.

https://bugzilla.gnome.org/show_bug.cgi?id=569581
2016-11-25 16:34:45 +00:00
Руслан Ижбулатов
0b06d40103 GDK W32: Cache multiple keyboard layouts simultaneously
This changes the group/level semantic.
Previously W32 backend used "group 0/1" to denote "AltGr OFF/ON"
and "level 0/1" to denote "Shift is OFF/ON".
Now "group" means "keyboard layout" and there can be up to 255 groups,
while AltGr and Shift are combined into a single level enum that
takes values between 0 and 4.
Unlike X, W32 doesn't do effective group overriding, meaning that
it will never tell the caller that a different group was actually
used (even for universal keys, such as Enter), because key symbol
table is completely fabricated and there's no point in trying to
save a few of kilobytes of RAM by not duplicating universal key
records for all groups.

Also contains many whitespace changes (tab elimination, fixed
indentation) and cleanup (axed a few global variables, these are
now accessed via the default keymap).

https://bugzilla.gnome.org/show_bug.cgi?id=768722
2016-11-25 16:34:44 +00:00
Руслан Ижбулатов
92e6c45756 Backport some of the GTK3 changes to win32/gdkkeys
This lays the foundation for backporting more invasive gdkkeys commits
from GTK3.

https://bugzilla.gnome.org/show_bug.cgi?id=768722
2016-11-25 16:34:43 +00:00
Chun-wei Fan
ea7159dc87 Visual Studio 201x builds: "Install" gtk-update-icon-cache.exe
Most people should be on GTK+-3.x by now, but in case they don't and are
using GTK+-2.24.x, we ought to "install" the gtk-update-icon-cache tool,
like we did for the 2008 builds, as it is still much used, and is already
built by the projects.
2016-11-16 16:46:06 +08:00
Chun-wei Fan
07e5a32d62 Visual Studio builds: Fix 201x property sheet
One closing tag was missed, fix that.
2016-11-16 03:14:10 +08:00
Chun-wei Fan
4cd65c7c5b Visual Studio builds: Make .pc generation optional
Generate the .pc files when a Python installation can be found at the
location specified by PythonPath (32-bit) or PythonPathX64 (64-bit), which
is found in gtk-version-paths.[vsprops|props].
2016-11-15 18:29:42 +08:00
Chun-wei Fan
ad7597415f Visual Studio builds: Add support scripts to generate .pc files 2016-11-15 18:24:16 +08:00
Chun-wei Fan
7e5d11f9d4 Visual Studio builds: Generate .pc files
Like the 3.x and 4.x builds, generate the .pc files for GTK+-2.x, for
the convenience of people, and copy them during "install".
2016-11-15 17:10:08 +08:00
Lauri Kasanen
35871edb31 recent-manager: Fix a memory leak caused by "recent-manager: Add a limit to the list's size"
Signed-off-by: Lauri Kasanen <curaga@operamail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773587
2016-11-14 14:27:37 -05:00
Lauri Kasanen
a3b2d6a65b recent-manager: Add a limit to the list's size
This fixes a DOS where any app can cause all running gtk apps
to use arbitrary amounts of memory.

Originally reported against mate-panel, where running a big slideshow
in eye-of-mate caused increasing RAM usage in mate-panel.

v2: Hardcode the value
Signed-off-by: Lauri Kasanen <curaga@operamail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773587
2016-11-10 17:13:10 -05:00
Chun-wei Fan
479372c068 Remove gtk-install.props's during re-generation
This is to ensure the changes in the generated
build/win32/vs10/gtk-install.props are applied in
build/win32/vs[11|12|14] as well.
2016-10-19 18:54:19 +08:00
Chun-wei Fan
45fd538b9b build/: Force MSVC project file generation on Makefile.am changes
Make the Makefile.am targets for generating the Visual Studio projects re-generate the
project files and the header listings whenever the Makefile.am's that include
build/Makefile.msvcproj changes, so that whenever a source/header is added, they will
be reflected in the projects and in the property sheets that are used to copy the
headers.

Also ensure that these are applied to the vs11, vs12 and vs14 projects when this
happens, as they are copied and processed from the Visual Studio 2010 projects.
2016-10-19 18:51:17 +08:00
Jouke Witteveen
c5872e2ab9 Validate the return value of XListInputDevices
Since libxi 1.7.7 XListInputDevices returns NULL when it fails while num_devices will not be set to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=772794
2016-10-14 11:47:45 -04:00
Piotr Drąg
d2ffa92caf Update Polish translation 2016-10-12 19:24:54 +02:00
Matthias Clasen
debba4d141 entry: Fix a corner case of overwrite mode
We currently beep when a character is appended at the end in
overwrite mode. That is obviously not right. Patch based on
a patch by Ian MacDonald.

https://bugzilla.gnome.org/show_bug.cgi?id=772389
2016-10-05 12:37:08 -04:00
Matthias Clasen
09c0b9c8a0 2.24.31 2.24.31 2016-09-09 15:32:31 -04:00
Matthias Clasen
dd0d4da4b1 Update NEWS for 2.24.31 2016-09-07 13:14:26 -04:00
Jeremy Tan
a4af2dd246 GDK W32: Fix bounding rect calculation on window creation
This is a backport of commit 260d521.

The bounding rect specifies the top left and bottom right corners - the
bottom right corner must account for the current window position.

https://bugzilla.gnome.org/show_bug.cgi?id=764996
2016-09-02 05:02:04 +00:00
Kristian Rietveld
899147d6d0 imquartz: fix regression introduced by commit 4ba1fb
In the preceding fix, the checks involving GDK_IS_QUARTZ_WINDOW macros
were left out. These checks are in fact crucial, because these functions
are sometimes called with non-quartz functions as the original comments
in the code do indicate. Therefore, reintroduce these checks. This
fixes a crash in GIMP.
2016-08-07 16:53:57 +02:00
Kristian Rietveld
6b8e20a05c quartz: introduce gdk_quartz_window_is_quartz function
This function can be used to check whether a GdkWindow is a quartz
window. It is equivalent to it's win32 counterpart. The function
is necessary because the macro necessary for this check is private.
2016-07-31 08:41:33 +02:00
Руслан Ижбулатов
b7c92fb1fb GDK W32: Support UTF-16 surrogate pairs passed via VK_PACKET
This is, essentially, a piece of g_utf16_to_ucs4() built into GDK
W32 keyboard message processing.

https://bugzilla.gnome.org/show_bug.cgi?id=769126
2016-07-28 15:52:06 +00:00