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 701952 - WM's close button doesn't exist
WM's close button doesn't exist
Status: RESOLVED FIXED
Product: gnome-screenshot
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-screenshot-maint
gnome-screenshot-maint
: 703232 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-06-10 18:01 UTC by Jonh Wendell
Modified: 2013-07-08 17:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
trivial patch (1.20 KB, patch)
2013-06-10 18:01 UTC, Jonh Wendell
none Details | Review
proposed patch (6.03 KB, patch)
2013-07-04 19:58 UTC, Jonh Wendell
needs-work Details | Review
proposed patch, v2 (6.14 KB, patch)
2013-07-08 14:11 UTC, Jonh Wendell
accepted-commit_now Details | Review
proposed patch (25.13 KB, patch)
2013-07-08 14:13 UTC, Jonh Wendell
reviewed Details | Review

Description Jonh Wendell 2013-06-10 18:01:30 UTC
Created attachment 246424 [details] [review]
trivial patch

Since commit https://git.gnome.org/browse/gnome-screenshot/commit/?id=05b486421a8003448ec77eda3b152eed8811f4ca which has promoted the dialog to the main window, the "X" close button isn't shown by the window manager.

I think it's a bit weird to have an application without the close button. If not by the window manager, it should have at least an ordinary app close button.
Comment 1 Jonh Wendell 2013-06-26 21:11:20 UTC
hmm, it seems it also broke the menu from appearing...
I've reverted that commit and it worked fine.

Cosimo, what was the motivation of that commit? Particularly, you mentioned 'This makes key activation working again.' What is this?
Comment 2 Cosimo Cecchi 2013-06-28 01:05:05 UTC
(In reply to comment #1)
> hmm, it seems it also broke the menu from appearing...
> I've reverted that commit and it worked fine.
> 
> Cosimo, what was the motivation of that commit? Particularly, you mentioned
> 'This makes key activation working again.' What is this?

The motivation of that commit is previously we were effectively adding a GtkWindow (GtkDialog is a subclass of GtkWindow) into another GtkWindow (the GtkApplicationWindow the code was creating), which is in general a really bad idea, and makes key activation of default widgets not work correctly.

I would be fine with the patch you propose here, and I don't really know why using a GtkDialog breaks the app menu here - could be a bug in either gnome-shell or GTK.

Another approach is to make screenshot-interactive-dialog.c use the same UI, but with an actual GtkApplicationWindow. You would have to replicate the button/content area/response logics that are used there though, which would be a bit tedious.
Comment 3 Jonh Wendell 2013-07-04 19:58:29 UTC
Created attachment 248410 [details] [review]
proposed patch

ok. I turned it a full gtkapplication, that mimics the current behavior, i.e., it doesn't have any regressions.

the idea is to backport this to 3.8 as well.
Comment 4 Cosimo Cecchi 2013-07-05 20:25:46 UTC
Review of attachment 248410 [details] [review]:

Thanks for the patch! This looks great in general, except for the comment below. Could you also do a similar treatment to the result dialog? (the one in screenshot-dialog.c/screenshot-dialog.ui)

::: src/screenshot-interactive-dialog.c
@@ +483,3 @@
+  data->user_data = user_data;
+  g_signal_connect (button, "clicked", G_CALLBACK (capure_button_clicked_cb), data);
+  gtk_container_add (GTK_CONTAINER (button_box), button);

You want to add

gtk_widget_set_can_default (button, TRUE);
gtk_widget_grab_default (button);

here. Note that it needs to be after the gtk_container_add() call, as gtk_widget_grab_default() requires the default widget to be inside a GtkWindow at the moment of the call.
Comment 5 Cosimo Cecchi 2013-07-05 20:34:04 UTC
*** Bug 703232 has been marked as a duplicate of this bug. ***
Comment 6 Jonh Wendell 2013-07-08 14:11:12 UTC
Created attachment 248617 [details] [review]
proposed patch, v2

this is the first patch with the changes you proposed (to make the button default).
Comment 7 Jonh Wendell 2013-07-08 14:13:52 UTC
Created attachment 248618 [details] [review]
proposed patch

this is the second patch (I prefer to split them in 2), which covers the screenshot-dialog.[ui,c,h].

I've rewritten the .ui file using gtkgrid instead of obsolete [vh]box. also it's now a gtkwindow instead of a dialog.

I've tested both patches here in master and 3.8, worked fine.
Comment 8 Cosimo Cecchi 2013-07-08 15:41:36 UTC
Review of attachment 248617 [details] [review]:

Looks good, thanks.
Comment 9 Cosimo Cecchi 2013-07-08 15:48:34 UTC
Review of attachment 248618 [details] [review]:

Looks good to me, with these two smaller details fixed - thanks!

::: src/screenshot-dialog.h
@@ +24,3 @@
 
+typedef enum {
+  ScreenshotResponseSave,

I'd rather these being all capitals, like GtkResponseType.

::: src/screenshot-dialog.ui
@@ +2,3 @@
 <interface>
+  <!-- interface-requires gtk+ 3.8 -->
+  <object class="GtkWindow" id="toplevel">

Can you make this a GtkApplicationWindow instead?
Comment 10 Jonh Wendell 2013-07-08 15:58:13 UTC
(In reply to comment #9)
> 
> ::: src/screenshot-dialog.ui
> @@ +2,3 @@
>  <interface>
> +  <!-- interface-requires gtk+ 3.8 -->
> +  <object class="GtkWindow" id="toplevel">
> 
> Can you make this a GtkApplicationWindow instead?

hmm, I can edit the file by hand, but glade is unable to read it. (it works fine at runtime however). what do you think?
Comment 11 Cosimo Cecchi 2013-07-08 16:04:07 UTC
(In reply to comment #10)

> hmm, I can edit the file by hand, but glade is unable to read it. (it works
> fine at runtime however). what do you think?

Maybe Glade doesn't know about GtkApplicationWindow yet? If it works fine at runtime, please edit it by hand then...
Comment 12 Jonh Wendell 2013-07-08 16:59:42 UTC
thanks for the review. pushed to master and 3.8.
also filled bug 703801.
Comment 13 Jonh Wendell 2013-07-08 17:08:16 UTC
btw cosimo, do you think it's worth a 3.8.3 release?
Comment 14 Cosimo Cecchi 2013-07-08 17:55:46 UTC
Thanks John. I will probably release a 3.8.3 later this week.