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 496167 - GailButton action click should synthesize a press GdkEvent
GailButton action click should synthesize a press GdkEvent
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: gail
git master
Other Linux
: Immediate normal
: ---
Assigned To: Li Yuan
Li Yuan
Depends on:
Blocks:
 
 
Reported: 2007-11-12 16:28 UTC by Alejandro Piñeiro Iglesias (IRC: infapi00)
Modified: 2008-04-02 08:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the bug (959 bytes, patch)
2007-11-12 16:31 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
none Details | Review
updated patch (1021 bytes, patch)
2008-04-01 07:08 UTC, Li Yuan
committed Details | Review

Description Alejandro Piñeiro Iglesias (IRC: infapi00) 2007-11-12 16:28:39 UTC
At this moment, the action click is implemented on gailbutton by simply calling gtk_widget_activate.

This works for widgets like button, where you only require to activate it. But in some cases the click action requires receive the press event, for example, with a slide-kind widget, where you press to modify the value of an element from the press until the release, in a continuous way

The gtk_widget_activate should be substitued by a GDK press event followed by a GDK release event.
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2007-11-12 16:31:05 UTC
Created attachment 98975 [details] [review]
Fixes the bug

This patch fixes the bug, by implementing the click action as a press event followed by a release event.
Comment 2 Li Yuan 2008-01-24 07:33:05 UTC
Are press/release actions competent in the situation you described?
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-01-24 08:46:35 UTC
I think that I don't fully understand you. Press/release competent? You ask if applying this patch the click action in other cases still works? I tested it and it works with a normal button, not only in this case.

But to avoid problems, I will try to add some context. To test this problem I was using dogtail.

If I execute the action press on this custom element, a gdk event press is used, and the value start to being modified.

If then I execute the action release, the value stop to being modified (although this required the fix on http://bugzilla.gnome.org/show_bug.cgi?id=336644)

But if I try to use directly the action click, the value doesn't changes, at the custom widget uses the press/release events to manage how modify the value. If I made a "click function" on dogtail, based on call the action press and then the action release it works. 

The patch at comment 1 simply implements the click action in this way on gail button. 
Comment 4 Li Yuan 2008-01-24 09:05:24 UTC
Sorry I didn't describe clearly. I understand the bug and the patch you made. I mean can you use press/release actions to modify a slide-kind widget's value, as a work around? Which from the comment #3, you can :-)
Comment 5 Li Yuan 2008-03-17 06:45:26 UTC
(In reply to comment #3)
> But if I try to use directly the action click, the value doesn't changes, at
> the custom widget uses the press/release events to manage how modify the value.
> If I made a "click function" on dogtail, based on call the action press and
> then the action release it works. 

So how about we just call:

button->in_button = FALSE;
gtk_button_leave (button);

in your patch to simulate a release?
Comment 6 Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-03-17 16:47:47 UTC
I suppose that you are talking about change:
	  tmp_event.button.type = GDK_BUTTON_RELEASE;
	  gtk_widget_event (widget, &tmp_event);
with 
          button->in_button = FALSE;
          gtk_button_leave (button);

I have just make a test and doesn't works. As the patch launches a gdk event "press", after this change, trying to use a click leads to the button kept in pressed state continuosly.

Anyway, as probably I could misunderstand comment 5, I tried too to simply add this two lines to the previous click button implementation, so:
          gtk_widget_activate (widget);
          button->in_button = FALSE;
          gtk_button_leave (button);

but this doesn't work either.
Comment 7 Li Yuan 2008-04-01 07:07:03 UTC
I tried you patch. Seems after applying your patch, when perform click action on a button, the color of the button changes, just like the mouse stays on the button. I guess the button listens the "fake" event of press and changes the color, but never receives the event indicates the mouse leaves.
Comment 8 Li Yuan 2008-04-01 07:08:14 UTC
Created attachment 108396 [details] [review]
updated patch

this patch can solve the problem by emitting button leave event, can you try it?
Comment 9 Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-04-01 16:08:08 UTC
(In answer to comment #7)
On the code where I detected the bug this problem isn't showed. Anyway I tested it in other environment and in other application (in this case gcalctool) and I see this "on press color" problem that you pointed

(In answer to comment #8)
I test this patch, and it seems to work with gcalctool, avoiding the color problem. In the same way, it still solves the problem described on comment #0