font name dropdown steals focus, doesn't close after selection is made

Bug #168161 reported by Paul d'Aoust
62
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Unassigned
Nominated for 0.47.x by Felipe "Juca" Sanches

Bug Description

When I drop down the font selection listbox, it steals focus from the
entire window system (the window manager in question is Metacity). The only
thing that will restore the focus is to explicitly close the listbox,
either by selecting a font or pressing the listbox drop-down button. When I
press Esc, focus isn't restored. The funny thing is that I can still keep
on adding new text objects on the Inkscape canvas, even when the listbox
still has focus.

It looks like a home-rolled widget to me, so perhaps there are some bugs in
the implementation.

Using autopackage.org build ver 0.44.1 on Ubuntu Linux 6.06. Window manager
is Metacity 2.14.5

Tags: fonts ui
Revision history for this message
Bryce Harrington (bryce) wrote :

I also see strange window-focus stealing behaviors with the text dropdown. This needs additional testing and bug fixing. Maybe we should reimplement the font dropdown widget using more standardized widgets, if available.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Tom Davidson (tjd-mit) wrote :

This has now also been reported on Windows (see dupe bug 192451)

On Fedora 8, the most natural workaround I've found to dismiss the dropdown is to select the new font and hit Enter.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Marking status High since this is a very visible bug that is now appearing cross-platform. Mderezynski, this looks like it was assigned to you a long time ago (before the launchpad migration, anyway). I'll unassign you for now--if you are in fact working on it just reassign yourself or leave a note here in the comments...

Changed in inkscape:
assignee: mderezynski → nobody
importance: Medium → High
Revision history for this message
Tom Davidson (tjd-mit) wrote :

Should say, I've confirmed it in SVN rev 17490 (Feb 25, 08, under Fedora 8)

Revision history for this message
Paul d'Aoust (paul) wrote :

aw, I liked my original title 'font name dropdown steals focus ruthlessly' -- I thought it was more dramatic :-)

Revision history for this message
ScislaC (scislac) wrote :

Does it still have stolen focus after hitting the Enter key?

Revision history for this message
Paul d'Aoust (paul) wrote :

It looks like it does, at least on SVN 20070104 build. The widget disappears, but you still can't focus any window (Inkspace or otherwise) on the workspace. Widgets inside the Inkscape window, as well as the canvas, are still responsive, which is kinda odd. The only way to make the font selection widget 'let go' is to reopen the widget, then close it with the drop-down button. Trying to close it by selecting a font doesn't work; it changes the font of the currently selected text, but doesn't make the widget disappear or relinquish control. I've observed the same behaviour for both Enter and Esc.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Paul--I liked your title, too. Sorry about that :)

In today's SVN I find that after I have selected a new font, hitting 'Enter' or 'Esc' closes the drop down *and* gives up focus. Bulia did some work on the font drop-down menu recently (changes entered on Jan 16; see bug 168320. Paul would you be able to test a more recent SVN? Here are the simplest steps that give me this behavior:

1- launch inkscape to empty document
2- type 'T' to select the text tool
3- click on the down-arrow next to the font name to open the font drop down menu
4- select a different font than is currently selected
5- hit 'enter' or 'esc'

->dropdown closes, focus is normal: I can click on other application windows, system menu bars, etc. If after following these steps I now click on the canvas to start a new text entry, the newly-selected font is correctly applied. I.e. no other problems.

Revision history for this message
Paul d'Aoust (paul) wrote :

Hi, Tom. Thanks for the support on the title issue :-)

I downloaded and compiled a snapshot from 25 Feb. Taking your steps, I have no focus problems at all, strangely. I don't know why the widget doesn't disappear when you choose a new font, though -- it should behave like any other menu or listbox, IMO. However, I noticed that my steps to reproduce the problem are different from the steps you listed, so here are my steps:

