E (wl_shell): Update code to handle changes in wayland git. Comment

out unused functions (for now).



SVN revision: 70447
This commit is contained in:
Christopher Michael 2012-04-24 17:31:07 +00:00
parent 7ffbf6ef25
commit 6b2144911a
3 changed files with 376 additions and 442 deletions

View File

@ -21,9 +21,7 @@ pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
pkg_LTLIBRARIES = module.la pkg_LTLIBRARIES = module.la
module_la_SOURCES = e_mod_main.c \ module_la_SOURCES = e_mod_main.c \
e_mod_main.h \ e_mod_main.h
e_desktop_shell_protocol.c \
e_desktop_shell_protocol.h
module_la_LIBADD = @e_wl_libs@ @dlopen_libs@ @WAYLAND_SHELL_LIBS@ module_la_LIBADD = @e_wl_libs@ @dlopen_libs@ @WAYLAND_SHELL_LIBS@
module_la_LDFLAGS = -module -avoid-version module_la_LDFLAGS = -module -avoid-version

View File

@ -4,23 +4,24 @@
/* local function prototypes */ /* local function prototypes */
static void _shell_cb_lock(E_Shell *base); static void _shell_cb_lock(E_Shell *base);
static void _shell_cb_unlock(E_Shell *base); static void _shell_cb_unlock(E_Shell *base);
static void _shell_cb_map(E_Shell *base, E_Surface *surface, int w, int h, int sx, int sy); /* static void _shell_cb_map(E_Shell *base, E_Surface *surface, int w, int h, int sx, int sy); */
static void _shell_cb_configure(E_Shell *base, E_Surface *surface, GLfloat x, GLfloat y, int w, int h); /* static void _shell_cb_configure(E_Shell *base, E_Surface *surface, GLfloat x, GLfloat y, int w, int h); */
static void _shell_cb_destroy(E_Shell *base); static void _shell_cb_destroy(E_Shell *base);
static void _shell_cb_destroy_shell_surface(struct wl_resource *resource); static void _shell_cb_destroy_shell_surface(struct wl_resource *resource);
static void _shell_cb_bind(struct wl_client *client, void *data, unsigned int version __UNUSED__, unsigned int id); static void _shell_cb_bind(struct wl_client *client, void *data, unsigned int version __UNUSED__, unsigned int id);
static void _shell_cb_bind_desktop(struct wl_client *client, void *data, unsigned int version __UNUSED__, unsigned int id); static void _shell_cb_bind_desktop(struct wl_client *client, void *data, unsigned int version __UNUSED__, unsigned int id);
static void _shell_cb_unbind_desktop(struct wl_resource *resource); static void _shell_cb_unbind_desktop(struct wl_resource *resource);
static void _shell_cb_get_shell_surface(struct wl_client *client, struct wl_resource *resource, unsigned int id, struct wl_resource *surface_resource); static void _shell_cb_get_shell_surface(struct wl_client *client, struct wl_resource *resource, unsigned int id, struct wl_resource *surface_resource);
static void _shell_cb_handle_surface_destroy(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, unsigned int timestamp); static void _shell_cb_handle_surface_destroy(struct wl_listener *listener, void *data __UNUSED__);
static void _shell_cb_handle_lock_surface_destroy(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, unsigned int timestamp __UNUSED__); static void _shell_cb_handle_lock_surface_destroy(struct wl_listener *listener, void *data __UNUSED__);
static void _shell_cb_activate(E_Shell *base, E_Surface *es, E_Input_Device *eid, unsigned int timestamp); /* static void _shell_cb_activate(E_Shell *base, E_Surface *es, E_Input_Device *eid, unsigned int timestamp); */
static void _shell_cb_desktop_set_background(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource); static void _shell_cb_desktop_set_background(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource);
static void _shell_cb_desktop_set_panel(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource); static void _shell_cb_desktop_set_panel(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource);
static void _shell_cb_desktop_set_lock_surface(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *surface_resource); static void _shell_cb_desktop_set_lock_surface(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *surface_resource);
static void _shell_cb_desktop_unlock(struct wl_client *client __UNUSED__, struct wl_resource *resource); static void _shell_cb_desktop_unlock(struct wl_client *client __UNUSED__, struct wl_resource *resource);
static void _shell_cb_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial);
static void _shell_cb_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp); static void _shell_cb_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp);
static void _shell_cb_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp, unsigned int edges); static void _shell_cb_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp, unsigned int edges);
static void _shell_cb_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource); static void _shell_cb_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource);
@ -31,19 +32,19 @@ static void _shell_cb_shell_surface_set_maximized(struct wl_client *client __UNU
static E_Shell_Surface *_shell_get_shell_surface(E_Surface *es); static E_Shell_Surface *_shell_get_shell_surface(E_Surface *es);
static int _shell_reset_shell_surface_type(E_Shell_Surface *ess); static int _shell_reset_shell_surface_type(E_Shell_Surface *ess);
static void _shell_center_on_output(E_Surface *es, E_Output *output); /* static void _shell_center_on_output(E_Surface *es, E_Output *output); */
static void _shell_map_fullscreen(E_Shell_Surface *ess); /* static void _shell_map_fullscreen(E_Shell_Surface *ess); */
static void _shell_configure_fullscreen(E_Shell_Surface *ess); /* static void _shell_configure_fullscreen(E_Shell_Surface *ess); */
static void _shell_stack_fullscreen(E_Shell_Surface *ess); /* static void _shell_stack_fullscreen(E_Shell_Surface *ess); */
static void _shell_unset_fullscreen(E_Shell_Surface *ess); static void _shell_unset_fullscreen(E_Shell_Surface *ess);
static struct wl_shell *_shell_surface_get_shell(E_Shell_Surface *ess); /* static struct wl_shell *_shell_surface_get_shell(E_Shell_Surface *ess); */
static E_Surface *_shell_create_black_surface(E_Compositor *comp, GLfloat x, GLfloat y, int w, int h); /* static E_Surface *_shell_create_black_surface(E_Compositor *comp, GLfloat x, GLfloat y, int w, int h); */
static E_Shell_Surface_Type _shell_get_shell_surface_type(E_Surface *es); /* static E_Shell_Surface_Type _shell_get_shell_surface_type(E_Surface *es); */
static void _shell_map_popup(E_Shell_Surface *ess, unsigned int timestamp); /* static void _shell_map_popup(E_Shell_Surface *ess, unsigned int timestamp __UNUSED__); */
static void _shell_cb_popup_grab_focus(struct wl_pointer_grab *grab, unsigned int timestamp, struct wl_surface *surface, int x, int y); static void _shell_cb_popup_grab_focus(struct wl_pointer_grab *grab, struct wl_surface *surface, int x, int y);
static void _shell_cb_popup_grab_motion(struct wl_pointer_grab *grab, unsigned int timestamp, int sx, int sy); static void _shell_cb_popup_grab_motion(struct wl_pointer_grab *grab, unsigned int timestamp, int sx, int sy);
static void _shell_cb_popup_grab_button(struct wl_pointer_grab *grab, unsigned int timestamp, int button, int state); static void _shell_cb_popup_grab_button(struct wl_pointer_grab *grab, unsigned int timestamp, unsigned int button, int state);
/* local variables */ /* local variables */
@ -61,6 +62,7 @@ static const struct desktop_shell_interface _e_desktop_shell_interface =
}; };
static const struct wl_shell_surface_interface _e_shell_surface_interface = static const struct wl_shell_surface_interface _e_shell_surface_interface =
{ {
_shell_cb_shell_surface_pong,
_shell_cb_shell_surface_move, _shell_cb_shell_surface_move,
_shell_cb_shell_surface_resize, _shell_cb_shell_surface_resize,
_shell_cb_shell_surface_set_toplevel, _shell_cb_shell_surface_set_toplevel,
@ -73,7 +75,7 @@ static const struct wl_pointer_grab_interface _e_popup_grab_interface =
{ {
_shell_cb_popup_grab_focus, _shell_cb_popup_grab_focus,
_shell_cb_popup_grab_motion, _shell_cb_popup_grab_motion,
_shell_cb_popup_grab_button _shell_cb_popup_grab_button,
}; };
/* external variables */ /* external variables */
@ -97,8 +99,8 @@ e_modapi_init(E_Module *m)
shell->compositor = comp; shell->compositor = comp;
shell->shell.lock = _shell_cb_lock; shell->shell.lock = _shell_cb_lock;
shell->shell.unlock = _shell_cb_unlock; shell->shell.unlock = _shell_cb_unlock;
shell->shell.map = _shell_cb_map; /* shell->shell.map = _shell_cb_map; */
shell->shell.configure = _shell_cb_configure; /* shell->shell.configure = _shell_cb_configure; */
shell->shell.destroy = _shell_cb_destroy; shell->shell.destroy = _shell_cb_destroy;
wl_list_init(&shell->backgrounds); wl_list_init(&shell->backgrounds);
@ -180,8 +182,7 @@ _shell_cb_lock(E_Shell *base)
timestamp = e_compositor_get_time(); timestamp = e_compositor_get_time();
wl_list_for_each(device, &shell->compositor->inputs, link) wl_list_for_each(device, &shell->compositor->inputs, link)
wl_input_device_set_keyboard_focus(&device->input_device, NULL, wl_input_device_set_keyboard_focus(&device->input_device, NULL);
timestamp);
} }
static void static void
@ -208,175 +209,166 @@ _shell_cb_unlock(E_Shell *base)
shell->prepare_event_sent = EINA_TRUE; shell->prepare_event_sent = EINA_TRUE;
} }
static void /* static void */
_shell_cb_map(E_Shell *base, E_Surface *surface, int w, int h, int sx, int sy) /* _shell_cb_map(E_Shell *base, E_Surface *surface, int w, int h, int sx, int sy) */
{ /* { */
struct wl_shell *shell; /* struct wl_shell *shell; */
E_Compositor *comp; /* E_Compositor *comp; */
E_Shell_Surface *ess; /* E_Shell_Surface *ess; */
E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE; /* E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE; */
E_Surface *parent; /* E_Surface *parent; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
shell = container_of(base, struct wl_shell, shell); /* shell = container_of(base, struct wl_shell, shell); */
comp = shell->compositor; /* comp = shell->compositor; */
if ((ess = _shell_get_shell_surface(surface))) /* if ((ess = _shell_get_shell_surface(surface))) */
type = ess->type; /* type = ess->type; */
surface->geometry.w = w; /* surface->geometry.w = w; */
surface->geometry.h = h; /* surface->geometry.h = h; */
surface->geometry.dirty = EINA_TRUE; /* surface->geometry.dirty = EINA_TRUE; */
/* TODO: e_comp_update_drag_surfaces */ /* switch (type) */
/* { */
/* case E_SHELL_SURFACE_TOPLEVEL: */
/* e_surface_set_position(surface, surface->geometry.x, surface->geometry.y); */
/* break; */
/* case E_SHELL_SURFACE_SCREENSAVER: */
/* _shell_center_on_output(surface, ess->fullscreen_output); */
/* break; */
/* case E_SHELL_SURFACE_FULLSCREEN: */
/* _shell_map_fullscreen(ess); */
/* break; */
/* case E_SHELL_SURFACE_MAXIMIZED: */
/* e_surface_set_position(surface, surface->output->x, surface->output->y); */
/* break; */
/* case E_SHELL_SURFACE_LOCK: */
/* _shell_center_on_output(surface, e_output_get_default(comp)); */
/* break; */
/* case E_SHELL_SURFACE_POPUP: */
/* _shell_map_popup(ess, ess->popup.timestamp); */
/* break; */
/* case E_SHELL_SURFACE_NONE: */
/* e_surface_set_position(surface, surface->geometry.x + sx, */
/* surface->geometry.y + sy); */
/* break; */
/* default: */
/* break; */
/* } */
/* initial position */ /* switch (type) */
switch (type) /* { */
{ /* case E_SHELL_SURFACE_BACKGROUND: */
case E_SHELL_SURFACE_TOPLEVEL: /* wl_list_insert(&shell->background_layer.surfaces, &surface->layers); */
e_surface_set_position(surface, surface->geometry.x, surface->geometry.y); /* break; */
break; /* case E_SHELL_SURFACE_PANEL: */
case E_SHELL_SURFACE_SCREENSAVER: /* wl_list_insert(&shell->panel_layer.surfaces, &surface->layers); */
_shell_center_on_output(surface, ess->fullscreen_output); /* break; */
break; /* case E_SHELL_SURFACE_LOCK: */
case E_SHELL_SURFACE_FULLSCREEN: /* wl_list_insert(&shell->lock_layer.surfaces, &surface->layers); */
_shell_map_fullscreen(ess); /* e_compositor_wake(comp); */
break; /* break; */
case E_SHELL_SURFACE_MAXIMIZED: /* case E_SHELL_SURFACE_SCREENSAVER: */
/* TODO: account for panel height ? */ /* if (shell->locked) */
e_surface_set_position(surface, surface->output->x, surface->output->y); /* { */
break; /* e_compositor_wake(comp); */
case E_SHELL_SURFACE_LOCK: /* if (!shell->lock_surface) */
_shell_center_on_output(surface, e_output_get_default(comp)); /* comp->state = E_COMPOSITOR_STATE_IDLE; */
break; /* } */
case E_SHELL_SURFACE_POPUP: /* break; */
_shell_map_popup(ess, ess->popup.timestamp); /* case E_SHELL_SURFACE_POPUP: */
break; /* case E_SHELL_SURFACE_TRANSIENT: */
case E_SHELL_SURFACE_NONE: /* parent = ess->parent->surface; */
e_surface_set_position(surface, surface->geometry.x + sx, /* wl_list_insert(parent->layers.prev, &surface->layers); */
surface->geometry.y + sy); /* break; */
break; /* case E_SHELL_SURFACE_FULLSCREEN: */
default: /* case E_SHELL_SURFACE_NONE: */
break; /* break; */
} /* default: */
/* wl_list_insert(&shell->toplevel_layer.surfaces, &surface->layers); */
/* break; */
/* } */
/* stacking */ /* if (type != E_SHELL_SURFACE_NONE) */
switch (type) /* { */
{ /* e_surface_assign_output(surface); */
case E_SHELL_SURFACE_BACKGROUND: /* if (type == E_SHELL_SURFACE_MAXIMIZED) */
wl_list_insert(&shell->background_layer.surfaces, &surface->layers); /* surface->output = ess->output; */
break; /* } */
case E_SHELL_SURFACE_PANEL:
wl_list_insert(&shell->panel_layer.surfaces, &surface->layers);
break;
case E_SHELL_SURFACE_LOCK:
wl_list_insert(&shell->lock_layer.surfaces, &surface->layers);
e_compositor_wake(comp);
break;
case E_SHELL_SURFACE_SCREENSAVER:
if (shell->locked)
{
/* TODO: show screensaver */
/* TODO: set idle time ? */
e_compositor_wake(comp);
if (!shell->lock_surface)
comp->state = E_COMPOSITOR_STATE_IDLE;
}
break;
case E_SHELL_SURFACE_POPUP:
case E_SHELL_SURFACE_TRANSIENT:
parent = ess->parent->surface;
wl_list_insert(parent->layers.prev, &surface->layers);
break;
case E_SHELL_SURFACE_FULLSCREEN:
case E_SHELL_SURFACE_NONE:
break;
default:
wl_list_insert(&shell->toplevel_layer.surfaces, &surface->layers);
break;
}
if (type != E_SHELL_SURFACE_NONE) /* switch (type) */
{ /* { */
e_surface_assign_output(surface); /* case E_SHELL_SURFACE_TOPLEVEL: */
if (type == E_SHELL_SURFACE_MAXIMIZED) /* case E_SHELL_SURFACE_TRANSIENT: */
surface->output = ess->output; /* case E_SHELL_SURFACE_FULLSCREEN: */
} /* case E_SHELL_SURFACE_MAXIMIZED: */
/* if (!shell->locked) */
/* _shell_cb_activate(base, surface, */
/* (E_Input_Device *)comp->input_device, */
/* e_compositor_get_time()); */
/* break; */
/* default: */
/* break; */
/* } */
switch (type) /* if (type == E_SHELL_SURFACE_TOPLEVEL) */
{ /* { */
case E_SHELL_SURFACE_TOPLEVEL: /* } */
case E_SHELL_SURFACE_TRANSIENT: /* } */
case E_SHELL_SURFACE_FULLSCREEN:
case E_SHELL_SURFACE_MAXIMIZED:
if (!shell->locked)
_shell_cb_activate(base, surface,
(E_Input_Device *)comp->input_device,
e_compositor_get_time());
break;
default:
break;
}
if (type == E_SHELL_SURFACE_TOPLEVEL) /* static void */
{ /* _shell_cb_configure(E_Shell *base, E_Surface *surface, GLfloat x, GLfloat y, int w, int h) */
/* TODO: run zoom ? */ /* { */
} /* struct wl_shell *shell; */
} /* E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE; */
/* E_Shell_Surface_Type ptype = E_SHELL_SURFACE_NONE; */
/* E_Shell_Surface *ess; */
static void /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
_shell_cb_configure(E_Shell *base, E_Surface *surface, GLfloat x, GLfloat y, int w, int h)
{
struct wl_shell *shell;
E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE;
E_Shell_Surface_Type ptype = E_SHELL_SURFACE_NONE;
E_Shell_Surface *ess;
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* shell = container_of(base, struct wl_shell, shell); */
shell = container_of(base, struct wl_shell, shell); /* if ((ess = _shell_get_shell_surface(surface))) */
/* type = ess->type; */
if ((ess = _shell_get_shell_surface(surface))) /* surface->geometry.x = x; */
type = ess->type; /* surface->geometry.y = y; */
/* surface->geometry.w = w; */
/* surface->geometry.h = h; */
/* surface->geometry.dirty = EINA_TRUE; */
surface->geometry.x = x; /* switch (type) */
surface->geometry.y = y; /* { */
surface->geometry.w = w; /* case E_SHELL_SURFACE_SCREENSAVER: */
surface->geometry.h = h; /* _shell_center_on_output(surface, ess->fullscreen_output); */
surface->geometry.dirty = EINA_TRUE; /* break; */
/* case E_SHELL_SURFACE_FULLSCREEN: */
/* _shell_configure_fullscreen(ess); */
/* if (ptype != E_SHELL_SURFACE_FULLSCREEN) */
/* _shell_stack_fullscreen(ess); */
/* break; */
/* case E_SHELL_SURFACE_MAXIMIZED: */
/* surface->geometry.x = surface->output->x; */
/* surface->geometry.y = surface->output->y; */
/* break; */
/* case E_SHELL_SURFACE_TOPLEVEL: */
/* break; */
/* default: */
/* break; */
/* } */
switch (type) /* if (surface->output) */
{ /* { */
case E_SHELL_SURFACE_SCREENSAVER: /* e_surface_assign_output(surface); */
_shell_center_on_output(surface, ess->fullscreen_output); /* if (type == E_SHELL_SURFACE_SCREENSAVER) */
break; /* surface->output = ess->output; */
case E_SHELL_SURFACE_FULLSCREEN: /* else if (type == E_SHELL_SURFACE_MAXIMIZED) */
_shell_configure_fullscreen(ess); /* surface->output = ess->output; */
if (ptype != E_SHELL_SURFACE_FULLSCREEN) /* } */
_shell_stack_fullscreen(ess); /* } */
break;
case E_SHELL_SURFACE_MAXIMIZED:
surface->geometry.x = surface->output->x;
/* TODO: handle panel height ? */
surface->geometry.y = surface->output->y;
break;
case E_SHELL_SURFACE_TOPLEVEL:
break;
default:
break;
}
if (surface->output)
{
e_surface_assign_output(surface);
if (type == E_SHELL_SURFACE_SCREENSAVER)
surface->output = ess->output;
else if (type == E_SHELL_SURFACE_MAXIMIZED)
surface->output = ess->output;
}
}
static void static void
_shell_cb_destroy(E_Shell *base) _shell_cb_destroy(E_Shell *base)
{ {
@ -397,7 +389,7 @@ _shell_cb_destroy_shell_surface(struct wl_resource *resource)
ess = resource->data; ess = resource->data;
if (ess->popup.grab.input_device) if (ess->popup.grab.input_device)
wl_input_device_end_pointer_grab(ess->popup.grab.input_device, 0); wl_input_device_end_pointer_grab(ess->popup.grab.input_device);
if (ess->surface) if (ess->surface)
wl_list_remove(&ess->surface_destroy_listener.link); wl_list_remove(&ess->surface_destroy_listener.link);
if (ess->fullscreen.black_surface) if (ess->fullscreen.black_surface)
@ -486,9 +478,9 @@ _shell_cb_get_shell_surface(struct wl_client *client, struct wl_resource *resour
ess->fullscreen.black_surface = NULL; ess->fullscreen.black_surface = NULL;
wl_list_init(&ess->fullscreen.transform.link); wl_list_init(&ess->fullscreen.transform.link);
ess->surface_destroy_listener.func = _shell_cb_handle_surface_destroy; ess->surface_destroy_listener.notify = _shell_cb_handle_surface_destroy;
wl_list_insert(es->surface.resource.destroy_listener_list.prev, wl_signal_add(&es->surface.resource.destroy_signal,
&ess->surface_destroy_listener.link); &ess->surface_destroy_listener);
wl_list_init(&ess->link); wl_list_init(&ess->link);
wl_list_init(&ess->rotation.transform.link); wl_list_init(&ess->rotation.transform.link);
@ -500,7 +492,7 @@ _shell_cb_get_shell_surface(struct wl_client *client, struct wl_resource *resour
} }
static void static void
_shell_cb_handle_surface_destroy(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, unsigned int timestamp) _shell_cb_handle_surface_destroy(struct wl_listener *listener, void *data __UNUSED__)
{ {
E_Shell_Surface *ess; E_Shell_Surface *ess;
@ -508,11 +500,11 @@ _shell_cb_handle_surface_destroy(struct wl_listener *listener, struct wl_resourc
ess = container_of(listener, E_Shell_Surface, surface_destroy_listener); ess = container_of(listener, E_Shell_Surface, surface_destroy_listener);
ess->surface = NULL; ess->surface = NULL;
wl_resource_destroy(&ess->resource, timestamp); wl_resource_destroy(&ess->resource);
} }
static void static void
_shell_cb_handle_lock_surface_destroy(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, unsigned int timestamp __UNUSED__) _shell_cb_handle_lock_surface_destroy(struct wl_listener *listener, void *data __UNUSED__)
{ {
struct wl_shell *shell; struct wl_shell *shell;
@ -522,38 +514,38 @@ _shell_cb_handle_lock_surface_destroy(struct wl_listener *listener, struct wl_re
shell->lock_surface = NULL; shell->lock_surface = NULL;
} }
static void /* static void */
_shell_cb_activate(E_Shell *base, E_Surface *es, E_Input_Device *eid, unsigned int timestamp) /* _shell_cb_activate(E_Shell *base, E_Surface *es, E_Input_Device *eid, unsigned int timestamp) */
{ /* { */
struct wl_shell *shell; /* struct wl_shell *shell; */
E_Compositor *comp; /* E_Compositor *comp; */
E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE; /* E_Shell_Surface_Type type = E_SHELL_SURFACE_NONE; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
shell = container_of(base, struct wl_shell, shell); /* shell = container_of(base, struct wl_shell, shell); */
comp = shell->compositor; /* comp = shell->compositor; */
e_surface_activate(es, eid, timestamp); /* e_surface_activate(es, eid, timestamp); */
type = _shell_get_shell_surface_type(es); /* type = _shell_get_shell_surface_type(es); */
switch (type) /* switch (type) */
{ /* { */
case E_SHELL_SURFACE_BACKGROUND: /* case E_SHELL_SURFACE_BACKGROUND: */
case E_SHELL_SURFACE_PANEL: /* case E_SHELL_SURFACE_PANEL: */
case E_SHELL_SURFACE_LOCK: /* case E_SHELL_SURFACE_LOCK: */
break; /* break; */
case E_SHELL_SURFACE_SCREENSAVER: /* case E_SHELL_SURFACE_SCREENSAVER: */
if (shell->lock_surface) /* if (shell->lock_surface) */
e_surface_restack(es, &shell->lock_surface->surface->layers); /* e_surface_restack(es, &shell->lock_surface->surface->layers); */
break; /* break; */
case E_SHELL_SURFACE_FULLSCREEN: /* case E_SHELL_SURFACE_FULLSCREEN: */
break; /* break; */
default: /* default: */
e_surface_restack(es, &shell->toplevel_layer.surfaces); /* e_surface_restack(es, &shell->toplevel_layer.surfaces); */
break; /* break; */
} /* } */
} /* } */
static void static void
_shell_cb_desktop_set_background(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource) _shell_cb_desktop_set_background(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *surface_resource)
@ -647,9 +639,9 @@ _shell_cb_desktop_set_lock_surface(struct wl_client *client __UNUSED__, struct w
if (!shell->locked) return; if (!shell->locked) return;
shell->lock_surface = ess; shell->lock_surface = ess;
shell->lock_surface_listener.func = _shell_cb_handle_lock_surface_destroy; shell->lock_surface_listener.notify = _shell_cb_handle_lock_surface_destroy;
wl_list_insert(&surface_resource->destroy_listener_list, wl_signal_add(&surface_resource->destroy_signal,
&shell->lock_surface_listener.link); &shell->lock_surface_listener);
shell->lock_surface->type = E_SHELL_SURFACE_LOCK; shell->lock_surface->type = E_SHELL_SURFACE_LOCK;
} }
@ -669,6 +661,17 @@ _shell_cb_desktop_unlock(struct wl_client *client __UNUSED__, struct wl_resource
} }
} }
static void
_shell_cb_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial)
{
E_Shell_Surface *ess;
SLOGFN(__FILE__, __LINE__, __FUNCTION__);
ess = resource->data;
/* TODO: handle ping timer */
}
static void static void
_shell_cb_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp) _shell_cb_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, unsigned int timestamp)
{ {
@ -772,8 +775,8 @@ _shell_cb_shell_surface_set_fullscreen(struct wl_client *client __UNUSED__, stru
if (es->output) ess->surface->force_configure = EINA_TRUE; if (es->output) ess->surface->force_configure = EINA_TRUE;
wl_shell_surface_send_configure(&ess->resource, e_compositor_get_time(), wl_shell_surface_send_configure(&ess->resource, 0,
0, ess->output->current->w, ess->output->current->w,
ess->output->current->h); ess->output->current->h);
} }
@ -818,8 +821,8 @@ _shell_cb_shell_surface_set_maximized(struct wl_client *client __UNUSED__, struc
/* TODO: handle getting panel size ?? */ /* TODO: handle getting panel size ?? */
edges = WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT; edges = WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT;
wl_shell_surface_send_configure(&ess->resource, e_compositor_get_time(), wl_shell_surface_send_configure(&ess->resource, edges,
edges, es->output->current->w, es->output->current->w,
es->output->current->h); es->output->current->h);
ess->type = E_SHELL_SURFACE_MAXIMIZED; ess->type = E_SHELL_SURFACE_MAXIMIZED;
} }
@ -827,16 +830,14 @@ _shell_cb_shell_surface_set_maximized(struct wl_client *client __UNUSED__, struc
static E_Shell_Surface * static E_Shell_Surface *
_shell_get_shell_surface(E_Surface *es) _shell_get_shell_surface(E_Surface *es)
{ {
struct wl_list *list;
struct wl_listener *listener; struct wl_listener *listener;
SLOGFN(__FILE__, __LINE__, __FUNCTION__); SLOGFN(__FILE__, __LINE__, __FUNCTION__);
list = &es->surface.resource.destroy_listener_list; listener = wl_signal_get(&es->surface.resource.destroy_signal,
_shell_cb_handle_surface_destroy);
wl_list_for_each(listener, list, link) if (listener)
if (listener->func == _shell_cb_handle_surface_destroy) return container_of(listener, E_Shell_Surface, surface_destroy_listener);
return container_of(listener, E_Shell_Surface, surface_destroy_listener);
return NULL; return NULL;
} }
@ -878,98 +879,98 @@ _shell_reset_shell_surface_type(E_Shell_Surface *ess)
return 0; return 0;
} }
static void /* static void */
_shell_center_on_output(E_Surface *es, E_Output *output) /* _shell_center_on_output(E_Surface *es, E_Output *output) */
{ /* { */
E_Output_Mode *mode; /* E_Output_Mode *mode; */
GLfloat x, y; /* GLfloat x, y; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
mode = output->current; /* mode = output->current; */
x = (mode->w - es->geometry.w) / 2; /* x = (mode->w - es->geometry.w) / 2; */
y = (mode->h - es->geometry.h) / 2; /* y = (mode->h - es->geometry.h) / 2; */
e_surface_set_position(es, output->x + x, output->y + y); /* e_surface_set_position(es, output->x + x, output->y + y); */
} /* } */
static void /* static void */
_shell_map_fullscreen(E_Shell_Surface *ess) /* _shell_map_fullscreen(E_Shell_Surface *ess) */
{ /* { */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
_shell_configure_fullscreen(ess); /* _shell_configure_fullscreen(ess); */
_shell_stack_fullscreen(ess); /* _shell_stack_fullscreen(ess); */
} /* } */
static void /* static void */
_shell_configure_fullscreen(E_Shell_Surface *ess) /* _shell_configure_fullscreen(E_Shell_Surface *ess) */
{ /* { */
E_Output *output; /* E_Output *output; */
E_Surface *es; /* E_Surface *es; */
E_Matrix *matrix; /* E_Matrix *matrix; */
float scale; /* float scale; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
output = ess->fullscreen_output; /* output = ess->fullscreen_output; */
es = ess->surface; /* es = ess->surface; */
_shell_center_on_output(es, output); /* _shell_center_on_output(es, output); */
if (!ess->fullscreen.black_surface) /* if (!ess->fullscreen.black_surface) */
{ /* { */
ess->fullscreen.black_surface = /* ess->fullscreen.black_surface = */
_shell_create_black_surface(es->compositor, output->x, output->y, /* _shell_create_black_surface(es->compositor, output->x, output->y, */
output->current->w, output->current->h); /* output->current->w, output->current->h); */
} /* } */
wl_list_remove(&ess->fullscreen.black_surface->layers); /* wl_list_remove(&ess->fullscreen.black_surface->layers); */
wl_list_insert(&es->layers, &ess->fullscreen.black_surface->layers); /* wl_list_insert(&es->layers, &ess->fullscreen.black_surface->layers); */
ess->fullscreen.black_surface->output = output; /* ess->fullscreen.black_surface->output = output; */
switch (ess->fullscreen.type) /* switch (ess->fullscreen.type) */
{ /* { */
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: /* case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: */
break; /* break; */
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: /* case WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: */
matrix = &ess->fullscreen.transform.matrix; /* matrix = &ess->fullscreen.transform.matrix; */
e_matrix_init(matrix); /* e_matrix_init(matrix); */
scale = (float)output->current->w / (float)es->geometry.w; /* scale = (float)output->current->w / (float)es->geometry.w; */
e_matrix_scale(matrix, scale, scale, 1); /* e_matrix_scale(matrix, scale, scale, 1); */
wl_list_remove(&ess->fullscreen.transform.link); /* wl_list_remove(&ess->fullscreen.transform.link); */
wl_list_insert(es->geometry.transforms.prev, /* wl_list_insert(es->geometry.transforms.prev, */
&ess->fullscreen.transform.link); /* &ess->fullscreen.transform.link); */
e_surface_set_position(es, output->x, output->y); /* e_surface_set_position(es, output->x, output->y); */
break; /* break; */
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: /* case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: */
break; /* break; */
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: /* case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: */
break; /* break; */
default: /* default: */
break; /* break; */
} /* } */
} /* } */
static void /* static void */
_shell_stack_fullscreen(E_Shell_Surface *ess) /* _shell_stack_fullscreen(E_Shell_Surface *ess) */
{ /* { */
E_Surface *es; /* E_Surface *es; */
struct wl_shell *shell; /* struct wl_shell *shell; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
es = ess->surface; /* es = ess->surface; */
shell = _shell_surface_get_shell(ess); /* shell = _shell_surface_get_shell(ess); */
wl_list_remove(&es->layers); /* wl_list_remove(&es->layers); */
wl_list_remove(&ess->fullscreen.black_surface->layers); /* wl_list_remove(&ess->fullscreen.black_surface->layers); */
wl_list_insert(&shell->fullscreen_layer.surfaces, &es->layers); /* wl_list_insert(&shell->fullscreen_layer.surfaces, &es->layers); */
wl_list_insert(&es->layers, &ess->fullscreen.black_surface->layers); /* wl_list_insert(&es->layers, &ess->fullscreen.black_surface->layers); */
e_surface_damage(es); /* e_surface_damage(es); */
e_surface_damage(ess->fullscreen.black_surface); /* e_surface_damage(ess->fullscreen.black_surface); */
} /* } */
static void static void
_shell_unset_fullscreen(E_Shell_Surface *ess) _shell_unset_fullscreen(E_Shell_Surface *ess)
@ -987,86 +988,86 @@ _shell_unset_fullscreen(E_Shell_Surface *ess)
e_surface_set_position(ess->surface, ess->sx, ess->sy); e_surface_set_position(ess->surface, ess->sx, ess->sy);
} }
static struct wl_shell * /* static struct wl_shell * */
_shell_surface_get_shell(E_Shell_Surface *ess) /* _shell_surface_get_shell(E_Shell_Surface *ess) */
{ /* { */
E_Surface *es; /* E_Surface *es; */
E_Shell *shell; /* E_Shell *shell; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
es = ess->surface; /* es = ess->surface; */
shell = es->compositor->shell; /* shell = es->compositor->shell; */
return (struct wl_shell *)container_of(shell, struct wl_shell, shell); /* return (struct wl_shell *)container_of(shell, struct wl_shell, shell); */
} /* } */
static E_Surface * /* static E_Surface * */
_shell_create_black_surface(E_Compositor *comp, GLfloat x, GLfloat y, int w, int h) /* _shell_create_black_surface(E_Compositor *comp, GLfloat x, GLfloat y, int w, int h) */
{ /* { */
E_Surface *es = NULL; /* E_Surface *es = NULL; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
if (!(es = e_surface_create(comp))) /* if (!(es = e_surface_create(comp))) */
return NULL; /* return NULL; */
e_surface_configure(es, x, y, w, h); /* e_surface_configure(es, x, y, w, h); */
e_surface_set_color(es, 0.0, 0.0, 0.0, 1); /* e_surface_set_color(es, 0.0, 0.0, 0.0, 1); */
return es; /* return es; */
} /* } */
static E_Shell_Surface_Type /* static E_Shell_Surface_Type */
_shell_get_shell_surface_type(E_Surface *es) /* _shell_get_shell_surface_type(E_Surface *es) */
{ /* { */
E_Shell_Surface *ess; /* E_Shell_Surface *ess; */
SLOGFN(__FILE__, __LINE__, __FUNCTION__); /* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
if (!(ess = _shell_get_shell_surface(es))) /* if (!(ess = _shell_get_shell_surface(es))) */
return E_SHELL_SURFACE_NONE; /* return E_SHELL_SURFACE_NONE; */
return ess->type; /* return ess->type; */
} /* } */
/* static void */
/* _shell_map_popup(E_Shell_Surface *ess, unsigned int timestamp __UNUSED__) */
/* { */
/* struct wl_input_device *device; */
/* E_Surface *es, *parent; */
/* SLOGFN(__FILE__, __LINE__, __FUNCTION__); */
/* es = ess->surface; */
/* parent = ess->parent->surface; */
/* es->output = parent->output; */
/* device = es->compositor->input_device; */
/* ess->popup.grab.interface = &_e_popup_grab_interface; */
/* e_surface_update_transform(parent); */
/* if (parent->transform.enabled) */
/* ess->popup.parent_transform.matrix = parent->transform.matrix; */
/* else */
/* { */
/* e_matrix_init(&ess->popup.parent_transform.matrix); */
/* ess->popup.parent_transform.matrix.d[12] = parent->geometry.x; */
/* ess->popup.parent_transform.matrix.d[13] = parent->geometry.y; */
/* } */
/* wl_list_insert(es->geometry.transforms.prev, */
/* &ess->popup.parent_transform.link); */
/* e_surface_set_position(es, ess->popup.x, ess->popup.y); */
/* ess->popup.grab.input_device = device; */
/* ess->popup.timestamp = device->grab_time; */
/* ess->popup.initial_up = EINA_FALSE; */
/* wl_input_device_start_pointer_grab(ess->popup.grab.input_device, */
/* &ess->popup.grab); */
/* } */
static void static void
_shell_map_popup(E_Shell_Surface *ess, unsigned int timestamp) _shell_cb_popup_grab_focus(struct wl_pointer_grab *grab, struct wl_surface *surface, int x, int y)
{
struct wl_input_device *device;
E_Surface *es, *parent;
SLOGFN(__FILE__, __LINE__, __FUNCTION__);
es = ess->surface;
parent = ess->parent->surface;
es->output = parent->output;
device = es->compositor->input_device;
ess->popup.grab.interface = &_e_popup_grab_interface;
e_surface_update_transform(parent);
if (parent->transform.enabled)
ess->popup.parent_transform.matrix = parent->transform.matrix;
else
{
e_matrix_init(&ess->popup.parent_transform.matrix);
ess->popup.parent_transform.matrix.d[12] = parent->geometry.x;
ess->popup.parent_transform.matrix.d[13] = parent->geometry.y;
}
wl_list_insert(es->geometry.transforms.prev,
&ess->popup.parent_transform.link);
e_surface_set_position(es, ess->popup.x, ess->popup.y);
ess->popup.grab.input_device = device;
ess->popup.timestamp = device->grab_time;
ess->popup.initial_up = EINA_FALSE;
wl_input_device_start_pointer_grab(ess->popup.grab.input_device,
&ess->popup.grab, ess->popup.timestamp);
}
static void
_shell_cb_popup_grab_focus(struct wl_pointer_grab *grab, unsigned int timestamp, struct wl_surface *surface, int x, int y)
{ {
struct wl_input_device *device; struct wl_input_device *device;
E_Shell_Surface *priv; E_Shell_Surface *priv;
@ -1080,12 +1081,12 @@ _shell_cb_popup_grab_focus(struct wl_pointer_grab *grab, unsigned int timestamp,
if ((surface) && (surface->resource.client == client)) if ((surface) && (surface->resource.client == client))
{ {
wl_input_device_set_pointer_focus(device, surface, timestamp, x, y); wl_input_device_set_pointer_focus(device, surface, x, y);
grab->focus = surface; grab->focus = surface;
} }
else else
{ {
wl_input_device_set_pointer_focus(device, NULL, timestamp, 0, 0); wl_input_device_set_pointer_focus(device, NULL, 0, 0);
grab->focus = NULL; grab->focus = NULL;
} }
} }
@ -1113,7 +1114,7 @@ _shell_cb_popup_grab_motion(struct wl_pointer_grab *grab, unsigned int timestamp
} }
static void static void
_shell_cb_popup_grab_button(struct wl_pointer_grab *grab, unsigned int timestamp, int button, int state) _shell_cb_popup_grab_button(struct wl_pointer_grab *grab, unsigned int timestamp, unsigned int button, int state)
{ {
/* struct wl_input_device *device; */ /* struct wl_input_device *device; */
@ -1132,13 +1133,20 @@ _shell_cb_popup_grab_button(struct wl_pointer_grab *grab, unsigned int timestamp
ess = container_of(grab, E_Shell_Surface, popup.grab); ess = container_of(grab, E_Shell_Surface, popup.grab);
if ((resource = grab->input_device->pointer_focus_resource)) if ((resource = grab->input_device->pointer_focus_resource))
wl_input_device_send_button(resource, timestamp, button, state); {
struct wl_display *disp;
unsigned int serial = 0;
disp = wl_client_get_display(resource->client);
serial = wl_display_get_serial(disp);
wl_input_device_send_button(resource, serial, timestamp, button, state);
}
else if ((state == 0) && else if ((state == 0) &&
((ess->popup.initial_up) || ((ess->popup.initial_up) ||
(timestamp - ess->popup.timestamp > 500))) (timestamp - ess->popup.timestamp > 500)))
{ {
wl_shell_surface_send_popup_done(&ess->resource); wl_shell_surface_send_popup_done(&ess->resource);
wl_input_device_end_pointer_grab(grab->input_device, timestamp); wl_input_device_end_pointer_grab(grab->input_device);
ess->popup.grab.input_device = NULL; ess->popup.grab.input_device = NULL;
} }

View File

@ -11,78 +11,6 @@
# endif # endif
# include <wayland-server.h> # include <wayland-server.h>
# include "e_desktop_shell_protocol.h"
typedef enum _E_Shell_Surface_Type E_Shell_Surface_Type;
typedef struct _E_Shell_Surface E_Shell_Surface;
struct wl_shell
{
E_Compositor *compositor;
E_Shell shell;
E_Layer fullscreen_layer;
E_Layer panel_layer;
E_Layer toplevel_layer;
E_Layer background_layer;
E_Layer lock_layer;
Eina_Bool locked : 1;
Eina_Bool prepare_event_sent : 1;
E_Shell_Surface *lock_surface;
struct wl_listener lock_surface_listener;
struct wl_list backgrounds, panels;
};
enum _E_Shell_Surface_Type
{
E_SHELL_SURFACE_NONE,
E_SHELL_SURFACE_PANEL,
E_SHELL_SURFACE_BACKGROUND,
E_SHELL_SURFACE_LOCK,
E_SHELL_SURFACE_SCREENSAVER,
E_SHELL_SURFACE_TOPLEVEL,
E_SHELL_SURFACE_TRANSIENT,
E_SHELL_SURFACE_FULLSCREEN,
E_SHELL_SURFACE_MAXIMIZED,
E_SHELL_SURFACE_POPUP
};
struct _E_Shell_Surface
{
struct wl_resource resource;
E_Surface *surface;
struct wl_listener surface_destroy_listener;
E_Shell_Surface *parent;
E_Shell_Surface_Type type;
int sx, sy;
Eina_Bool saved_pos_valid : 1;
struct
{
E_Transform transform;
E_Matrix rotation;
} rotation;
struct
{
struct wl_pointer_grab grab;
unsigned int timestamp;
int x, y;
E_Transform parent_transform;
Eina_Bool initial_up : 1;
} popup;
struct
{
enum wl_shell_surface_fullscreen_method type;
E_Transform transform;
unsigned int framerate;
E_Surface *black_surface;
} fullscreen;
E_Output *output, *fullscreen_output;
struct wl_list link;
};
EAPI extern E_Module_Api e_modapi; EAPI extern E_Module_Api e_modapi;