Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Add support for xwayland_minimize actions #2264

Closed
wants to merge 1 commit into from

Conversation

damianatorrpm
Copy link

@damianatorrpm damianatorrpm commented Jun 7, 2020

as required by chrome/steam csd or games:
Fixes #2251
In the PR there is also a fix for a forgotten break statement
Minimize functionality tested with wayfire


if (xsurface == NULL) {
return;
} else if (detail == ICCCM_ICONIC_STATE) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the relationship between ICCCM_ICONIC_STATE and NET_WM_STATE_HIDDEN?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a window is minimized it's both the NET_WM_STATE is hidden the WM_STATE is iconic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, so why do we need to handle ICCCM_ICONIC_STATE changes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the way minimize is being set - through WM_STATE which is iconic state - i3 does the same, net_wm_state_hidden mean window is not visible, iconic state means minimized, see here: https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what your above statement means code-wise,
or does it just mean 'resolved'.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two code-paths in this PR:

  • Client wants to become minimized. It sends NET_WM_STATE_HIDDEN, and if I understand correctly, it can alternatively send ICCCM_ICONIC_STATE. In this case, wlroots should (1) not minimize the window and (2) emit a request_minimize event. (1) is important because we need to let the compositor handle the request. Maybe the compositor can't minimize windows. Maybe the compositor wants to do something else when a client requests to be minimized. The compositor must stay in control. wlroots shouldn't do anything behind the compositor's back.
  • A compositor decides to minimize a window. This can be in response to a request_minimize event, or this can be because of something else (e.g. the user clicked "minimize" in a compositor menubar). The compositor will call wlr_xwayland_surface_set_minimized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damianatorrpm this discussion needs to be resolved - this is the main blocker for this patch.

wlroots isn't a window manager in its own right, its a toolkit for window managers. We just help information flow smoothly from client to compositor implementation, and the compositor implementation calls the shots. So, instead of having wlroots' Xwayland layer handle the minimize request, we need to add a new event which the compositor can register for, which is emitted when the window requests to be minimized. Then, the compositor can decide what to do - for example, calling wlr_xwayland_surface_set_minimized themselves.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been changed, see the updated PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been resolved, see updated PR

xwayland/xwm.c Outdated Show resolved Hide resolved
xwayland/xwm.c Outdated Show resolved Hide resolved
@emersion
Copy link
Member

emersion commented Jun 7, 2020

Thanks for your PR!

Please make sure tabs are used for indentation. Some lines use spaces in this patch.

@damianatorrpm
Copy link
Author

I think all is resolved

xwayland/xwm.c Outdated Show resolved Hide resolved
xwayland/xwm.c Outdated Show resolved Hide resolved
xwayland/xwm.c Outdated Show resolved Hide resolved
@damianatorrpm
Copy link
Author

damianatorrpm commented Jun 8, 2020

Strange how do I remove the whitespace than, I edit using gedit and it's set to tabs and show the "trailing whitespace" as tabs

@fluix-dev
Copy link

It is a tab, it's just extra after the end of the line. For example, you have code:

...minimized != minimized;	

After the ; is a (Tab - Github doesn't seem to like rendering this) so probably just move your cursor after it and hit backspace.

@emersion
Copy link
Member

emersion commented Jun 8, 2020

Yup. To be more explicit:

const bool change = surface->minimized != minimized;	← this is a tab

@damianatorrpm
Copy link
Author

damianatorrpm commented Jun 8, 2020

@TheAvidDev @emersion ah, now I see it, of course trailing like in a trailer...
thanks

@damianatorrpm
Copy link
Author

i3/i3@136b3e3
see also i3 handling

xwayland/xwm.c Outdated Show resolved Hide resolved
@@ -1164,6 +1176,12 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,

wlr_signal_emit_safe(&xsurface->events.request_maximize, xsurface);
}

if (minimized != xsurface->minimized) {
xsurface->saved_width = xsurface->width;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only do this if the surface is minimized.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please be more specific in your comments.
Do what emit signals? Safe size?
The handling is exactly the same as for maximized in this function.

I suppose the below is what you think is right so I changed it to that:
if (minimized && minimized != xsurface->minimized) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we want to emit the signal even if the client requests to not be minimized.

Please have a look at the similar block of code above for maximized. We only set saved_width and saved_height if the surface becomes maximized. We should do the same here, only update the saved size if the surface wants to become minimized.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is wrong, maybe you suggest a proper way?
Github has the ability to suggest changes.

It is handled the way fullscreen is.

@@ -1215,6 +1233,19 @@ static void xwm_handle_client_message(struct wlr_xwm *xwm,
xwm_handle_wm_protocols_message(xwm, ev);
} else if (ev->type == xwm->atoms[NET_ACTIVE_WINDOW]) {
xwm_handle_net_active_window_message(xwm, ev);
} else if (ev->type == xwm->atoms[WM_CHANGE_STATE]) {
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract all of this into a xwm_handle_wm_change_state_message function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into this?

xwayland/xwm.c Outdated Show resolved Hide resolved
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@damianatorrpm
Copy link
Author

Bump.

@emersion
Copy link
Member

emersion commented Jun 15, 2020

Please bump every week. We don't have enough time to reply to 2-day bumps for patches that aren't critical bugfixes.

@damianatorrpm
Copy link
Author

It's a bug fix see description.

@emersion
Copy link
Member

No, it's a new feature.

@damianatorrpm
Copy link
Author

Cool stuff. Once you replied to the in-conversations let me know.

@ddevault
Copy link
Contributor

ddevault commented Jul 4, 2020

@damianatorrpm you need to be more polite to the people kind enough to review your patch. There are multiple open problems in the discussion that you need to address; bumping the thread before then is not helpful.

Also, general review comment: when you have everything squared away, please rebase these commits into a single commit.

as required by chrome/steam csd or games

PR style fixes

Trailinig whitespaces and a space

2 more excess tabs

suggeste fixes

rev

suggestions

typo

type

refact

typo
@damianatorrpm
Copy link
Author

damianatorrpm commented Jul 8, 2020

@damianatorrpm you need to be more polite to the people kind enough to review your patch. There are multiple open problems in the discussion that you need to address; bumping the thread before then is not helpful.

Also, general review comment: when you have everything squared away, please rebase these commits into a single commit.

@ddevault
These bumps included the request to answer a follow up question which had not been answered,
I was asked via IRC by to bump every week.

The commits are in a single commit.

When contributors send pull request, reviewers should have the tactfulness to read related and linked documentation, to have an understanding technically what it is about, instead of arguing on documented properties, which shows a 'less than interested' attitude. I suggest and hope we move forward any misunderstanding.

@damianatorrpm this discussion needs to be resolved - this is the main blocker for this patch.

All things mentioned have been addressed to the best of my knowledge and the discussions 'resolved'.

@ddevault
Copy link
Contributor

ddevault commented Jul 8, 2020

You have a bad attitude, and it's not worth further damaging our reviewer's mental health to deal with you. It is not us that lack tact in this exchange.

@ddevault ddevault closed this Jul 8, 2020
@swaywm swaywm locked and limited conversation to collaborators Jul 8, 2020
@ddevault
Copy link
Contributor

ddevault commented Jul 8, 2020

If someone else wants to adopt this work and bring it to us with a better attitude, we'd be interested in reviewing it again later.

@damianatorrpm damianatorrpm deleted the xwayland-minimize branch January 16, 2021 14:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

xwayland request_minimize signal
5 participants