1. Launch Inkscape to empty document
2. Type 't' or press the text tool button
3. Create a new text object by clicking on the canvas (this is what I'm doing differently)
4. Click on the down-arrow next to the font name to open the font drop-down menu

Then, from there, different things happen depending on what your next step is. The behaviour in 20080225 is slightly different from 20080104.

5a. Click anywhere outside the drop-down menu. Canvas and UI in Inkscape windows still respond, as before, but nothing in any other window -- including the window frame -- responds. Same as 20080104.
6a. Click twice on the Inkscape canvas. The font listbox disappears.

OR

5b. Press Enter or Esc. The font listbox disappears.until you click once on the canvas -- then mouse events behave as they should. Keyboard events, however -- like coming back to my web browser and trying to finish this bug report -- don't. Reopening and closing the font listbox (with its down-arrow button) solves the problem. I have to press the down-arrow button twice to close it though.

Here's where it gets really weird. I noticed with my compiled copy of 20080225 that window hinting doesn't work properly, so the font listbox has its own entry on the taskbar! (I am sure this is not a bug; it's most likely a result of my laziness. I didn't 'make install'; I just ran it from the src/ directory.) On step 6a, its entry doesn't disappear; it just gets hidden behind the Inkscape main window. I can bring it to the top of the window stack by clicking on its taskbar entry. On step 5b, however, it looks like the widget truly does get destroyed, because its taskbar entry disappears.

Another curious problem is that neither step 6a or 5b are enough to relinquish total control. Mouse events are freed, and I can click on any window and any widget inside it, but keyboard events are still being captured by Inkscape. I kept trying to add to this bug report, but everything I tried to type would appear on the Inkscape canvas, even though the web browser window had focus!

The final step to make everything go back to normal is thus:

7. Re-open and close the font listbox via its down-arrow button.

One last comment: on 20080104, I could use the up and down arrows to move through the fonts in the listbox, but on 20080225 I can't. I don't use the arrow keys anyway, but I thought I should mention it.

Revision history for this message
StevenD (daytonmeister) wrote :

Fonts still cannot be changed in version 0.46 that I just downloaded last week. Fonts cannot be selected from the font list drop down. We're talking about something as common as Arial Black. I'm working on Windows XP. The work around is to change the font in the XML editor. I sure hope this will get fixed in the near future.

Revision history for this message
StevenD (daytonmeister) wrote :

I tried this on my Vista machine at home after downloading and installing version 0.46 last night and it doesn't work there either. In addition to the previous comment here are some other things.

When I select a font in the font list the only way to have the name of the font display in the font field is to click Enter. But when I start to type on the page the previous font used is reverted to.

If I select the characters I have just typed on the page and attempt to change the font I can't even do that. I'm not allowed to select any font in the list.

The font names appear to be grayed out as well in the whole list of fonts which appears to me that I'm not even supposed to be able to select anything.

Revision history for this message
isayhelloyousaygoodbye (ihiubye) wrote :

same behaviour on win xp with the release version built april 1st.
workaround via the "text and font" dialog. please fix :-)

Revision history for this message
Marcin Floryan (mfloryan) wrote :

This is related to #16832 but since the latter is already closed this one should probably now have the main focus for font dropdown issues.

Revision history for this message
Tony Baker (frd91gt) wrote :

This font drop down box is actually a combination of several widgets. An entry box, button, and scrolled window. This provides some awkwardness in the code when it comes to all the events that link these widgets together. Currently what is causing these major problems is the gdk_pointer_grab() call. From what I can tell this forces the user to use the scrolled window and blocks all other events outside of it.

I almost had a fix programmed but the way some of the events are pushed if you press the down button when the scrolled window box is open it will close the scrolled window box and reopen it. This behavior differs from the font size box next to it.

I am willing to do the development on replacing this with a gtk_font_button, if approved. The only feature that would be lost to the user would be the search functionality that is currently in place when you type in the font input box.

From what I have heard this is an important and crucial feature.

Revision history for this message
Ulferikson (ulferikson) wrote :

Wouldn't it be enough to explicitly close the popdown window after a selection has been made? That and changing fallback font to Tahoma (Windows default system font on WinXP) seems to work for me.

Revision history for this message
Erik Johnson (ekriirke) wrote :

I've the same for the build 2008-07-08, WinXPSP3
I click the dropdown, the list shows. I select my font and the font changes in the textbox, but the dropdown does not close.
A side note, the dropdown appears to be another application or window alltogether, as a new taskbar icon appears in explorer (entitled "inkscape.exe") while the dropdown is visible. The dropdown has no border as well, so its just 'floating'

Revision history for this message
RedStarLabs.org (redstarlabs) wrote :

Same here.

In addition, when I click the font drop-down button the font list doesn't appear. A black box flashes instead. I have to click the button a second time to make the list appear. Sometimes it even requires 3 or 4 clicks! The behaviour repeats after I close the font list (pressing Enter or the dropdown button, click or double click don't work).

I'm using Ubuntu Hardy (8.04), GNOME desktop environment (Metacity window manager). The Inkscape version is the one in the Ubuntu repositories (0.46, built Apr 7 2008). I can make a short video if needed, just ask :)

Thanks!

Giuseppe

Revision history for this message
SK (stephantom) wrote :

This bug is present in 0.47+devel at least until rev 19984.
Is there any progess on this one?

Revision history for this message
Bingo Tailspin (bingotailspin) wrote :

