all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: 31884@debbugs.gnu.org
Subject: bug#31884: 26.1.50; Wrong icon in gtk tooltips
Date: Mon, 18 Jun 2018 22:03:58 -0300	[thread overview]
Message-ID: <CAELgYhczwvik_QCYn-U4qiPFx-ue+zg9SHpHbUA7h+dJMByp3g@mail.gmail.com> (raw)
In-Reply-To: <CAELgYhe7oV1NHqPdjEoOFZSy-Ynk1i+EEi+CPck98=Su6MZFUQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

Tags: patch

This was a hard one to find...

The problem is in gtkutil.c xg_show_tooltip: gtk_widget_show_all makes
the icon that comes by default with a tooltip visible, which is
undesirable since that icon was never set. The fix is to simply use
gtk_widget_show.

Attached is a python script that reproduces the behavior, trying to
mimic the real emacs code. The first time you press the button show is
called and the tooltip has no icon, as expected. The second time
show_all is called and the missing icon problem manifests. If you keep
pressing the button show and show_all alternate, but the missing icon
is still there since it has been made visible forever by the first
show_all call.

[-- Attachment #2: tooltip.py --]
[-- Type: text/x-python, Size: 1307 bytes --]

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk  # noqa


class App(Gtk.Window):

    def __init__(self):
        super().__init__()
        self.tip = self.tip_win = self.tip_lbl = None
        self.all = False
        self.set_size_request(250, 200)
        self.set_tooltip_text('Hi')
        self.connect("destroy", Gtk.main_quit)
        self.connect("query-tooltip", self._tip_cb)

        fixed = Gtk.Fixed()
        self.add(fixed)
        button = Gtk.Button("Button")
        button.set_size_request(80, 35)
        fixed.put(button, 50, 50)
        button.connect("clicked", self._show_tip)

        self.show_all()

    def _tip_cb(self, top_win, x, y, xt, tip):
        if self.tip_win is None:
            top_win.set_property("has-tooltip", False)
            self.tip = tip
            self.tip_lbl = Gtk.Label("Top window tip")
            self.tip.set_custom(self.tip_lbl)
            self.tip_win = self.tip_lbl.get_toplevel()
        return False

    def _show_tip(self, _):
        if self.tip is None:
            return
        self.tip.set_custom(self.tip_lbl)
        if self.all:
            self.tip_win.show_all()
        else:
            self.tip_win.show()
        self.all = not self.all

if __name__ == "__main__":
    pyapp = App()
    Gtk.main()

  reply	other threads:[~2018-06-19  1:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 18:24 bug#31884: 26.1.50; Wrong icon in gtk tooltips Carlos Pita
2018-06-18 19:08 ` Carlos Pita
2018-06-19  1:03   ` Carlos Pita [this message]
2018-06-20  0:09     ` Noam Postavsky
2018-06-20  0:12       ` Carlos Pita
2018-06-20 23:47         ` Noam Postavsky
2018-06-21  0:18           ` Carlos Pita
2018-06-22  0:18             ` Noam Postavsky
2018-06-19  1:15 ` bug#31884: Carlos Pita
2018-06-19  1:17 ` bug#31884: (no subject) Carlos Pita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhczwvik_QCYn-U4qiPFx-ue+zg9SHpHbUA7h+dJMByp3g@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=31884@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.