Re: [PATCH 1/2] shell: Add implementation of fullscreen.

2012-03-02 Thread Ander Conselvan de Oliveira

Em 01-03-2012 06:57, zhiwen...@linux.intel.com escreveu:

From: Alex Wu
@@ -1290,14 +1426,23 @@ activate(struct weston_shell *base, struct 
weston_surface *es,

  static void
  click_to_activate_binding(struct wl_input_device *device,
- uint32_t time, uint32_t key,
+ uint32_t time, uint32_t key,
  uint32_t button, uint32_t state, void *data)
  {
struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *compositor = data;
struct weston_surface *focus;
+   struct weston_surface *upper;

focus = (struct weston_surface *) device->pointer_focus;
+   upper = container_of(focus->link.prev, struct weston_surface, link);
+   if (focus->link.prev !=&compositor->surface_list&&
+   get_shell_surface_type(upper) == SHELL_SURFACE_FULLSCREEN) {
+   printf("%s: focus is black surface, raise its fullscreen 
surface\n", __func__);
+   shell_stack_fullscreen(get_shell_surface(upper));
+   focus = upper;
+   }
+
if (state&&  focus&&  device->pointer_grab 
==&device->default_pointer_grab)
activate(compositor->shell, focus, wd, time);
  }


focus can be NULL here in which case this leads to a segmentation fault. 
You can cause it very easily by running a toytoolkit application, 
launching the popup menu and then clicking on a surface that does not 
belong to the client that create the popup surface.



Ander
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] shell: Add implementation of fullscreen.

2012-03-01 Thread Scott Moreau
> I will fix it in next version.
>
>
>
This version has already been pushed, so you probably just want to submit a
patch to fix the issue on top of master.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


RE: [PATCH 1/2] shell: Add implementation of fullscreen.

2012-03-01 Thread wuzhiwen
Hi,

Thanks for your comments. You are right, this is a bug.

The following code is meant to restore the initial position of a toplevel
surface when it switch from a non-toplevel to toplevel.
The problem is that   (prev_surface_type != SHELL_SURFACE_TOPLEVEL) can not
drop the buffer size changing case in which no surface type switched and the
prev_surface_type is SHELL_SURFACE_NONE.
I will fix it in next version.

 

 

From: Scott Moreau [mailto:ore...@gmail.com] 
Sent: Friday, March 02, 2012 2:41 PM
To: zhiwen...@linux.intel.com
Cc: wayland-devel@lists.freedesktop.org; k...@bitplanet.net;
juan.j.z...@linux.intel.com; ppaala...@gmail.com
Subject: Re: [PATCH 1/2] shell: Add implementation of fullscreen.

 

Hi. This patch introduces a bug where the window jumps all over the place
when resizing it. I've tracked down the problem to the following code though
I'm not sure I understand what it's meant to do yet exactly, so I figured
I'd post a comment here.



+   case SHELL_SURFACE_TOPLEVEL:
+   if (prev_surface_type != SHELL_SURFACE_TOPLEVEL) {
+   if (shsurf->saved_position_valid &&
+   shsurf->saved_x != surface->geometry.x &&
+   shsurf->saved_y != surface->geometry.y) {
+   weston_surface_set_position(surface,
+   shsurf->saved_x,
+
shsurf->saved_y);
+   } else if (!shsurf->saved_position_valid) {
+   weston_surface_set_position(surface, 10 +
random() % 400,
+   10 + random() %
400);
+   }
+   }
+   break;




Thanks,

Scott

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] shell: Add implementation of fullscreen.

2012-03-01 Thread Scott Moreau
Specifically, this questionable call

+   } else if (!shsurf->saved_position_valid) {
>> +   weston_surface_set_position(surface, 10 +
>> random() % 400,
>> +   10 + random()
>> % 400);
>> +   }
>>
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] shell: Add implementation of fullscreen.

2012-03-01 Thread Scott Moreau
Hi. This patch introduces a bug where the window jumps all over the place
when resizing it. I've tracked down the problem to the following code
though I'm not sure I understand what it's meant to do yet exactly, so I
figured I'd post a comment here.


+   case SHELL_SURFACE_TOPLEVEL:
> +   if (prev_surface_type != SHELL_SURFACE_TOPLEVEL) {
> +   if (shsurf->saved_position_valid &&
> +   shsurf->saved_x != surface->geometry.x &&
> +   shsurf->saved_y != surface->geometry.y) {
> +   weston_surface_set_position(surface,
> +
> shsurf->saved_x,
> +
> shsurf->saved_y);
> +   } else if (!shsurf->saved_position_valid) {
> +   weston_surface_set_position(surface, 10 +
> random() % 400,
> +   10 + random()
> % 400);
> +   }
> +   }
> +   break;
>



Thanks,

Scott
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel