Skip to content
Permalink
Browse files

window: add _NET_WM_STATE_FOCUSED hint to _NET_WM_STATE

  • Loading branch information...
monsta authored and raveit65 committed Feb 21, 2018
1 parent 70d82d3 commit 42410fe72d0ed2c654631e1755526482a80f4fca
Showing with 19 additions and 5 deletions.
  1. +1 −0 src/core/atomnames.h
  2. +18 −5 src/core/window.c
@@ -158,6 +158,7 @@ item(_NET_WM_ACTION_ABOVE)
item(_NET_WM_ACTION_BELOW)
item(_NET_WM_STATE_STICKY)
item(_NET_WM_FULLSCREEN_MONITORS)
item(_NET_WM_STATE_FOCUSED)

#if 0
/* We apparently never use: */
@@ -1259,7 +1259,7 @@ static void
set_net_wm_state (MetaWindow *window)
{
int i;
unsigned long data[12];
unsigned long data[13];

i = 0;
if (window->shaded)
@@ -1322,6 +1322,11 @@ set_net_wm_state (MetaWindow *window)
data[i] = window->display->atom__NET_WM_STATE_STICKY;
++i;
}
if (window->has_focus)
{
data[i] = window->display->atom__NET_WM_STATE_FOCUSED;
++i;
}

meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);

@@ -5490,6 +5495,15 @@ meta_window_client_message (MetaWindow *window,
return FALSE;
}

static void
meta_window_appears_focused_changed (MetaWindow *window)
{
set_net_wm_state (window);

if (window->frame)
meta_frame_queue_draw (window->frame);
}

gboolean
meta_window_notify_focus (MetaWindow *window,
XEvent *event)
@@ -5599,8 +5613,7 @@ meta_window_notify_focus (MetaWindow *window,
window);
}

if (window->frame)
meta_frame_queue_draw (window->frame);
meta_window_appears_focused_changed (window);

meta_error_trap_push (window->display);
XInstallColormap (window->display->xdisplay,
@@ -5652,8 +5665,8 @@ meta_window_notify_focus (MetaWindow *window,

window->display->focus_window = NULL;
window->has_focus = FALSE;
if (window->frame)
meta_frame_queue_draw (window->frame);

meta_window_appears_focused_changed (window);

meta_compositor_set_active_window (window->display->compositor,
window->screen, NULL);

14 comments on commit 42410fe

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Mar 13, 2018

@monsta
Can you please test Menta themes from this branch https://github.com/mate-desktop/mate-themes/commits/menta-backdrop ?
I like to know if using the backdrop state is OK in general or maybe it is to overload and i have to reduce some settings.

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Aug 12, 2018

@monsta
Hi, is it possible to add a gsettings key for this new feature?
I am pretty sure we have users who don't like this.
And i want to start with changing themes for backdrop state.
.....this affects not only headerbars from report ;)
So giving an user a chance to disable it would be really great.

Thank you

@monsta

This comment has been minimized.

Copy link
Member Author

monsta replied Aug 12, 2018

Yes, but it looks like this new feature created more problems than it solved... so maybe we should just revert it for 1.22.

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Aug 12, 2018

Which "more problems"?

@lukefromdc

This comment has been minimized.

Copy link
Member

lukefromdc replied Aug 13, 2018

By "more problems" do we mean theme issues or bugs?

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Aug 13, 2018

Currently, we have a few reports by people who missed that feature.
I didn't noticed any report against this feature.
But every very little change which we did to help users can cause a report against it by another user.
And using backdrop state isn't a little change.
An example not related to this feature.
mate-desktop/mate-themes#232
For this reason i asked for a gsettings key to disable backdrop state.
For me the missing key and that i can't add it for myself and i have to ask other busy developers is the only issue ;)
Sorry, that i asked you.

Btw. the backdrop state is the only solution to sign a csd-window that it is in background.

@monsta

This comment has been minimized.

Copy link
Member Author

monsta replied Aug 13, 2018

I can't remember how many reports were about this feature... today I only found this one: mate-desktop/mate-panel#749.

Ok, I'll check how to add a new setting to Marco (seems like src/core/prefs.c needs some changes).

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Sep 19, 2018

Another report about missing backdrop state from firefox maintainer.
#427
@monsta
Can you please check if it is possible to add a gsettings key for that feature?
It's OK If you aren't able to do this, but please don't let me wait for this.
Adding backdrop state to themes is a huge job and i can't do that from one day to another.
Thank you

@lukefromdc

This comment has been minimized.

Copy link
Member

lukefromdc replied Sep 19, 2018

What I did in UbuntuStudio_Legacy was to only set a :backdrop theming different from the default theming for CSD window decorations and absolutely nothing else. That works, and makes CSD apps behave similiarly to traditional SSD apps so far as focus/backdrop appearance is concerned.

gedit_backdrop-and-focus

While two empty gedit windows don't have a lot to theme, this does show the basics: same view colors, same backgrounds, etc, only the window decorations need to use :backdrop and set a different appearance.

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Sep 19, 2018

I know, but i like to style more widgets than the headerbar for Menta themes, similar what adwaita does.

@monsta

This comment has been minimized.

Copy link
Member Author

monsta replied Sep 20, 2018

Sorry, didn't have the time to work on this. Maybe I'll try this weekend. But if someone else can do it faster, I don't mind 🙂

@lukefromdc

This comment has been minimized.

Copy link
Member

lukefromdc replied Sep 21, 2018

Here's Nautilus with BlackMATE, one window focused and one in backdrop. CSD code taken from UbuntuStudio_Legacy, mostly csd decorations and shadows are different(checked the code for instances of :backdrop). In most places the basic selector and same selector with :backdrop are simply listed together to keep them the same. Also note that :backdrop had to be used in BlackMATE and UbuntuStudio_Legacy to hide the carot in a non-selected view at one point, not sure if that is still the case though.

nautilus_blackmate

@raveit65

This comment has been minimized.

Copy link
Member

raveit65 replied Sep 21, 2018

Thank you , feel free to add what ever setting you want to BlackMate theme as maintainer of it ;).
I did already a more extended setting to Menta themes since several months, see menta-backdrop branch.

@lukefromdc

This comment has been minimized.

Copy link
Member

lukefromdc replied Sep 21, 2018

This work was important in BlackMATE and UbuntuStudio_Legacy(source of the code used) as I use it with
https://gitlab.com/lukefromdc/compiz/tree/dev-focus_WIP which is my branch of compiz-reloaded that supports _NET_WM_STATE_FOCUSED . It contains work by myself, @soreau, and @muktupavels to enable CSD focus and backdrop states. I use that branch as my daily window manager and it works well.

Please sign in to comment.
You can’t perform that action at this time.