Commit Graph

1122 Commits

Author SHA1 Message Date
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
Christian Hergert
508e0648b5 imwayland: fix potential leak of attr list
This fixes a potential leak of a PangoAttrList that is set when chaining
up to the parent get_preedit_string(). We check to see if the attr list
was created and reuse it instead of leaking the previous value.
2018-07-27 23:46:31 -07:00
Yi-Soo An
5fb999010c modules/input/gtkimcontextthai: Remove deprecated gdk_beep
Use gdk_display_beep instead of it.
2018-07-20 15:39:49 +09:00
Matthias Clasen
03c1c604dd Merge branch 'issue1170' into 'gtk-3-24'
modules: fix gtk-2.0 paths to gtk-3.0

See merge request GNOME/gtk!211
2018-06-25 21:13:24 +00:00
Michael Catanzaro
efb934c07f imwayland: Fix a small leak
If the parent get_preedit_string implementation returns a nonnull
zero-length string, then we ignore it, which is almost fine. We have to
free it, though.

Fixes #1174
2018-06-24 15:49:46 -05:00
Roddy Shuler
e2efc165d1 modules: fix gtk-2.0 paths to gtk-3.0
Both print backends and configuration files for multipress are being
installed in the wrong directory, so let's fix that.
2018-06-22 13:53:43 +01:00
Adrian Johnson
fff08fa319 Add _gtk_printer_get_hard_margins_for_paper_size()
to retreive paper size specific hard margins and use this
to set the hard margins in the print context.
(modified by Marek Kasik <mkasik@redhat.com>)

https://bugzilla.gnome.org/show_bug.cgi?id=686109
2018-04-25 16:28:07 +02:00
Matthias Clasen
4b95d74068 wayland: Don't emit signals if nothing changed
We were emitting a preedit-changed even if the preedit text did
not actually change, causing text views to scroll.

https://gitlab.gnome.org/GNOME/gtk/issues/132
https://gitlab.gnome.org/GNOME/gtk/merge_requests/83#note_93411
2018-04-04 09:39:31 +01:00
Lionel Landwerlin
314531640f imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
2018-03-28 12:11:10 +01:00
Carlos Garnacho
4f78abddfc imwayland: Avoid TOGGLE_INPUT_PANEL requests if there's no focus
Fixes two things: 1) As GTK+ can be coerced into using the wayland IM
module despite the compositor not implementing the interface, all paths
not checking for global state before sending requests are prone to
crashes, this one fell hit this pitfall.

And 2) ensures the tap gesture only triggers TOGGLE_INPUT_PANEL if the
widget IM is focused. This is a possibility on eg. WebKit pages, where
its IM is only focused as long as a form element in the page is focused.
Tapping elsewhere shouldn't toggle the OSK.

https://gitlab.gnome.org/GNOME/gtk/issues/114

Closes: #114
2018-03-20 15:56:53 +01:00
Ivan Zakharyaschev
d2a4febfa7 gtkprintbackendcups.c: fix \n at end of a debugging note
(cherry picked from commit 7461ceebe3)
2018-02-17 21:25:41 +03:00
Carlos Garnacho
e8bffe0c56 modules: Add wayland IM implementation
This IM context implementation goes through the gtk-text-input protocol,
leaving up to the compositor the actual interaction with IM engines. If
the protocol is not offered by the compositor, GTK+ will fallback to the
IMs as specified through GtkSettings.
2018-02-14 14:58:06 +01:00
Matthias Clasen
0eaa76a032 cups: Warn only once if colord is not available
No need to keep complaining about this.

https://bugzilla.gnome.org/show_bug.cgi?id=791650
2017-12-17 17:11:27 -05:00
Chun-wei Fan
c255ba68fc input/IME: Defer the emit of the "commit" signal
On Windows, when IME is used, each keystroke results in the
WM_IME_COMPOSITION event being sent first.  This means that in our case
when one decides on to accept the input that is in the preedit buffer,
we first get from Windows the WM_IME_COMPOSITION event
(where we emit the commit signal), followed by the WM_IME_ENDCOMPOSITION
event (where we emit the pair of preedit-changed and preedit-end
signals).

Since commit f11f989 (GtkEntry: Remove recompute idle), we do the input
recomputation directly, this will cause a pair of "Pango-WARNING:
Assertion failed: (index >= 0 && index <= layout->length)" being shown,
as gtkentry.c's priv->preedit_length and priv->preedit_cursor was unable
to be reset to 0 in time as a result of the recomputation triggered by
the commit being done before the reset of priv->preedit_length and
priv->preedit_cursor (which are no longer valid as we essentially say
that we are done with the preedit buffer).

As we could only acquire the final string that was entered in this
preedit session when we handle the WM_IME_COMPOSITION event, fix this by
saving up the final string we acquire from Windows IME in UTF-8 when we
handle the WM_IME_COMPOSITION event from Windows, and emit the commit
signal with that string after we emit the preedit-changed and
preedit-end signals when we handle the WM_IME_ENDCOMPOSITION event from
Windows, which comes afterwards.

Also fix the formatting of the code around the parts of the files that
was changed.

