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 597052 - Add signal to MetaDisplay so we know when a window has demanded-attention
Add signal to MetaDisplay so we know when a window has demanded-attention
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2009-10-01 21:38 UTC by Jon Nettleton
Modified: 2009-11-17 10:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a DEMANDS_ATTENTION_WINDOW signal to MetaDisplay (3.23 KB, patch)
2009-10-01 21:38 UTC, Jon Nettleton
needs-work Details | Review
Updated patch with suggested changes. (4.34 KB, patch)
2009-10-04 19:40 UTC, Jon Nettleton
needs-work Details | Review
Hopefully the final patch (4.06 KB, patch)
2009-10-05 14:18 UTC, Jon Nettleton
needs-work Details | Review
Revised patch (2.75 KB, patch)
2009-10-28 17:31 UTC, Tomas Frydrych
committed Details | Review

Description Jon Nettleton 2009-10-01 21:38:01 UTC
Created attachment 144547 [details] [review]
Add a DEMANDS_ATTENTION_WINDOW signal to MetaDisplay

Pretty much what the summary says.
Comment 1 Owen Taylor 2009-10-02 20:38:31 UTC
Review of attachment 144547 [details] [review]:

Your commit message should be in the form:

 Subject
 <blank line>
 Body

> This will give us a central notification so we know when to loop through windows to find one demanding attention

Better to make the signal take the window as an argument.

::: src/core/display.c
@@ +130,3 @@
   OVERLAY_KEY,
   FOCUS_WINDOW,
+  DEMANDS_ATTENTION_WINDOW,

I guess this is in analogy to focus-window, but it still doesn't really read right for a signal name (focus-window is a bit dubious itself)

I think I'd call it 'window-demands-attention'

::: src/core/window.c
@@ +2689,3 @@
         g_object_notify (G_OBJECT (window), "demands-attention");
         g_object_thaw_notify(G_OBJECT (window));
+        meta_display_window_demands_attention(window->display);

I think once you have these three different things that you are doing, then this should be encapsulated into a function. I'd add a static mark_demands_attention() or something like that.
Comment 2 Jon Nettleton 2009-10-04 19:40:04 UTC
Created attachment 144733 [details] [review]
Updated patch with suggested changes.
Comment 3 Owen Taylor 2009-10-04 20:30:06 UTC
Review of attachment 144733 [details] [review]:

Closer. Commit message still needs fixing to have separate subject line and body.

::: src/core/display.c
@@ +234,3 @@
+                  0,
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,

this needs to be VOID_OBJECT since you have single object-valued parameter

::: src/core/window.c
@@ +3528,3 @@
+{
+  g_object_notify (G_OBJECT (window), "demands-attention");
+  meta_display_window_demands_attention(window->display, window);

Missing space after function name

@@ +8821,3 @@
   set_net_wm_state (window);
 
+  signal_demands_attention (window); 

but you don't want to emit window-demands-attention if you are unsetting the demands attention hint, right?

If you make it mark_demands_attention(), then you can do:

 if (demands_attention)
   meta_display_window_demands_attention (...)
Comment 4 Jon Nettleton 2009-10-05 14:18:40 UTC
Created attachment 144794 [details] [review]
Hopefully the final patch
Comment 5 Owen Taylor 2009-10-05 20:56:40 UTC
Comment on attachment 144794 [details] [review]
Hopefully the final patch

I was suggesting that mark_demands_attention() would take a boolean parameter and actually take care of setting window->wm_state_demands_attention. With this latest patch, you seem to have lost notification on ::demands-attention when unsetting the property.

I think I wasn't clear about subject vs. body in the commit message. Git commit are stored as freeform text, but they aren't really freeform. They have a structure they need to follow or the tools don't work right.

The structure is:

 A subject line
 < blank line>
 Explanatory body
Comment 6 Tomas Frydrych 2009-10-28 16:24:23 UTC
It would be good to get such a signal in, but I just noticed the patch is not against the gnome repo, but against Jon's github repo, as we do not have a boolean MetaWindow::demands-attention property. I uploaded an updated patch for this to bug 588065.
Comment 7 Tomas Frydrych 2009-10-28 17:31:21 UTC
Created attachment 146439 [details] [review]
Revised patch

I am attaching a reworked patch that applies on the top of the one for MetaWindow::demands-attention property that I attached to bug 588065; I have done away with the static function (it seems to just obscure the code; there are three occasions when the signal needs to be emitted, and they all slightly different); I also opted to emit the signal by name instead of adding and api point for this to MetaDisplay. See what you think :)
Comment 8 Owen Taylor 2009-11-10 16:04:59 UTC
Review of attachment 146439 [details] [review]:

Looks good
Comment 9 Tomas Frydrych 2009-11-17 10:09:15 UTC
Comment on attachment 146439 [details] [review]
Revised patch

Committed as 7579b691dfb7ce4f9e86325210de00dbdbd295eb.