After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 457288 - Rectangular tool stuck in subtraction mode
Rectangular tool stuck in subtraction mode
Status: RESOLVED OBSOLETE
Product: GIMP
Classification: Other
Component: Tools
2.2.x
Other Linux
: Low normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2007-07-16 07:33 UTC by Art McBain
Modified: 2018-05-24 12:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gimp-bgo457288.diff (2.19 KB, patch)
2012-01-10 22:45 UTC, Federico Mena Quintero
needs-work Details | Review

Description Art McBain 2007-07-16 07:33:32 UTC
The rectangular selection tool is stuck in subtraction mode -
This means that if I try to select something outright, it doesn't.
The obvious 'fix' is to just hold down shift, but that causes it to select a perfectly square area.

I've had the bug since 2.2.13, and when I upgraded, it is still stuck.
Are there any components used from version to version?

No other tools are stuck, or have become stuck.



If this is not a bug, and an OS problem, feel free to remove this.
I'd just like to know... if possible.


Windows XP, service pack 2 + all automatic updates since then.
Comment 1 Michael Schumacher 2007-07-16 07:45:42 UTC
Did you try to set a different mode in the tool options?
Comment 2 Art McBain 2007-07-16 07:54:18 UTC
(In reply to comment #1)
> Did you try to set a different mode in the tool options?
> 

Yes. It is still stuck. I can use the tool mostly well if I use shift + fixed size. But that requires guessing the size of the area I want, sometimes.
Comment 3 Michael Schumacher 2007-07-16 08:20:06 UTC
I can't reproduce this. The mode is saved to whatever value was active when I quit GIMP, but setting it to a different one in the tool options is possible (and gets saved, too).
Comment 4 Art McBain 2007-07-16 08:34:54 UTC
(In reply to comment #3)
> I can't reproduce this. The mode is saved to whatever value was active when I
> quit GIMP, but setting it to a different one in the tool options is possible
> (and gets saved, too).
> 

Well, alright. Thanks. I can't get it unstuck, so I guess I'll have to live with it. I don't know what caused it to get stuck, and it's not a keyboard issue (it's only the GIMP) so I can't provide further info. And I have been able to save the mode, fixed vs free etc., but that doesn't change anything. It still starts up in subtraction mode. Even if I close the GIMP with a different tool open.

You can mark this as closed if you wish. I'm saving it as not-a-bug.
Comment 5 Michael Schumacher 2007-07-16 10:17:19 UTC
Are we talking about the same "Mode"? See http://docs.gimp.org/en/gimp-tools-selection.html#gimp-tool-select


However, Bugzilla is not a help forum, so next time you should ask on the mailing lists after consulting the manual.
Comment 6 Federico Mena Quintero 2007-08-23 16:25:00 UTC
This is trivial to reproduce:

1. Open an image or create a new one.

2. Select the rectangle tool.

3. In the tool options, select "replace the current selection" (the first option - this should be the default)

4. Press and release Ctrl in the image window.  The tool is now stuck in subtraction mode.

This doesn't happen if you press and release Shift instead of Ctrl in (4).  If you use Shift, the cursor gets the "+" indicator while Shift is pressed, and goes back to normal when Shift is released.  Ctrl gets stuck, however.
Comment 7 Art McBain 2007-08-23 16:39:10 UTC
I agree with the previous status of NOTABUG, RESOLVED and CLOSED.  Reasoning: I was hasty to post, and I didn't know GIMP as well as I thought I did.  This "bug" I submitted was resolved by pressing one of the specially designed mode buttons.  This fixed the issue of it always starting up in subtraction mode.  There is no bug, only my stupidity.  Please close this thread.
Comment 8 Federico Mena Quintero 2007-08-23 17:18:11 UTC
> was resolved by pressing one of the specially designed mode buttons

This is not a fix; it's a workaround :)

I just found out that gimp_display_shell_canvas_tool_events() does *not* get called when you release Ctrl.  It gets called just fine when you press/release Shift and when you press Ctrl.  I'll dig deeper into GTK+ to see if it's eating the Ctrl-release...
Comment 9 Federico Mena Quintero 2007-08-23 17:37:06 UTC
Actually, gimp_display_shell_canvas_tool_events() gets called just fine when you release Ctrl.  However, event->keyval = GDK_ISO_Prev_Group (0xfe0a) instead of GDK_Control_L or GDK_Control_R.  That's why the function is ignoring the Ctrl release.

(When you press Ctrl, event->keyval = GDK_Control_L as expected.)

GTK+ does some magic to deal with this kind of stuff relative to the X keyboard map; I'll look it up.
Comment 10 Michael Schumacher 2007-08-23 17:52:33 UTC
I'm still unable to reproduce this.
Comment 11 Federico Mena Quintero 2007-08-23 18:16:26 UTC
I'm getting GDK_ISO_Prev_Group because I've got "both Ctrl keys change keyboard layout" turned on in gnome-keyboard-properties.  If I disable that option, pressing and releasing Ctrl in the GIMP no longer causes it to get stuck in subtract mode.

This is still a bug somewhere.

(01:12:47 PM) owen: federico: OK, svu might have an idea of whether there would be an alternate way to do that with XKB that avoids the issue
(01:13:34 PM) owen: federico: But it's certainly what is giving the issue
(01:14:35 PM) owen: federico: it's all possible that the case of a self-modifying key should be special-cased to give consistent values on press and release
(01:14:59 PM) owen: federico: I don't really know enough about XKB to know how feasible that would be to implement or whether it would be consistent with the spec
Comment 12 Federico Mena Quintero 2007-08-23 18:29:41 UTC
This is very similar to the general bug #346029 - which is https://bugs.freedesktop.org/show_bug.cgi?id=7430 upstream.
Comment 13 Michael Schumacher 2007-08-23 18:54:05 UTC
This is relevant for Windows?
Comment 14 Federico Mena Quintero 2007-08-23 23:47:45 UTC
(In reply to comment #13)
> This is relevant for Windows?
> 

Probably not.  Moving to Linux.
Comment 15 Raphaël Quinet 2007-08-24 15:40:49 UTC
Unfortunately, there is absolutely nothing that GIMP can do about it because it does not get the event that it should normally get from the X server through GTK+.  This bug can only be solved on the XKB side, so I am marking this as a duplicate of bug #346029 (like the previous bug #345726 that also affected GIMP).


*** This bug has been marked as a duplicate of 346029 ***
Comment 16 Raphaël Quinet 2007-08-24 15:49:22 UTC
I forgot to mention that the easiest workaround for those who are affected by this bug is to disable the keyboard layout switching: in GNOME, this is in
System -> Preferences -> Keyboard -> Layout Options -> Layout switching
Deselect the option "Both Ctrl keys together change layout", or "Both Alt keys..." or "Both Shift keys...".  A better solution is to use the Keyboard Indicator applet.
Comment 17 Federico Mena Quintero 2007-08-25 00:30:11 UTC
The problem with closing a bug which you can't solve (but someone else can) is that the bug will be forgotten, and there will be no incentive to fix it :)

Reopening.
Comment 18 Federico Mena Quintero 2007-08-25 00:34:27 UTC
There's action in the upstream bug, so we can be confident that it will be fixed soon.  Just leave it around; I'll close the bug once the XKB fix comes in.
Comment 19 Raphaël Quinet 2007-08-29 16:33:17 UTC
Well, you could have reopened bug #345726 instead, but that will do for now ;-)
Comment 20 Sven Neumann 2008-06-05 06:39:37 UTC
Federico, has anything happened related to this in the meantime? It doesn't seem to make much sense to keep a bug report open for a bug in xkeyboard-config that is stalled.
Comment 21 Federico Mena Quintero 2008-06-05 15:13:28 UTC
No idea.  CCing svu.

Sergey, do you know the status of this bug upstream?

Do you need me to test anything?
Comment 22 Michael Natterer 2011-09-23 23:53:30 UTC
Federico, and news about this bug?
Comment 23 Federico Mena Quintero 2011-09-26 22:51:13 UTC
No idea, sorry.

I think svu mentioned at some point that this would be a huge pain in the ass to fix with XKB rules.

(In the meantime, many months ago, I switched to using Shift-Shift instead of Ctrl-Ctrl to switch keyboard layouts.  Now the bug happens with Shift instead of Control, and the tool gets stuck in addition mode - not as bad, but still...)
Comment 24 Michael Natterer 2011-09-26 22:58:34 UTC
So you traded one evil for another :) I really don't know what to do here,
the press and release events are not paired, and there is no focus in
our out to compensate for the missing ones. I'm out of ideas.
Comment 25 Federico Mena Quintero 2011-09-27 16:15:10 UTC
Well, I changed from ctrl-ctrl to shift-shift for ergonomics, not to actually deal with this bug :)

Assuming that comment #9 still matches the code, would it be possible to hack gimp_display_shell_canvas_tool_events() so that it checks the event's state and uses that to frob the mode of the selection tool?  Something like

static gboolean
gimp_display_shell_canvas_tool_events (...)
{
   if (selecting && event->type == GDK_KEY_RELEASE) {
     if ((event->state & GDK_CONTROL_MASK) == 0)
        stop_subtracting ();

     ...
   } else {
     /* process keys normally */
     ...
   }
}

i.e. "we know key_release keysyms may not be accurate, but we can use the event's state to figure things out" just for the selection case.
Comment 26 Michael Natterer 2012-01-08 16:38:11 UTC
Are there any objections if I close this as WONTFIX? We can't compensate
for all possible things that modify the event stream, and windows
users are told all the time to go away with their "gui tweaking"
tools.
Comment 27 Federico Mena Quintero 2012-01-10 19:18:41 UTC
Or maybe I should get off my ass and see if this easily fixable with a hack like the one I mentioned :)

Feel free to make this bug really low priority.
Comment 28 Federico Mena Quintero 2012-01-10 19:19:19 UTC
Actually, I'll WONTFIX it, and reopen it if I ever produce a working patch.
Comment 29 Michael Natterer 2012-01-10 19:43:49 UTC
Thanks :)
Comment 30 Federico Mena Quintero 2012-01-10 22:45:52 UTC
Created attachment 204988 [details] [review]
gimp-bgo457288.diff

This patch doesn't work, but it's probably a start.

The modes don't "return" to what they were before toggling, I get a g_warning() sometimes when refocusing a window, and it's just not done - but make of it whatever you want :)
Comment 31 Michael Natterer 2012-01-10 23:32:35 UTC
Try dropping the last "active" from the function name. Reopening so it
doesn't get lost.
Comment 32 joramvh 2013-11-10 01:53:43 UTC
I regularly get this on Mac OS X 10.8.5, with GIMP 2.8.6. Happens when the selection tool is active (rectangular, but also seen it happen with elliptical selection), then using Cmd + Tab to switch between applications. Eventually, GIMP gets the selection tool stuck in subtraction mode, with no possible recovery, apart from quitting and reopening GIMP.
Comment 33 GNOME Infrastructure Team 2018-05-24 12:13:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/246.