Re: Combobox on touchscreen
- From: Roland Koebler <rk-list simple-is-better org>
- To: gtk-app-devel-list gnome org
- Subject: Re: Combobox on touchscreen
- Date: Tue, 27 Jun 2017 09:37:18 +0200
Hi,
On Mon, Jun 26, 2017 at 10:08:36AM +0000, Rúben Rodrigues wrote:
Following this post that didn't receive an answer
https://mail.gnome.org/archives/gtk-app-devel-list/2016-June/msg00030.html
, want to ask if someone knows this problem.
I know this problem, since I wrote this mail. But maybe I'm the only one, and
noone else cares. :(
Sometimes combobox works,
but i think that is dificult to change the state of the combobox. There
is a workaround?
I know two workarounds:
1. Patch the library with my patch, see https://bugzilla.gnome.org/show_bug.cgi?id=333470
2. Stack a transparent button on top of the combobox.
I'm using the 2nd way, by using the following function in Python
for every combobox. It's not perfect (and only a workaround and not
a real solution), but as long as the GTK+-developers don't care,
that's all I can do.
--
def workaround_combobox_touch(widget):
"""Workaround for comboboxes for touchscreens.
Comboboxes (and menus) do not work with touchscreens, due to a bug in
GTK+3, bugnumber #33470.
There are usually 2 ways to select a combobox-entry:
1. press + move + release
This works with touchscreens in GTK+2 and partly in GTK+3 3.4, but not
in e.g. GTK+3 3.20: Press + move does not move the selection, but tries
to scroll the combobox-popup.
2. click -> popup, click -> select/popdown
This does not work on touchscreens, since (a) some touchscreens send
MotionNotify-events with 0 pixels movement after the press and (b)
GTK+ closes the combobox-popup if a MotionNotify-event occurred
during the click.
So, this workaround stacks a transparent button above the combobox, and
opens the combobox-popup on button-click.
"""
container = widget.get_parent()
left = container.child_get_property(widget, "left-attach")
top = container.child_get_property(widget, "top-attach")
button = Gtk.Button()
button.set_label("")
button.set_opacity(0)
button.connect("clicked", lambda w, _=None: widget.popup())
container.remove(widget)
container.attach(button, left, top, 1, 1)
container.attach(widget, left, top, 1, 1)
--
Roland
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]