[PATCH weston 3/6] xwm: use override_redirect for determining or not top-level windows

Tiago Vignatti tiago.vignatti at linux.intel.com
Tue Jun 5 09:15:32 PDT 2012


On 06/05/2012 07:13 PM, Kristian Høgsberg wrote:
> On Mon, Jun 04, 2012 at 08:01:45PM +0300, Tiago Vignatti wrote:
>> "top-level window is a window whose override-redirect attribute is False",
>> ICCCM 4.1.1
>>
>> Signed-off-by: Tiago Vignatti<tiago.vignatti at intel.com>
>> ---
>>   src/xwayland/window-manager.c |   14 +++++++++-----
>>   1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
>> index baa49e2..b5d39d3 100644
>> --- a/src/xwayland/window-manager.c
>> +++ b/src/xwayland/window-manager.c
>> @@ -109,6 +109,7 @@ struct weston_wm_window {
>>   	int width, height;
>>   	int x, y;
>>   	int decorate;
>> +	int override_redirect;
>>   };
>>
>>   static struct weston_wm_window *
>> @@ -692,7 +693,7 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
>>
>>   static void
>>   weston_wm_window_create(struct weston_wm *wm,
>> -			xcb_window_t id, int width, int height)
>> +			xcb_window_t id, int width, int height, int override)
>>   {
>>   	struct weston_wm_window *window;
>>   	uint32_t values[1];
>> @@ -710,7 +711,7 @@ weston_wm_window_create(struct weston_wm *wm,
>>   	window->wm = wm;
>>   	window->id = id;
>>   	window->properties_dirty = 1;
>> -
>> +	window->override_redirect = override;
>>   	window->width = width;
>>   	window->height = height;
>>
>> @@ -741,7 +742,8 @@ weston_wm_handle_create_notify(struct weston_wm *wm, xcb_generic_event_t *event)
>>   		return;
>>
>>   	weston_wm_window_create(wm, create_notify->window,
>> -				create_notify->width, create_notify->height);
>> +				create_notify->width, create_notify->height,
>> +				create_notify->override_redirect);
>>   }
>>
>>   static void
>> @@ -777,7 +779,8 @@ weston_wm_handle_reparent_notify(struct weston_wm *wm, xcb_generic_event_t *even
>>   		reparent_notify->event);
>>
>>   	if (reparent_notify->parent == wm->screen->root) {
>> -		weston_wm_window_create(wm, reparent_notify->window, 10, 10);
>> +		weston_wm_window_create(wm, reparent_notify->window, 10, 10,
>> +					reparent_notify->override_redirect);
>>   	} else if (!our_resource(wm, reparent_notify->parent)) {
>>   		window = hash_table_lookup(wm->window_hash,
>>   					   reparent_notify->window);
>> @@ -1322,7 +1325,8 @@ xserver_map_shell_surface(struct weston_wm *wm,
>>   						      window->surface,
>>   						&shell_client);
>>
>> -	if (!window->transient_for) {
>> +	/* ICCCM 4.1.1 */
>> +	if (!window->override_redirect) {
>>   		shell_interface->set_toplevel(window->shsurf);
>>   		return;
>>   	}
>
> When I get here with an override_redirect window that's not transient
> for another window, I crash when just below we try:
>
>          parent = hash_table_lookup(wm->window_hash, window->transient_for->id);

yes, expected. And that's fixed with the 6/6.

    Tiago



More information about the wayland-devel mailing list