I am having an issue with Ubuntu Hardy (8.04) like RedStarLabs.org.

If I select the text, then click the down button to change font, nothing happens.
If I click within the font name text and leave the cursor there, then click the down button, it works!

FWIW, this program is completely awesome! As a CorelDRAW refugee, I am so happy to find this gem of a program on my Linux machine. And .svg as the default format is pure joy and genius. Scribus, Xarus (sp?), and DIa are all sad crash-ware and pale in comparison. I am up and running doing complex stuff with only a couple of dives into the help files. Thanks to all involved.

Revision history for this message
RIco (rico-rootscore-deactivatedaccount) wrote :

font drop down still not closing after font selection
Inkscape 0.46+devel r20520 ubuntu 8.10

Revision history for this message
storm1277 (bthorogood-internode) wrote :

I'm seeing the same problem - also have Inkscape 0.46 on Ubuntu 8.10

Revision history for this message
RIco (rico-rootscore-deactivatedaccount) wrote :

same behaviour svn r20833 ubuntu 8.10,
I tried to disable compositing managers and no change.

Revision history for this message
StevenD (daytonmeister) wrote : Re: [Bug 168161] Re: font name dropdown steals focus, doesn't close after selection is made

It is still there.

I would like to be able to select a new font from the drop down without
having to go to another dialog to do that.

On Thu, Mar 5, 2009 at 5:34 AM, RIco <email address hidden> wrote:

> same behaviour svn r20833 ubuntu 8.10,
> I tried to disable compositing managers and no change.
>
> --
> font name dropdown steals focus, doesn't close after selection is made
> https://bugs.launchpad.net/bugs/168161
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Inkscape: A Vector Drawing Tool: Confirmed
>
> Bug description:
> When I drop down the font selection listbox, it steals focus from the
> entire window system (the window manager in question is Metacity). The only
> thing that will restore the focus is to explicitly close the listbox,
> either by selecting a font or pressing the listbox drop-down button. When I
> press Esc, focus isn't restored. The funny thing is that I can still keep
> on adding new text objects on the Inkscape canvas, even when the listbox
> still has focus.
>
> It looks like a home-rolled widget to me, so perhaps there are some bugs in
> the implementation.
>
> Using autopackage.org build ver 0.44.1 on Ubuntu Linux 6.06. Window
> manager
> is Metacity 2.14.5
>

--
mmm Bread. From wheat to eat.

Revision history for this message
altery (yves-alter) wrote :

Same problem. Additionally, if I open the font selection drop down I'm unable to close it immediately again. I have to leave the button and reenter it again with the cursor. The font list is animated by compiz like an ordinary window an not like a menu. I use 0.46 stable on ubuntu 8.10.

Revision history for this message
Garoth (garoth) wrote :

Problem also very annoying for tiling window managers.

Revision history for this message
Maarten Maathuis (madman2003) wrote :

Some thoughts:

- Make this a proper dropdown dialog:
 - That means making it override redirect, so the window manager won't mess with it.
 - Give it an appropriate window type, something like _NET_WM_WINDOW_TYPE_DROPDOWN_MENU

Revision history for this message
Bart (bart-friesoft) wrote :

Having the same problem since upgrade to Ubuntu 9.04. using inkscape 0.46, built 8-4-2009.

Revision history for this message
Felipe "Juca" Sanches (felipe-sanches) wrote :

this is an initial patch to substitute the current font selector implementation (which uses a gtkWindow).

My implementation uses a GtkComboBoxEntry widget. It has autocompletion and font preview.

I have noticed some glitches when dealing with multiple fonts in a single text object, so this patch still needs to be improved. There is also a bunch of not used code that should be removed once this patch gets committed.

I'd like to ask you to try this patch and provide feedback. I expect not only feedback from the user perspective but also code-wise advices.

Revision history for this message
ScislaC (scislac) wrote :

I think it's a good start Felipe... I think we need people on Vista specifically to try it. The one we currently have is completely unusable on Vista, so if yours is... it would be motivation to push it.

Revision history for this message
bbyak (buliabyak) wrote :

I tested it on Win XP (I have no Vista to test) and, while it's certainly an improvement, there are a few issues:

- type some text, select it, open the drop-down, navigate by keys, press Enter. The font is assigned. Now press left-arrow - instead of moving text cursor, it highlights the font name in the toolbar. To fix, whenever you close the drop-down, either by choosing a font or by escaping, you must pass focus to the canvas - see spinbutton_defocus for how to do this.

- the font name in the toolbar is selectable but not editable. In the old code, there was a very convenient type-ahead capability: if you type part of the font name there, it displays a drop-down with matching fonts. That drop-down was different (no previews) and didn't steal the focus. Can you try to restore this old functionality with your patch?

- it still steals focus, but in a different way :( Do this: while the drop-down is open, Alt+tab to a non-Inkscape window. It won't show. Now Alt+tab back to Inkscape and close the drop-down, then try to Alt+tab to any other window - still does not work! Only minimizing or closing Inkscape fixes this. I understand you may not be to blame for this, as it looks like GTK madness, but maybe you have an idea...

- In the drop-down, with some text selected on canvas, scroll down the list of fonts with down-arrow; sooner or later you will be jumped back to the start of the list! This happens when the font name in the list does not exactly match the name in the toolbar widget, most likely because the widget gets its font name by assigning it to the selected text, then reading it back. In my case, this happens with the font that is called "Eras" in the list but "Eras ITC" in the widget; when I run across it, the cursor in the list disappears and I'm thrown back to the start of the list.

Felipe, I really appreciate your work, and I think it will be a much needed fix for 0.47. Please see what of the above you can fix. I will try tomorrow to find time to fight some of these problems too.

Revision history for this message
Felipe "Juca" Sanches (felipe-sanches) wrote :

There is one issue with grabbing focus to canvas. One user told me he would like to select the text, then select a font and then keep switching fonts with up/down arrow keys so that he can decide which font looks good in his design. It seems to be a reasonable request.

I have indeed implemented the type-ahead behaviour and it works here (Ubuntu 9.04). Are you sure it is not working on XP? It is implemented using a GtkEntryCompletion attached to the GtkEntry widget.

I havent looked at the other issues you mentioned.

There are some warnings on console. These are due to some portions of the code still trying to manipulate GtkWidgets that are not stored with g_object_set_data anymore since I have changed the GtkWidgets used to build the font selector but still havent looked carefully at the inner workings of text/font handling. Actually I tried to do it sometimes but got very confused.

Revision history for this message
bbyak (buliabyak) wrote :

> There is one issue with grabbing focus to canvas. One user told me he
would like to select the text, then select a font and then keep
switching fonts with up/down arrow keys so that he can decide which font
looks good in his design. It seems to be a reasonable request.

Absolutely! That is the best thing about your patch :) Let's not lose this capability whatever else we fix. I was only speaking about moving focus to canvas when you _close_ the drop-down.

> I have indeed implemented the type-ahead behaviour and it works here (Ubuntu 9.04). Are you sure it is not working on XP? It is implemented using a GtkEntryCompletion attached to the GtkEntry widget.

No, when I try to type, it resets to the first font in the list, and then the font name that's there does not change, I just move cursor to the right with each char no matter what I type. Looks like the field is read-only. But the floating tip with the single name (again, the same first font name in my list) is indeed displayed.

I will look closer into your patch later today.

Revision history for this message
bbyak (buliabyak) wrote :

To keep us on the same page, here's an updated patch which fixes the warnings by fixing the locking. I will now look into focus issues and other things to improve.

Revision history for this message
bbyak (buliabyak) wrote :

Update: I mostly fixed the focus and wrong match issues, but the problem with GtkComboBox is that it by default uses a GtkMenu, which has gray background, is too wide, and clumsy overall. The style property appears-as-list to use list instead is read only (stupid GTK!), only changeable via rc files. I am going to look into a third-party GtkComboGrid widget to see if it is better.

Revision history for this message
Paul d'Aoust (paul) wrote :

I know I'm just adding chatter rather than useful commentary, but as the original bug filer I really want to thank you guys for working on this for us. It's encouraging to see the dialogue; it's clear you're looking for The Right Solution.

By the way, how does the GTK+ port of OpenOffice deal with this? (It is GTK+ on Linux, right?)

Revision history for this message
ScislaC (scislac) wrote :

bbyak,

Is this at a point now where we may want to consider committing to trunk and the rest of the work being done there? At the very least it would give us a head start on widespread testing.

Revision history for this message
bbyak (buliabyak) wrote :

final patch committed in 21518, please test

Changed in inkscape:
status: Confirmed → Fix Released
Revision history for this message
Paul d'Aoust (paul) wrote :

I'm using 21549 for daily production work, and the new font selector is working famously. It's a bit slow, but what do you expect when the computer has to render samples of a few hundred fonts :-) I especially like the type-ahead drill-down feature, although it would be great if you could also type ahead when the listbox was expanded.

Thanks for all the hard work! I'm so happy to see this long-standing bug finally squashed!

Revision history for this message
freespace (s-launchpad) wrote :

This is working great for me, thank you so much!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.