Bug 126840 - [GTK] Make MiniBrowser windows non-transient by default
Summary: [GTK] Make MiniBrowser windows non-transient by default
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-12 04:34 PST by Adrian Perez
Modified: 2014-01-13 00:08 PST (History)
4 users (show)

See Also:


Attachments
Patch (2.84 KB, patch)
2014-01-12 04:36 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (2.75 KB, patch)
2014-01-12 04:50 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (2.67 KB, patch)
2014-01-12 05:07 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (3.14 KB, patch)
2014-01-12 08:29 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (3.25 KB, patch)
2014-01-12 11:24 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (2.89 KB, patch)
2014-01-12 12:04 PST, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2014-01-12 04:34:48 PST
Instead of making new browser windows transient as soon as they are
created, do ir later when handling the "run-as-modal" signal. This
makes it easier to use the MiniBrowser to do tests involving multiple
windows, and will be useful as well when multi-web-process mode is
enabled for the GTK port.
Comment 1 Adrian Perez 2014-01-12 04:36:43 PST
Created attachment 220965 [details]
Patch
Comment 2 WebKit Commit Bot 2014-01-12 04:38:48 PST
Attachment 220965 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/MiniBrowser/gtk/BrowserWindow.c', '--commit-queue']" exit_code: 1
ERROR: Tools/MiniBrowser/gtk/BrowserWindow.c:273:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Tools/MiniBrowser/gtk/BrowserWindow.c:274:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Tools/MiniBrowser/gtk/BrowserWindow.c:706:  Declaration has space between * and variable name in GtkWidget* window  [whitespace/declaration] [3]
ERROR: Tools/MiniBrowser/gtk/BrowserWindow.c:707:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Total errors found: 4 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Adrian Perez 2014-01-12 04:50:23 PST
Created attachment 220969 [details]
Patch
Comment 4 WebKit Commit Bot 2014-01-12 04:52:21 PST
Attachment 220969 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/MiniBrowser/gtk/BrowserWindow.c', '--commit-queue']" exit_code: 1
ERROR: Tools/MiniBrowser/gtk/BrowserWindow.c:706:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Adrian Perez 2014-01-12 05:07:30 PST
Created attachment 220970 [details]
Patch
Comment 6 Carlos Garcia Campos 2014-01-12 05:24:13 PST
Comment on attachment 220970 [details]
Patch

I think we can simply make the browser windows independent to each other. If you open two windows, then close the parent, and run-as-modal is emitted on the child window, it will crash because the parent window has already been destroyed.
Comment 7 Adrian Perez 2014-01-12 08:27:22 PST
(In reply to comment #6)
> (From update of attachment 220970 [details])
> I think we can simply make the browser windows independent to each other. If you open two windows, then close the parent, and run-as-modal is emitted on the child window, it will crash because the parent window has already been destroyed.

Good point, though I think it is more correct to connect to the "destroy"
signal of the parent window, and clear the pointer to it in the child
window. This way closing parent windows before run-as-modal is emitted
will not cause a crash, and the transient-for property is still set when
parent windows do exist.
Comment 8 Adrian Perez 2014-01-12 08:29:49 PST
Created attachment 220973 [details]
Patch
Comment 9 Carlos Garcia Campos 2014-01-12 09:12:48 PST
Comment on attachment 220973 [details]
Patch

I still think we could just make windows independent to each other, but if we really want to keep the parent window, I think it would be simpler to keep the pointer to the parent window in the BroserWindow struct and use g_object_add_weak_pointer to make sure the parent pointer is NULL when the parent is destroyed.
Comment 10 Adrian Perez 2014-01-12 11:23:47 PST
(In reply to comment #9)
> (From update of attachment 220973 [details])
> I still think we could just make windows independent to each other, but if we really want to keep the parent window, I think it would be simpler to keep the pointer to the parent window in the BroserWindow struct and use g_object_add_weak_pointer to make sure the parent pointer is NULL when the parent is destroyed.

IMHO it is more correct to try to make the windows set the transient-for
when they are meant to be modal. Not that it will matter much for the
MiniBrowser, but provided that the fix is easy, I am making the change
you suggested to use  g_object_add_weak_pointer() and re-upload.
Comment 11 Adrian Perez 2014-01-12 11:24:24 PST
Created attachment 220979 [details]
Patch
Comment 12 Carlos Garcia Campos 2014-01-12 11:39:37 PST
Comment on attachment 220979 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=220979&action=review

> Tools/MiniBrowser/gtk/BrowserWindow.c:704
> +static void parentWindowDestroy(GtkWidget *parent_window, gpointer window)
> +{
> +    if (window)
> +        g_object_set_data(G_OBJECT(window), "transient-for", NULL);
> +}

You forgot to remove this.
Comment 13 Adrian Perez 2014-01-12 12:04:14 PST
Created attachment 220980 [details]
Patch
Comment 14 Adrian Perez 2014-01-12 12:05:15 PST
(In reply to comment #12)
> (From update of attachment 220979 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=220979&action=review
> 
> > Tools/MiniBrowser/gtk/BrowserWindow.c:704
> > +static void parentWindowDestroy(GtkWidget *parent_window, gpointer window)
> > +{
> > +    if (window)
> > +        g_object_set_data(G_OBJECT(window), "transient-for", NULL);
> > +}
> 
> You forgot to remove this.

Certainly, good catch. I have already re-uploaded with this cleaned.
Comment 15 WebKit Commit Bot 2014-01-13 00:08:35 PST
Comment on attachment 220980 [details]
Patch

Clearing flags on attachment: 220980

Committed r161864: <http://trac.webkit.org/changeset/161864>
Comment 16 WebKit Commit Bot 2014-01-13 00:08:39 PST
All reviewed patches have been landed.  Closing bug.