[PATCH weston] shell: When rotating use the parent if available

Derek Foreman derekf at osg.samsung.com
Fri Sep 11 12:18:13 PDT 2015


On 03/09/15 03:26 PM, Bryce Harrington wrote:
> On Wed, Sep 02, 2015 at 11:32:05AM -0500, Derek Foreman wrote:
>> This prevents the rotation mouse bind from rotating pop-up menus
>> directly by using a shell surface's eldest parent instead.
>>
>> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
>> ---
>>  desktop-shell/shell.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
>> index 034d39b..b080339 100644
>> --- a/desktop-shell/shell.c
>> +++ b/desktop-shell/shell.c
>> @@ -4993,6 +4993,12 @@ surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer)
>>  	float dx, dy;
>>  	float r;
>>  
>> +	/* We don't want to rotate pop-ups, so let's always start
>> +	 * rotations with a parent surface.
>> +	 */
>> +	while (surface->parent)
>> +		surface = get_shell_surface(surface->parent);
>> +
> 
> get_shell_surface() can return NULL, so best check for that too.

Sure, I didn't because I didn't think it would be possible for the
parent not to have a shell surface.

I'll add the check.

> I'm also curious if this is the right behavior, although I'll admit
> fairly broad ignorance of shell.c internals.  But if the window is just
> a popup, wouldn't we only need to operate on the immediate parent one
> level up?  Also, couldn't there be surfaces that have parents that
> aren't pop-ups?

Well, pop-ups nest.

I think what we want is to find a top level surface that has no parent.
 These are the kinds of surfaces that meta-tab cycles through.

If no such surface can be found, probably best to just use whatever
surface was provided (if we just bail a grab won't happen, and something
unexpected could happen instead...)

v2 to follow.

> Bryce
> 
>>  	rotate = malloc(sizeof *rotate);
>>  	if (!rotate)
>>  		return;
>> -- 
>> 2.5.1
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 



More information about the wayland-devel mailing list