https://bugzilla.gnome.org/show_bug.cgi?id=787142
2017-10-30 14:33:23 +08:00
Marek Kasik
52e3c095bf printing: Don't show duplicate printers
Check UUID for printers obtained via DNSSD whether
they are already installed on local CUPS server.
Don't show such printers.

Not all printers published via DNSSD have UUID entry though.

https://bugzilla.gnome.org/show_bug.cgi?id=786794
2017-10-09 18:02:28 +02:00
John Ralls
d09bd2e2d3 Duplicate the TIC strings before NULLing the GObject data.
NULLing the data strings in GObject frees and invalidates the pointers
returned by g_object_get_data so we need our own copy of the values.
2017-08-08 23:19:26 +03:00
Matthias Clasen
0155009d57 Avoid some compiler warnings 2017-03-26 15:05:18 +01:00
Carlos Garcia Campos
255225584e printing: Do not truncate job names in GtkPrintOperation
We are currently truncating job names to 255 bytes, because that's the
maximum allowed length of job-name attribute in CUPS. This is a CUPS
limitation that GtkPrintOperation shouldn't need to know, and it
shouldn't affect other backends, that might have other limitations or
even no limitation at all. This has another side effect, that what you
set as GtkPrintOperation:job-name could be different to what you get if
the property is truncated, this is not documented in
gtk_print_operation_set_job_name(). So, I think the job name should be
truncated by the CUPS backend, right before setting the job-name
attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=774097
2016-11-10 16:56:43 +01:00
Matthias Clasen
b109d25e8b Some forgotten deprecation cleanup 2016-10-20 13:58:49 -04:00
Javier Jardón
101da71ee3 Use upstream gettext
https://bugzilla.gnome.org/show_bug.cgi?id=373745
2016-05-16 20:46:19 +01:00
Matthias Clasen
d1b07bc386 Add a comment to explain numbers here
This explains the change in the previous commit.
2016-04-19 07:34:44 -04:00
Piotr Drąg
3fe08b3b28 cups: Fix duplicate string
https://bugzilla.gnome.org/show_bug.cgi?id=765122
2016-04-19 07:25:17 -04:00
Bastien Nocera
97d27ca2f8 cups: Fix gettext usage
The previous patches didn't mark some strings as to be translated, and
tried to translate strings with a variable part already inside the
string, which isn't going to work.

Mark the strings as translatable with context, and also make sure to
translate static strings when getting them out of their structure.

https://bugzilla.gnome.org/show_bug.cgi?id=764585
2016-04-16 18:43:12 +02:00
Felipe Borges
b0b1bf2f58 cups: make string non-literals translatable again
Notice that C_ just takes string literals as arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=764585
2016-04-14 18:55:21 +02:00
Felipe Borges
027702e453 cups: Fix more "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764585
2016-04-13 14:17:24 +02:00
Bastien Nocera
93363551d7 cups: Fix "format not a string literal" error
https://bugzilla.gnome.org/show_bug.cgi?id=764585
2016-04-05 12:58:58 +02:00
Matthias Clasen
a64dd9ccf3 printing: Add message contexts
Some of the translated strings in the cups printbackend are short
and generic and might occur in other contexts. Give them disambiguating
message contexts to avoid translation problems.
2016-02-16 18:32:43 -05:00
Chun-wei Fan
d07f00d98f CJK Windows: Silence gtk_style_context_set_state() warnings
We need to update calls to gtk_style_context_set_state() in
gtkimcontextime.c, so that the state passed into that function would be in
line with what GtkStyleContext expects, due to updates in the CSS
machinery, as outlined in this link[1], which is based on information in
in Matthias' blog[2].

Doing so will silence the gtk_style_context_set_state() warnings, which is
emitted when a widget uses gtkimcontext on Windows with CJK IME, which will
in turn call gtkimcontextime.

[1]: http://feaneron.com/2016/01/04/quick-guide-to-port-an-app-for-gtk-3-20/
[2]: https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/

https://bugzilla.gnome.org/show_bug.cgi?id=760314
2016-01-08 23:37:31 +08:00
Felipe Borges
98080e0289 printing: always propagate Collate value
https://bugzilla.gnome.org/show_bug.cgi?id=728344
2016-01-06 14:50:49 +01:00
John Ralls
571704824f Bug 753992 - im-quartz discard_preedit segmentation fault
Replace checking if the NSView is really a GdkWindow, which will crash
in the likely event it's not a GObject, with ensuring that the parent
GdkWindow is really a GdkWindowQuartz.
2015-10-03 22:28:36 -04:00
Michael Weghorn
bf9c9f1762 Don't mix in user options of printer instances
GTK+ currently does not support printer instances in the printing
dialog. This commit avoids user options set for specific instances of
a printer being accidently applied to the printer with the same name but
no specific instance defined.

https://bugzilla.gnome.org/show_bug.cgi?id=753628
https://bugzilla.gnome.org/show_bug.cgi?id=582747
2015-09-24 18:14:07 +02:00
Michael Weghorn
838391e420 Improve printer distinction for option retrieval
In order to retrieve the user options for a printer, the respective
printer name is used.
This fixes the comparison of printer names to avoid that the options of
another printer are accidently read whose name starts with the same
letters, but is longer (e.g. "myprinterlongername" instead of
"myprinter").

This fixes Bug 753628.
2015-09-11 15:19:35 +02:00