Commit Graph

1153 Commits

Author SHA1 Message Date
Emmanuele Bassi
0ade87ef92 Ensure we have a client window before using it
The XIM input method can some times go into weird states, especially
when extended devices or in mixed environments with multiple input
methods installed.

Ideally, people should simply stop using XIM, which is utterly broken,
and use IBus instead; nevertheless, crashing is not nice.

Fixes: #61
Fixes: #518
2019-11-16 20:57:43 +00:00
Tom Schoonjans
fa07007389 meson: ensure plugins have so extension on macOS 2019-10-11 08:55:12 +01:00
Marek Kasik
bf7851f57c printing: Get PPD from original host if needed
Try to get PPD from original host if there is no PPD for remote printer
on current CUPS server.
2019-09-19 19:33:36 +02:00
Philip Zander
d33c24b31e Win32 IME fixes
See merge request !1063
2019-09-06 20:45:45 +02:00
Christoph Reiter
dab769a08c meson: cups: use cups-config for looking up cups
We were looking for the cups headers and the cups lib in the default locations
which for example breaks with OpenBSD where the cups headers are under /usr/local/include/

Instead just use the "cups" dependency type from meson which internally uses cups-config.

Fixes #1967
2019-06-25 20:46:09 +02:00
Christoph Reiter
d36fb51c11 meson: cups: fix building without colord support
The colord dependency object was always passed to the cups backend even
if it wasn't declared.
2019-06-25 20:27:15 +02:00
Christoph Reiter
94555371f5 meson: print disabled backends in the final build summary
It's easy to miss what's not getting build otherwise
2019-06-17 17:50:42 +00:00
Christoph Reiter
d402cd4e2e build: only require cups >=1.7
In 9236ee0564 the cups code was updated to use newer API with cups >= 2
and a later commit (a7e207abe) dropped the old code paths and added version
checks in meson/autotools.

The newly used functions were httpConnect2 and httpReconnect2 which are
available since 1.7 and don't require cups 2.0.

Change the versions checks to 1.7 instead so gtk can still be build with
older cups (macOS 10.9 for example, see #1950)
2019-06-15 10:08:46 +02:00
Christoph Reiter
175c400678 build/cups: remove checks for httpGetAuthString and http_t.authstring
httpGetAuthString() was added with cups 1.3 and we depend on a newer version
now. The direct field access was a fallback in case httpGetAuthString()
was missing, so this can also be dropped.
2019-06-15 10:08:31 +02:00
Emmanuele Bassi
a7e207abe2 Require CUPS >= 2.0
Drop support for versions of CUPS < 2.0, to simplify the backend code
and drop a lot of conditional blocks.
2019-05-10 16:40:58 +02:00
Emmanuele Bassi
9236ee0564 cups: Use non-deprecated API
The http* family of functions was deprecated after CUPS 1.7. We can
conditionally use it when built against a newer version of CUPS. The
additional parameters are taken directly from the fallback values
inside CUPS itself.
2019-05-10 16:40:58 +02:00
Emmanuele Bassi
91cc9b58f3 Detect CUPS ≥ 1.7
We support CUPS ≥ 1.2, but we use API that was introduced and deprecated
at a later point.
2019-05-10 16:40:58 +02:00
Chun-wei Fan
c073a062b6 gtkimcontextime.c: Fix preedit window placement on HiDPI
We must also take the scaling factor into account for placing the IME
preedit window that is often used for Chinese and Japanese input on
Windows.
2019-04-25 12:15:43 +08:00
Timm Bäder
81c8efc863 imcontextwayland: (Hopefully) fix if expression
Backport from master: f9a5a474f0
2019-04-16 00:12:24 +02:00
Christoph Reiter
749a58ab26 meson: simplify builtin_immodules build option
Make it a yes/no/auto combo. "yes" means all modules are built into libgtk,
"no" that none are and "auto" uses the platform defaults, yes on win32,
no otherwise.

If we need more we can always extend it later.
2019-04-11 16:46:22 +02:00
Christoph Reiter
3462fcf9a0 meson: Follow gnome conventions for build option names 2019-04-11 16:46:22 +02:00
Christoph Reiter
28833783cc meson: Various config.h related fixes
Various adjustments to make the config.h output between autotools
and meson more similar by testing on Linux and Windows/MSYS2.

Setting things to 1 instead of true and shifting things around is motivated
by reducing the diff between the generated files.
2019-04-11 16:46:22 +02:00
Christoph Reiter
7391a078b3 meson: build print backends
This changes the configure option into two states:
auto: build all that can be build (default)
A list of backend names: build them and fail if we can't

"papi" is missing because it's not in Debian and I can't test it.
2019-04-11 16:45:36 +02:00
Christoph Reiter
d52dad2042 autotools: dist all meson related build files 2019-04-11 16:45:36 +02:00
Christoph Reiter
26d32f3bd0 meson: build all input modules; fix static build on Linux 2019-04-11 16:45:36 +02:00
Christoph Reiter
cb89ad18a2 meson: immodules: unset the name_prefix to match autotools 2019-04-11 16:45:36 +02:00
Christoph Reiter
1ee995fd0f meson: Install im-multipress.conf 2019-04-11 16:45:36 +02:00
Chun-wei Fan
5e8edec254 meson: Build the input modules
Build the input modules for GTK+, either as modules or built directly
into GTK.  Also provide a configure option to build the specified
immodules, or all, or the backend immodule(s) or none of the immodules
into GTK.  Note that for Visual Studio all immodules are built into
the GTK DLL by default, like what is done in the Visual Studio projects.

Note that building the backend immodules for Quartz, X11 and Wayland are
currently untested.
2019-04-11 16:45:36 +02:00
Nirbheek Chauhan
a4fe15d9f0 meson: Sync build files with master and update to 3.24 2019-04-11 16:45:27 +02:00
Till Kamppeter
b9e91b9419 print: Check unknown option values whether they are actually custom settings
Set always correct custom page size.
2019-04-05 16:29:03 +00:00
John Ralls
6afd174162 Merge branch 'suyuan/fix-macos-accented-char-input' into gtk-3-24. 2019-02-17 13:04:20 -08:00
Matthias Clasen
9f3141fc5c Merge branch 'wip/carlosg/toggle-osk-sparingly' into 'gtk-3-24'
imwayland: Toggle OSK more sparingly

See merge request GNOME/gtk!569
2019-02-08 23:40:00 +00:00
Carlos Garnacho
38a4c4dd37 imwayland: Toggle OSK more sparingly
Specifically it is avoided to be toggled if:
- Just received focus (in order to preserve OSK state across focus changes)
- Moving cursor around. Still allow some jitter as perfect accuracy is not
  possible.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1277
2019-02-09 00:29:56 +01:00
Emmanuele Bassi
8f8b68f847 Terminate strncpy() buffers correctly
When using strncpy() with a buffer we need to account for the
terminating NUL character. GCC 8 started warning when using PPD_MAX_NAME
as the buffer length for strncpy() because the buffer we're copying into
has the same length — which means that the terminating NUL may be
skipped if the source string has a length of PPD_MAX_NAME.

The appropriate way to handle the case where we're copying a source with
a length bigger than of PPD_MAX_NAME is, as reported in the strncpy()
documentation, to copy `PPD_MAX_NAME - 1` bytes, and explicitly NUL
terminate the destination buffer. This has the additional benefit of
avoiding the compiler warning.
2019-02-05 15:34:08 +01:00
Suyuan Chang
cfad43b80d macOS: Fix bug that entry cannot press and hold a key to input accented character.
There're two issues in GdkQuartzView's NSTextInputClient implementation
causes this bug.

1. The -(NSRange)selectedRange should not return [NSNotFound, 0] if
   there's no selection. The accented character window will not show
   if returned NSRange's location is NSNotFound. Instead of that, the
   NSRange's location should be the caret position in the text input
   buffer.

2. The accented character window will invoke
   -(void)insertText:replacementRange: with non-empty replacement
   range, to replace non-accented character with accented character
   after user select it from accented character window. This case is
   not implemented in original code. Here I use another gobject data
   to pass the information to input module and convert it into
   'delete-surrounding' event.

Besides these, there's another bug cause gtk_im_context_filter_keypress()
return wrong value while user press and hold a key. When user press
and hold a key, the accented character window will consume the
repeating key down event. Is this case, gtk_im_context_filter_keypress()
should return TRUE, indicate the key press is filtered by input
method module. But it will return FALSE because
gtk_im_context_filter_keypress() assume that every key press event
will generate some text from input method module.

Fixes #1618
2019-01-30 22:07:23 -08:00
John Ralls
3e3a15de83 [imquartz] Fix incorrect GdkEvent window member name. 2019-01-23 20:02:16 -08:00
Iain Lane
882c81dab2 Fix -Wincompatible-pointer-types warnings 2019-01-23 12:18:18 +00:00
John Ralls
a93daa0373 [imquartz] Return event window for mouse events in keypress filter.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1600
2019-01-21 07:31:52 -08:00
John Ralls
ee0e59e6cf [IMQuartz] Get the GdkWindow from the NSKeyEvent.
Instead of from the IMContextQuartz's client window because the former
is the event window where the text will be inserted. In some cases
they're different and the text may be discarded (because the client
window isn't editable) or misplaced.

Fixes Bug 707945.
2019-01-13 16:00:53 -08:00
Matthias Clasen
3e6fd50d96 Merge branch 'wip/carlosg/im-wayland-surrounding-limits' into 'gtk-3-24'
imwayland: Respect maximum length of 4000 Bytes on strings being sent.

See merge request GNOME/gtk!438
2018-12-14 20:09:18 +00:00
Matthias Clasen
f879741e89 Merge branch 'imwayland_enable' into 'gtk-3-24'
imwayland: Handle enter and leave events

See merge request GNOME/gtk!369
2018-12-14 20:07:18 +00:00
Carlos Garnacho
e416aebe5f imwayland: Respect maximum length of 4000 Bytes on strings being sent.
Hitting the limit will raise protocol errors.
2018-12-06 20:10:47 +01:00
Carlos Garnacho
336f382728 imwayland: Plug leaks
The various strings (pending/current preedit, surrounding, and commit
buffer) are being leaked in the case of GtkIMContext destruction.
2018-10-30 22:00:07 +01:00
Dorota Czaplejewicz
28ac1a2cba imwayland.c: fix formatting 2018-10-17 12:51:07 +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
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
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
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
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
Dorota Czaplejewicz
99669503fb imwayland: Fix clearing of preedit text in webkitgtk
Fixes webkitgtk misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316#note_312942 , which was introduced in 49b17e6c.
The preedit will be cleared on exit only if it is already present.
2018-09-11 12:12:28 +00:00
Dorota Czaplejewicz
c22d5ab9f6 imwayland: Fix clearing of preedit text
Fixes terminal emulator misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316, which was introduced in 49b17e6c. The original commit cleared preedit text by setting it to an empty string, which still counted as existing preedit. The fix sets preedit string to null, which is correctly understood as not present.
2018-09-11 12:11:10 +00:00
Carlos Garnacho
88dc784256 modules: Check current context before retrieving surrounding
There may be situations where this might get called while the
currently focused context just went away (eg. after setting the
text widget unsensitive).

Closes: #1317
2018-09-07 17:01:12 +02:00
Dorota Czaplejewicz
49b17e6c1e imwayland: clear preedit on focus out 2018-08-23 22:03:01 +02:00
Dorota Czaplejewicz
8d77256d53 imwayland: Add text-input-unstable-v3 support
The wayland input module now represents text-input-unstable-v3 support, while the old module supporting gtk-text-input was renamed to gtkwayland.
2018-07-30 20:27:22 +02:00