Re: [PATCH] desktop-shell: don't segfault on invalid icon path
On Tue, 28 Aug 2012 19:48:12 +0200 Philipp Brüschweiler ble...@gmail.com wrote: Instead load a fallback icon and proceed as normal. https://bugs.freedesktop.org/show_bug.cgi?id=53860 v2: coding style fixes --- clients/desktop-shell.c | 20 +++- 1 Datei geändert, 19 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index dc87e75..c2d158d 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -472,6 +472,24 @@ panel_create(struct display *display) return panel; } +static cairo_surface_t * +load_icon_or_fallback(const char *icon) +{ + cairo_surface_t *surface = cairo_image_surface_create_from_png(icon); + + if (cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS) + return surface; + + fprintf(stderr, ERROR loading icon from file '%s'\n, icon); Should surface be properly destroyed here, before re-creating? + /* loading fallback */ + surface = + cairo_image_surface_create_from_png(DATADIR + /weston/icon_window.png); + + return surface; +} + static void panel_add_launcher(struct panel *panel, const char *icon, const char *path) { @@ -481,7 +499,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path) launcher = malloc(sizeof *launcher); memset(launcher, 0, sizeof *launcher); - launcher-icon = cairo_image_surface_create_from_png(icon); + launcher-icon = load_icon_or_fallback(icon); launcher-path = strdup(path); wl_array_init(launcher-envp); Hi Philipp, thanks for the patch, these little things often get overlooked. You didn't really fix the segfault, you just made it more unlikely. It is possible the fallback icon is not there, either. Could you check for the failure and then just not add the launcher at all, and complain? Another thought, if launcher-icon is bad, you could use cairo to draw a box with an X or something. That way you're not depending on any image files, the launcher item will still work, and the problem will be obvious. Thanks, pq ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] desktop-shell: don't segfault on invalid icon path
On Wed, 29 Aug 2012 10:53:36 +0200 Philipp Brüschweiler ble...@gmail.com wrote: Instead draw a fallback icon and proceed as normal. https://bugs.freedesktop.org/show_bug.cgi?id=53860 v2: coding style fixes v3: memory leak, draw icon instead of relying on external files --- clients/desktop-shell.c | 36 +++- 1 Datei geändert, 35 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index dc87e75..588dc1c 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -472,6 +472,40 @@ panel_create(struct display *display) return panel; } +static cairo_surface_t * +load_icon_or_fallback(const char *icon) +{ + cairo_surface_t *surface = cairo_image_surface_create_from_png(icon); + cairo_t *cr; + + if (cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS) + return surface; + + cairo_surface_destroy(surface); + fprintf(stderr, ERROR loading icon from file '%s'\n, icon); + + /* draw fallback icon */ + surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, + 20, 20); + cr = cairo_create(surface); + + cairo_set_source_rgba(cr, 0.8, 0.8, 0.8, 1); + cairo_paint(cr); + + cairo_set_source_rgba(cr, 0, 0, 0, 1); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); + cairo_rectangle(cr, 0, 0, 20, 20); + cairo_move_to(cr, 4, 4); + cairo_line_to(cr, 16, 16); + cairo_move_to(cr, 4, 16); + cairo_line_to(cr, 16, 4); + cairo_stroke(cr); + + cairo_destroy(cr); + + return surface; +} + static void panel_add_launcher(struct panel *panel, const char *icon, const char *path) { @@ -481,7 +515,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path) launcher = malloc(sizeof *launcher); memset(launcher, 0, sizeof *launcher); - launcher-icon = cairo_image_surface_create_from_png(icon); + launcher-icon = load_icon_or_fallback(icon); launcher-path = strdup(path); wl_array_init(launcher-envp); Very good! Thanks, pq ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] man: add man page for weston
It is not complete, but has lots of stuff already. Signed-off-by: Pekka Paalanen ppaala...@gmail.com --- Makefile.am |4 +- configure.ac|2 + man/.gitignore |2 + man/Makefile.am | 11 +++ man/weston.man | 233 +++ 5 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 man/.gitignore create mode 100644 man/Makefile.am create mode 100644 man/weston.man diff --git a/Makefile.am b/Makefile.am index dcc320b..7b1b1bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,9 @@ if BUILD_WCAP_TOOLS wcap_subdir = wcap endif -SUBDIRS = shared src clients data protocol tests $(wcap_subdir) +SUBDIRS = shared src clients data protocol tests $(wcap_subdir) man -DIST_SUBDIRS = shared src clients data protocol tests wcap +DIST_SUBDIRS = shared src clients data protocol tests wcap man DISTCHECK_CONFIGURE_FLAGS = --disable-setuid-install diff --git a/configure.ac b/configure.ac index efdd6b4..aa2caf5 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,7 @@ AM_SILENT_RULES([yes]) # Check for programs AC_PROG_CC AC_PROG_CXX +AC_PROG_SED # Initialize libtool LT_PREREQ([2.2]) @@ -240,5 +241,6 @@ AC_CONFIG_FILES([Makefile wcap/Makefile data/Makefile protocol/Makefile +man/Makefile tests/Makefile]) AC_OUTPUT diff --git a/man/.gitignore b/man/.gitignore new file mode 100644 index 000..52eaf2b --- /dev/null +++ b/man/.gitignore @@ -0,0 +1,2 @@ +weston.1 + diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 000..376bde7 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,11 @@ +man_MANS = weston.1 + +MAN_SUBSTS = \ + -e 's|__weston_modules_dir__|$(pkglibdir)|g' \ + -e 's|__version__|$(PACKAGE_VERSION)|g' + +SUFFIXES = .1 .man + +.man.1: + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) $ $@ + diff --git a/man/weston.man b/man/weston.man new file mode 100644 index 000..eff09c0 --- /dev/null +++ b/man/weston.man @@ -0,0 +1,233 @@ +.TH WESTON 1 2012-08-29 Weston __version__ +.SH NAME +weston \- the reference Wayland server +.SH SYNOPSIS +.B weston +. +.\ *** +.SH DESCRIPTION +.B weston +is the reference implementation of a Wayland server. A Wayland server is a +display server, a window manager, and a compositor all in one. Weston has +several backends as loadable modules: it can run on Linux KMS (kernel +modesetting via DRM), as an X client, or inside another Wayland server +instance. + +Weston supports fundamentally different graphical user interface paradigms via +shell plugins. Two plugins are provided: the desktop shell, and the tablet +shell. + +When weston is started as the first windowing system (i.e. not under X nor +under another Wayland server), it should be done with the command +.B weston-launch +to set up proper privileged access to devices. + +Weston also supports X clients by XWayland. XWayland requires a special +X.org server to be installed. This X server will connect to a Wayland +server as a Wayland client, and X clients will connect to the X server. +XWayland provides backwards compatibility to X applications in a Wayland +stack. +. +.\ *** +.SH BACKENDS +.TP +.I drm-backend.so +The DRM backend uses Linux KMS for output and evdev devices for input. +It supports multiple monitors in a unified desktop with DPMS. +.TP +.I wayland-backend.so +The Wayland backend runs on another Wayland server, a different Weston +instance, for example. Weston shows up as a single desktop window on +the parent server. +.TP +.I x11-backend.so +The X11 backend runs on an X server. Each Weston output becomes an +X window. This is a cheap way to test multi-monitor support of a +Wayland shell, desktop, or applications. +. +.\ *** +.SH SHELLS +.TP +Desktop shell +Desktop shell is like a modern X desktop environment, concentrating +on traditional keyboard and mouse user interfaces and the familiar +desktop-like window management. Desktop shell consists of the +shell plugin +.I desktop-shell.so +and the special client +.B weston-desktop-shell +which provides the wallpaper, panel, and screen locking dialog. +.TP +Tablet shell +Tablet shell is a graphical user interface aimed for tablet-like +devices, where usually the only input method is a touch screen. +It does not support freely floating windows or many other desktop +features, but intends to provide a natural interface on tablets. +Tablet shell consists of the shell plugin +.I tablet-shell.so +and the special client +.B weston-tablet-shell +which provides the basic user interface. +. +.\ *** +.SH OPTIONS +. +.SS Weston core options: +.TP +\fB\-\^B\fR\fIbackend.so\fR, \fB\-\-backend\fR=\fIbackend.so\fR +Load +.I backend.so
wayland hosted VM
I have noticed that running a GLES application through the xserver is considerably slower Basically, I go from 60+ to 20 fps. This raises a smiler concern wrt running VM's with a wayland/egl stack. I imagine a VM display will act similar to the xserver architecturally. If that is so, is it envisioned that VMs will be able to utilize the GPU (i.e., write shaders) when running on wayland? Has there been discussion on this? If, so, please point me in the right direction. Respectfully, ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 2/2] tests: ensure sanity leak check tests pass when leak checks are disabled.
On Thu, Aug 16, 2012 at 06:12:05PM -0700, U. Artie Eoff wrote: From: U. Artie Eoff ullysses.a.e...@intel.com This finalizes Robert Bradfords patch to allow NO_ASSERT_LEAK_CHECK environment variable to disable leak checks in unit tests. Thanks Artie, both patches pushed. Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com --- tests/sanity-test.c | 8 tests/test-runner.c | 6 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/sanity-test.c b/tests/sanity-test.c index 67ca663..46f4f85 100644 --- a/tests/sanity-test.c +++ b/tests/sanity-test.c @@ -29,6 +29,8 @@ #include test-runner.h #include wayland-util.h +extern int leak_check_enabled; + TEST(empty) { } @@ -68,6 +70,8 @@ FAIL_TEST(sanity_malloc_direct) { void *p; + assert(leak_check_enabled); + p = malloc(10); /* memory leak */ assert(p); /* assert that we got memory, also prevents * the malloc from getting optimized away. */ @@ -78,6 +82,8 @@ FAIL_TEST(sanity_malloc_indirect) { struct wl_array array; + assert(leak_check_enabled); + wl_array_init(array); /* call into library that calls malloc */ @@ -90,6 +96,8 @@ FAIL_TEST(sanity_fd_leak) { int fd[2]; + assert(leak_check_enabled); + /* leak 2 file descriptors */ if (pipe(fd) 0) exit(EXIT_SUCCESS); /* failed to fail */ diff --git a/tests/test-runner.c b/tests/test-runner.c index 6c30649..8c79dff 100644 --- a/tests/test-runner.c +++ b/tests/test-runner.c @@ -39,6 +39,8 @@ static void (*sys_free)(void*); static void* (*sys_realloc)(void*, size_t); static void* (*sys_calloc)(size_t, size_t); +int leak_check_enabled; + extern const struct test __start_test_section, __stop_test_section; __attribute__ ((visibility(default))) void * @@ -95,7 +97,7 @@ run_test(const struct test *t) cur_fds = count_open_fds(); t-run(); - if (!getenv(NO_ASSERT_LEAK_CHECK)) { + if (leak_check_enabled) { assert(cur_alloc == num_alloc memory leak detected in test.); assert(cur_fds == count_open_fds() fd leak detected); } @@ -115,6 +117,8 @@ int main(int argc, char *argv[]) sys_malloc = dlsym(RTLD_NEXT, malloc); sys_free = dlsym(RTLD_NEXT, free); + leak_check_enabled = !getenv(NO_ASSERT_LEAK_CHECK); + if (argc == 2) { t = find_test(argv[1]); if (t == NULL) { -- 1.7.11.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] terminal: support entering non-ascii characters
On Sat, Aug 18, 2012 at 01:38:38PM +0200, Philipp Brüschweiler wrote: Unless the alt modifier is active and the MODE_ALT_SENDS_ESC mode is not set, any value over 127 is converted to a UTF8 sequence. Part of https://bugs.freedesktop.org/show_bug.cgi?id=53648 should be fixed with this. Part of https://bugs.freedesktop.org/show_bug.cgi?id=52419 is fixed, but interestingly it depends on the activated keymap (i.e. it works with dvorak, but not with ch). Committed, thanks. --- clients/terminal.c | 30 +++--- 1 Datei geändert, 23 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) diff --git a/clients/terminal.c b/clients/terminal.c index 7e74db7..f97882d 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -20,6 +20,7 @@ * OF THIS SOFTWARE. */ +#include stdbool.h #include stdint.h #include stdio.h #include stdlib.h @@ -2116,7 +2117,8 @@ key_handler(struct window *window, struct input *input, uint32_t time, struct terminal *terminal = data; char ch[MAX_RESPONSE]; uint32_t modifiers, serial; - int len = 0; + int ret, len = 0; + bool convert_utf8 = true; modifiers = input_get_modifiers(input); if ((modifiers MOD_CONTROL_MASK) @@ -2229,15 +2231,29 @@ key_handler(struct window *window, struct input *input, uint32_t time, else if (sym == '/') sym = 0x1F; else if (sym == '8' || sym == '?') sym = 0x7F; } - if ((terminal-mode MODE_ALT_SENDS_ESC) - (modifiers MOD_ALT_MASK)) { - ch[len++] = 0x1b; - } else if (modifiers MOD_ALT_MASK) { - sym = sym | 0x80; + if (modifiers MOD_ALT_MASK) { + if (terminal-mode MODE_ALT_SENDS_ESC) { + ch[len++] = 0x1b; + } else { + sym = sym | 0x80; + convert_utf8 = false; + } } - if (sym 256) + if ((sym 128) || + (!convert_utf8 sym 256)) { ch[len++] = sym; + } else { + ret = xkb_keysym_to_utf8(sym, ch + len, + MAX_RESPONSE - len); + if (ret 0) + fprintf(stderr, + Warning: buffer too small to encode + UTF8 character\n); + else + len += ret; + } + break; } -- 1.7.11.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 0/3] Add tests and documentation for text protocol
On Tue, Aug 21, 2012 at 06:28:47PM +0200, Jan Arne Petersen wrote: From: Jan Arne Petersen jpeter...@openismus.com Add tests for text_model (activate/deactivate/surface focus lost) and documentation for text protocol. Thanks, all applied. Kristian Jan Arne Petersen (3): tests: Explicitly define the test client to launch tests: Add unit test for text model text: Add some documentation to the text protocol. protocol/text.xml| 70 - tests/.gitignore | 2 +- tests/Makefile.am| 8 +- tests/client-test.c | 2 +- tests/event-test.c | 2 +- tests/test-runner.c | 4 +- tests/test-runner.h | 2 +- tests/test-text-client.c | 260 +++ tests/text-test.c| 213 ++ 9 files changed, 552 insertions(+), 11 deletions(-) create mode 100644 tests/test-text-client.c create mode 100644 tests/text-test.c -- 1.7.11.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] toytoolkit: try multiple names when loading cursors
On Tue, Aug 21, 2012 at 08:36:16PM +0200, Philipp Brüschweiler wrote: The correspondence between cursor functions and names of cursors has never been standardized. As a consequence, each cursor function can be represented as a cursor with one of several names. Be more robust when loading cursor by trying all known names that correspond to a cursor. This should fix https://bugs.freedesktop.org/show_bug.cgi?id=50487 and https://bugs.freedesktop.org/show_bug.cgi?id=52609 a bit more thoroughly. Argh, that's pretty ugly, but your fix looks good, thanks. Kristian --- clients/window.c | 105 +-- 1 Datei geändert, 95 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-) diff --git a/clients/window.c b/clients/window.c index 3846e15..7b35fae 100644 --- a/clients/window.c +++ b/clients/window.c @@ -629,20 +629,102 @@ display_create_surface(struct display *display, return display_create_shm_surface(display, rectangle, flags, NULL); } -static const char *cursors[] = { +/* + * The following correspondences between file names and cursors was copied + * from: https://bugs.kde.org/attachment.cgi?id=67313 + */ + +static const char *bottom_left_corners[] = { bottom_left_corner, + sw-resize +}; + +static const char *bottom_right_corners[] = { bottom_right_corner, + se-resize +}; + +static const char *bottom_sides[] = { bottom_side, + s-resize +}; + +static const char *grabbings[] = { grabbing, + closedhand, + 208530c400c041818281048008011002 +}; + +static const char *left_ptrs[] = { left_ptr, + default, + top_left_arrow, + left-arrow +}; + +static const char *left_sides[] = { left_side, + w-resize +}; + +static const char *right_sides[] = { right_side, + e-resize +}; + +static const char *top_left_corners[] = { top_left_corner, + nw-resize +}; + +static const char *top_right_corners[] = { top_right_corner, + ne-resize +}; + +static const char *top_sides[] = { top_side, + n-resize +}; + +static const char *xterms[] = { xterm, + ibeam, + text +}; + +static const char *hand1s[] = { hand1, + pointer, + pointing_hand, + e29285e634086352946a0e7090d73106 +}; + +static const char *watches[] = { watch, + wait, + 0426c94ea35c87780ff01dc239897213 +}; + +struct cursor_alternatives { + const char **names; + size_t count; +}; + +static const struct cursor_alternatives cursors[] = { + {bottom_left_corners, ARRAY_LENGTH(bottom_left_corners)}, + {bottom_right_corners, ARRAY_LENGTH(bottom_right_corners)}, + {bottom_sides, ARRAY_LENGTH(bottom_sides)}, + {grabbings, ARRAY_LENGTH(grabbings)}, + {left_ptrs, ARRAY_LENGTH(left_ptrs)}, + {left_sides, ARRAY_LENGTH(left_sides)}, + {right_sides, ARRAY_LENGTH(right_sides)}, + {top_left_corners, ARRAY_LENGTH(top_left_corners)}, + {top_right_corners, ARRAY_LENGTH(top_right_corners)}, + {top_sides, ARRAY_LENGTH(top_sides)}, + {xterms, ARRAY_LENGTH(xterms)}, + {hand1s, ARRAY_LENGTH(hand1s)}, + {watches, ARRAY_LENGTH(watches)}, }; static void @@ -650,7 +732,8 @@ create_cursors(struct display *display) { char *config_file; char *theme = NULL; - unsigned int i; + unsigned int i, j; + struct wl_cursor *cursor; struct config_key shell_keys[] = { { cursor-theme, CONFIG_KEY_STRING, theme }, }; @@ -667,12 +750,16 @@ create_cursors(struct display *display) malloc(ARRAY_LENGTH(cursors) * sizeof display-cursors[0]); for (i = 0; i ARRAY_LENGTH(cursors); i++) { - display-cursors[i] = - wl_cursor_theme_get_cursor(display-cursor_theme, -cursors[i]); - if (!display-cursors[i]) + cursor = NULL; + for (j = 0; !cursor j cursors[i].count; ++j) + cursor = wl_cursor_theme_get_cursor( + display-cursor_theme, cursors[i].names[j]); + + if (!cursor) fprintf(stderr, could not load cursor '%s'\n, - cursors[i]); + cursors[i].names[0]); + + display-cursors[i] = cursor; } } @@ -686,9 +773,7 @@ destroy_cursors(struct display *display) struct wl_cursor_image * display_get_pointer_image(struct display *display, int pointer) { - struct wl_cursor *cursor = - wl_cursor_theme_get_cursor(display-cursor_theme, -cursors[pointer]); + struct wl_cursor *cursor = display-cursors[pointer]; return cursor ? cursor-images[0] : NULL; } -- 1.7.11.5 ___
Re: [PATCH] desktop-shell: respect CURSOR_NONE as grab cursor
On Fri, Aug 24, 2012 at 03:43:55PM +0200, Philipp Brüschweiler wrote: Thanks, applied. --- clients/desktop-shell.c | 3 +++ 1 Datei geändert, 3 Zeilen hinzugefügt(+) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 97b2066..dc87e75 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -806,6 +806,9 @@ desktop_shell_grab_cursor(void *data, struct desktop *desktop = data; switch (cursor) { + case DESKTOP_SHELL_CURSOR_NONE: + desktop-grab_cursor = CURSOR_BLANK; + break; case DESKTOP_SHELL_CURSOR_BUSY: desktop-grab_cursor = CURSOR_WATCH; break; -- 1.7.12 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH wayland] Add a relative_grab request to the wl_shell_surface interface
On Mon, Aug 27, 2012 at 01:45:17PM -0700, Daniel Stone wrote: Hi, On 27 August 2012 11:55, Philipp Brüschweiler ble...@gmail.com wrote: This request can be used to grab the pointer of a specified seat. A pointer grabbed in this way will be made invisible and won't send any more motion events. Instead it reports relative motion using the motion event on the returned object. A grab can be broken by the application by destroying the wl_relative_grab object, or by the compositor, in which case the compositor sends a destroy_me event to the application. Recommended behaviour for compositors is to break grabs when the keyboard focus changes to a different window, e.g. by alt-tabbing out of the grabbing application. Very cool, thanks for looking into this. This mostly looks good to me, but I think it'd be better structured along the lines of wl_pointer. So, perhaps call it wl_pointer_raw, have it send enter and leave events, and perhaps duplicate the button and motion events too. You could basically copy the wl_pointer interface, really ... The other other alternative, now I think of it, is to add a wl_pointer_raw capability to wl_seat, with a wl_seat_get_pointer_raw, which just returns another wl_pointer interface, except that it returns relative co-ordinates instead. Either way, following the enter and leave pattern (with surfaces) would be great. Yup, good points here. I think we could reuse the wl_pointer interface, but just send relative motion in the motion event and it should go throught the wl_seat capability feature as Daniel describes. I think we can just say that if you have a raw pointer (ie, you've called wl_seat_get_pointer_raw), then that takes precedence over the normal pointer interface (that is, the normal pointer stops sending events). And the normal pointer needs to send a leave event and the relative pointer should send an enter event. If we alt-tab away, the relative pointer sends a leave event. Mousing over a surface that is in relative mode should not capture the pointer, only activating the surface (either alt-tabbing back, or click-to-focus). When we mouse over the surface, we could either just not send events if the client has a raw_pointer, or we could send wl_pointer.enter, motion, and then wl_pointer.leave + raw_pointer.enter when the surface is activated and we switch to relative motion. I think we may want to keep a pointer surface in raw pointer mode, but let the client hide it, if it wants to. Kristian ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] desktop-shell: don't segfault on invalid icon path
On Wed, Aug 29, 2012 at 10:53:36AM +0200, Philipp Brüschweiler wrote: Instead draw a fallback icon and proceed as normal. https://bugs.freedesktop.org/show_bug.cgi?id=53860 v2: coding style fixes v3: memory leak, draw icon instead of relying on external files Nice, committed. Kristian --- clients/desktop-shell.c | 36 +++- 1 Datei geändert, 35 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index dc87e75..588dc1c 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -472,6 +472,40 @@ panel_create(struct display *display) return panel; } +static cairo_surface_t * +load_icon_or_fallback(const char *icon) +{ + cairo_surface_t *surface = cairo_image_surface_create_from_png(icon); + cairo_t *cr; + + if (cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS) + return surface; + + cairo_surface_destroy(surface); + fprintf(stderr, ERROR loading icon from file '%s'\n, icon); + + /* draw fallback icon */ + surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, + 20, 20); + cr = cairo_create(surface); + + cairo_set_source_rgba(cr, 0.8, 0.8, 0.8, 1); + cairo_paint(cr); + + cairo_set_source_rgba(cr, 0, 0, 0, 1); + cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); + cairo_rectangle(cr, 0, 0, 20, 20); + cairo_move_to(cr, 4, 4); + cairo_line_to(cr, 16, 16); + cairo_move_to(cr, 4, 16); + cairo_line_to(cr, 16, 4); + cairo_stroke(cr); + + cairo_destroy(cr); + + return surface; +} + static void panel_add_launcher(struct panel *panel, const char *icon, const char *path) { @@ -481,7 +515,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path) launcher = malloc(sizeof *launcher); memset(launcher, 0, sizeof *launcher); - launcher-icon = cairo_image_surface_create_from_png(icon); + launcher-icon = load_icon_or_fallback(icon); launcher-path = strdup(path); wl_array_init(launcher-envp); -- 1.7.12 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/6] Add sample configuration for workspaces to weston.ini
Signed-off-by: Jonas Ådahl jad...@gmail.com --- weston.ini |1 + 1 file changed, 1 insertion(+) diff --git a/weston.ini b/weston.ini index 3fda31b..fee071a 100644 --- a/weston.ini +++ b/weston.ini @@ -6,6 +6,7 @@ panel-color=0x90ff locking=true animation=zoom #binding-modifier=ctrl +#num-workspaces=6 #type=tablet-shell.so #lockscreen-icon=/usr/share/icons/gnome/256x256/actions/lock.png -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 3/6] shell: Add possibility to move surfaces to other workspaces
By default, Control + Shift + Up/Down will move the currently active surface, if any, while changing to another workspace. Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/shell.c | 161 +++ 1 file changed, 150 insertions(+), 11 deletions(-) diff --git a/src/shell.c b/src/shell.c index b37ea25..930159a 100644 --- a/src/shell.c +++ b/src/shell.c @@ -109,6 +109,7 @@ struct desktop_shell { unsigned int num; struct weston_animation animation; + struct wl_list anim_sticky_list; int anim_dir; uint32_t anim_timestamp; double anim_current; @@ -450,6 +451,34 @@ restore_focus_state(struct desktop_shell *shell, struct workspace *ws) } static void +replace_focus_state(struct desktop_shell *shell, struct workspace *ws, + struct weston_seat *seat) +{ + struct focus_state *state; + struct wl_surface *surface; + + wl_list_for_each(state, ws-focus_list, link) { + if (state-seat == seat) { + surface = seat-seat.keyboard-focus; + state-keyboard_focus = + (struct weston_surface *) surface; + return; + } + } +} + +static void +drop_focus_state(struct desktop_shell *shell, struct workspace *ws, +struct weston_surface *surface) +{ + struct focus_state *state; + + wl_list_for_each(state, ws-focus_list, link) + if (state-keyboard_focus == surface) + state-keyboard_focus = NULL; +} + +static void workspace_destroy(struct workspace *ws) { struct focus_state *state, *next; @@ -591,8 +620,6 @@ reverse_workspace_change_animation(struct desktop_shell *shell, shell-workspaces.anim_dir = -1 * shell-workspaces.anim_dir; shell-workspaces.anim_timestamp = 0; - restore_focus_state(shell, to); - weston_compositor_schedule_repaint(shell-compositor); } @@ -604,8 +631,10 @@ workspace_deactivate_transforms(struct workspace *ws) wl_list_for_each(surface, ws-layer.surface_list, layer_link) { shsurf = get_shell_surface(surface); - wl_list_remove(shsurf-workspace_transform.link); - wl_list_init(shsurf-workspace_transform.link); + if (!wl_list_empty(shsurf-workspace_transform.link)) { + wl_list_remove(shsurf-workspace_transform.link); + wl_list_init(shsurf-workspace_transform.link); + } shsurf-surface-geometry.dirty = 1; } } @@ -704,7 +733,7 @@ animate_workspace_change(struct desktop_shell *shell, wl_list_insert(output-animation_list, shell-workspaces.animation.link); - wl_list_insert(from-layer.link, to-layer.link); + wl_list_insert(from-layer.link.prev, to-layer.link); workspace_translate_in(to, 0); @@ -714,6 +743,15 @@ animate_workspace_change(struct desktop_shell *shell, } static void +update_workspace(struct desktop_shell *shell, unsigned int index, +struct workspace *from, struct workspace *to) +{ + shell-workspaces.current = index; + wl_list_insert(from-layer.link, to-layer.link); + wl_list_remove(from-layer.link); +} + +static void change_workspace(struct desktop_shell *shell, unsigned int index) { struct workspace *from; @@ -731,6 +769,7 @@ change_workspace(struct desktop_shell *shell, unsigned int index) if (shell-workspaces.anim_from == to shell-workspaces.anim_to == from) { + restore_focus_state(shell, to); reverse_workspace_change_animation(shell, index, from, to); return; } @@ -740,17 +779,79 @@ change_workspace(struct desktop_shell *shell, unsigned int index) shell-workspaces.anim_from, shell-workspaces.anim_to); - if (workspace_is_empty(to) workspace_is_empty(from)) { - shell-workspaces.current = index; - wl_list_insert(from-layer.link, to-layer.link); - wl_list_remove(from-layer.link); + restore_focus_state(shell, to); - restore_focus_state(shell, to); - } + if (workspace_is_empty(to) workspace_is_empty(from)) + update_workspace(shell, index, from, to); else animate_workspace_change(shell, index, from, to); } +static bool +workspace_has_only(struct workspace *ws, struct weston_surface *surface) +{ + struct wl_list *list = ws-layer.surface_list; + struct wl_list *e; + + if (wl_list_empty(list)) + return false; + + e = list-next; + + if (e-next != list) + return false; + + return
[PATCH weston 4/6] shell: Introduce workspace manager interface
The workspace manager interface purpose is to provide clients with control and knowledge about the current workspace state. Initially only one function and one event exists; moving a surface and state updated event. A workspace is represented as an index in a 1 dimensional array. A client keeps track of the state by being broadcasted events when the state changes, currently limited to current workspace or number of workspaces available. A client can send an asynchronous request to the manager asking to move a surface to workspace identified by an index. It is up to the shell to actually move it. Signed-off-by: Jonas Ådahl jad...@gmail.com --- protocol/Makefile.am|5 ++- protocol/workspaces.xml | 27 src/Makefile.am |4 ++ src/shell.c | 111 +-- 4 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 protocol/workspaces.xml diff --git a/protocol/Makefile.am b/protocol/Makefile.am index 22cb2c9..bf5ef99 100644 --- a/protocol/Makefile.am +++ b/protocol/Makefile.am @@ -2,5 +2,6 @@ EXTRA_DIST =\ desktop-shell.xml \ screenshooter.xml \ tablet-shell.xml\ - xserver.xml \ - text.xml + xserver.xml \ + text.xml\ + workspaces.xml diff --git a/protocol/workspaces.xml b/protocol/workspaces.xml new file mode 100644 index 000..22f4802 --- /dev/null +++ b/protocol/workspaces.xml @@ -0,0 +1,27 @@ +protocol name=workspaces + + interface name=workspace_manager version=1 +description summary=workspaces manager + An interface for managing surfaces in workspaces. +/description + +request name=move_surface + description summary=move surface to workspace + Move the given surface to the specified workspace. + /description + arg name=surface type=object interface=wl_surface/ + arg name=workspace type=uint/ +/request + +event name=state + description summary=workspace state + The current workspace state, such as current workspace and workspace + count, has changed. + /description + arg name=current type=uint/ + arg name=count type=uint/ +/event + + /interface + +/protocol diff --git a/src/Makefile.am b/src/Makefile.am index 8096849..028735e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,6 +28,8 @@ weston_SOURCES = \ text-backend.c \ text-protocol.c \ text-server-protocol.h \ + workspaces-protocol.c \ + workspaces-server-protocol.h\ util.c \ matrix.c\ matrix.h\ @@ -173,6 +175,8 @@ BUILT_SOURCES = \ desktop-shell-server-protocol.h \ text-protocol.c \ text-server-protocol.h \ + workspaces-server-protocol.h\ + workspaces-protocol.c \ git-version.h CLEANFILES = $(BUILT_SOURCES) diff --git a/src/shell.c b/src/shell.c index 930159a..33ece42 100644 --- a/src/shell.c +++ b/src/shell.c @@ -35,6 +35,7 @@ #include wayland-server.h #include compositor.h #include desktop-shell-server-protocol.h +#include workspaces-server-protocol.h #include ../shared/config-parser.h #define DEFAULT_NUM_WORKSPACES 1 @@ -108,6 +109,8 @@ struct desktop_shell { unsigned int current; unsigned int num; + struct wl_list client_list; + struct weston_animation animation; struct wl_list anim_sticky_list; int anim_dir; @@ -608,6 +611,17 @@ workspace_translate_in(struct workspace *ws, double fraction) } static void +broadcast_current_workspace_state(struct desktop_shell *shell) +{ + struct wl_resource *resource; + + wl_list_for_each(resource, shell-workspaces.client_list, link) + workspace_manager_send_state(resource, +shell-workspaces.current, +shell-workspaces.num); +} + +static void reverse_workspace_change_animation(struct desktop_shell *shell, unsigned int index, struct workspace *from, @@ -771,6 +785,7 @@ change_workspace(struct desktop_shell *shell, unsigned int index) shell-workspaces.anim_to == from) { restore_focus_state(shell, to); reverse_workspace_change_animation(shell, index, from, to); +
[PATCH weston 5/6] toytoolkit: Implement support for the workspace manager interface
Two buttons are added to the right-click menu of the window frame for moving a surface either up or down. Signed-off-by: Jonas Ådahl jad...@gmail.com --- clients/Makefile.am |8 ++-- clients/window.c| 56 ++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/clients/Makefile.am b/clients/Makefile.am index 71a37bd..1b7fa10 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -67,7 +67,9 @@ libtoytoolkit_a_SOURCES = \ window.c\ window.h\ text-cursor-position-protocol.c \ - text-cursor-position-client-protocol.h + text-cursor-position-client-protocol.h \ + workspaces-protocol.c \ + workspaces-client-protocol.h toolkit_libs = \ libtoytoolkit.a \ @@ -143,7 +145,9 @@ BUILT_SOURCES = \ desktop-shell-client-protocol.h \ desktop-shell-protocol.c\ tablet-shell-client-protocol.h \ - tablet-shell-protocol.c + tablet-shell-protocol.c \ + workspaces-client-protocol.h\ + workspaces-protocol.c CLEANFILES = $(BUILT_SOURCES) endif diff --git a/clients/window.c b/clients/window.c index 3846e15..131cd18 100644 --- a/clients/window.c +++ b/clients/window.c @@ -62,6 +62,7 @@ #include wayland-client.h #include ../shared/cairo-util.h #include text-cursor-position-client-protocol.h +#include workspaces-client-protocol.h #include ../shared/os-compatibility.h #include window.h @@ -75,6 +76,7 @@ struct display { struct wl_shm *shm; struct wl_data_device_manager *data_device_manager; struct text_cursor_position *text_cursor_position; + struct workspace_manager *workspace_manager; EGLDisplay dpy; EGLConfig argb_config; EGLContext argb_ctx; @@ -108,6 +110,9 @@ struct display { void *user_data; struct xkb_context *xkb_context; + + uint32_t workspace; + uint32_t workspace_count; }; enum { @@ -1260,6 +1265,22 @@ widget_set_tooltip(struct widget *parent, char *entry, float x, float y) } static void +workspace_manager_state(void *data, + struct workspace_manager *workspace_manager, + uint32_t current, + uint32_t count) +{ + struct display *display = data; + + display-workspace = current; + display-workspace_count = count; +} + +static const struct workspace_manager_listener workspace_manager_listener = { + workspace_manager_state +}; + +static void frame_resize_handler(struct widget *widget, int32_t width, int32_t height, void *data) { @@ -1574,6 +1595,8 @@ frame_get_pointer_image_for_location(struct frame *frame, struct input *input) static void frame_menu_func(struct window *window, int index, void *data) { + struct display *display; + switch (index) { case 0: /* close */ if (window-close_handler) @@ -1587,6 +1610,20 @@ frame_menu_func(struct window *window, int index, void *data) if (window-fullscreen_handler) window-fullscreen_handler(window, window-user_data); break; + case 2: /* move to workspace above */ + display = window-display; + if (display-workspace 0) + workspace_manager_move_surface(display-workspace_manager, + window-surface, + display-workspace - 1); + break; + case 3: /* move to workspace below */ + display = window-display; + if (display-workspace display-workspace_count) + workspace_manager_move_surface(display-workspace_manager, + window-surface, + display-workspace + 1); + break; } } @@ -1597,7 +1634,8 @@ window_show_frame_menu(struct window *window, int32_t x, y; static const char *entries[] = { - Close, Fullscreen + Close, Fullscreen, + Move to workspace above, Move to workspace below }; input_get_position(input, x, y); @@ -3419,6 +3457,17 @@ input_destroy(struct input *input) } static void +init_workspace_manager(struct display *d, uint32_t id) +{ + d-workspace_manager = + wl_display_bind(d-display, id, workspace_manager_interface); + if (d-workspace_manager != NULL) + workspace_manager_add_listener(d-workspace_manager, +
[PATCH weston 6/6] shell: Improve focus handling when moving surfaces between workspaces
Signed-off-by: Jonas Ådahl jad...@gmail.com --- src/shell.c | 35 +-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/shell.c b/src/shell.c index 33ece42..8038a7c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -439,6 +439,22 @@ focus_state_create(struct weston_seat *seat, struct workspace *ws) return state; } +static struct focus_state * +ensure_focus_state(struct desktop_shell *shell, struct weston_seat *seat) +{ + struct workspace *ws = get_current_workspace(shell); + struct focus_state *state; + + wl_list_for_each(state, ws-focus_list, link) + if (state-seat == seat) + break; + + if (state-link == ws-focus_list) + state = focus_state_create(seat, ws); + + return state; +} + static void restore_focus_state(struct desktop_shell *shell, struct workspace *ws) { @@ -859,6 +875,7 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell, struct shell_surface *shsurf; struct workspace *from; struct workspace *to; + struct focus_state *state; if (surface == NULL || index == shell-workspaces.current) @@ -902,6 +919,10 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell, } broadcast_current_workspace_state(shell); + + state = ensure_focus_state(shell, seat); + if (state != NULL) + state-keyboard_focus = surface; } static void @@ -2590,20 +2611,14 @@ static void activate(struct desktop_shell *shell, struct weston_surface *es, struct weston_seat *seat) { - struct workspace *ws = get_current_workspace(shell); struct focus_state *state; + struct workspace *ws; weston_surface_activate(es, seat); - wl_list_for_each(state, ws-focus_list, link) - if (state-seat == seat) - break; - - if (state-link == ws-focus_list) { - state = focus_state_create(seat, ws); - if (state == NULL) - return; - } + state = ensure_focus_state(shell, seat); + if (state == NULL) + return; state-keyboard_focus = es; wl_list_remove(state-surface_destroy_listener.link); -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] Add --version option.
--- src/compositor.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index df28cb7..42d4051 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3565,6 +3565,7 @@ int main(int argc, char *argv[]) int32_t idle_time = 300; int32_t xserver = 0; int32_t help = 0; + int32_t version = 0; char *socket_name = NULL; char *config_file; @@ -3585,6 +3586,7 @@ int main(int argc, char *argv[]) { WESTON_OPTION_STRING, module, 0, module }, { WESTON_OPTION_STRING, log, 0, log }, { WESTON_OPTION_BOOLEAN, help, 'h', help }, + { WESTON_OPTION_BOOLEAN, version, 0, version }, }; argc = parse_options(core_options, @@ -3593,6 +3595,11 @@ int main(int argc, char *argv[]) if (help) usage(EXIT_SUCCESS); + if (version) { + printf(PACKAGE_STRING \n); + return EXIT_SUCCESS; + } + weston_log_file_open(log); weston_log(%s\n -- 1.7.11.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Ubuntu not including Wayland support for GTK in October release
This is pretty frustrating for me, since I opened the bug five months ago, created a Precise PPA with it enabled and working three months ago, and recently created a Quantal PPA with it enabled, with a very minor change. Apparently what is needed is more testing to make sure there aren't regressions (new things broken) in X with the wayland backend of gtk enabled. Directions to use it with Ubuntu Quantal (which will be released in October) are here: https://launchpad.net/~darxus/+archive/wayland-gtk-quantal The bug is here: https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/954352 Specific things that are believed most likely to break and therefore most in need of testing are: dnd, clipboard, xembed, tray icons. I recommend testing after a reboot. So if you could test and report back, either way, I'd appreciate it. Posting everything works to the bug will, I believe, increase the chances of it being applied to the official Ubuntu archives (eventually). If there are problems, that's just as important - we need to know about them to fix them. Problems with things actually running through wayland are not really relevant to this bug. -- I don't want people who want to dance, I want people who have to dance. --George Balanchine http://www.ChaosReigns.com ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] Wayland X server uses xwayand.conf instead of xorg.conf
From: Bill Spitzak spit...@gmail.com This allows X applications to be run on wayland without having to delete an xorg.conf file that is required to run the normal X server. --- hw/xfree86/common/xf86Init.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index a062929..8afbb2d 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1412,6 +1412,8 @@ ddxProcessArgument(int argc, char **argv, int i) if (!strcmp(argv[i], -wayland)) { xorgWayland = TRUE; +if (!xf86ConfigFile) + xf86ConfigFile = xwayland.conf; return 1; } -- 1.7.9.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
RE: [PATCH] Do not set dpms to standby which cause system could not be resotred when system is locked at the second time.
This patch is invalid. It is special platform issue. sorry From: wayland-devel-bounces+quanxian.wang=intel@lists.freedesktop.org [mailto:wayland-devel-bounces+quanxian.wang=intel@lists.freedesktop.org] On Behalf Of Wang, Quanxian Sent: Friday, August 24, 2012 7:00 PM To: wayland-devel@lists.freedesktop.org Subject: RE: [PATCH] Do not set dpms to standby which cause system could not be resotred when system is locked at the second time. Could not resotred the system. Sorry _ From: Wang, Quanxian Sent: Friday, August 24, 2012 6:57 PM To: wayland-devel@lists.freedesktop.orgmailto:wayland-devel@lists.freedesktop.org Cc: Wang, Quanxian Subject: [PATCH] Do not set dpms to standby which cause system could be resotred when system is locked at the second time. Reproduce this: 1. Weston -i1 and after 1 second, the system go into idle and wait a little while, go to lock status 2. Press key and the screen is fine 3. After 1 second, system go to idle and wait a little while, go to lock status again 4. Whatever you press any key or mouse, you could not restore the system. From Quanxian Wang quanxian.w...@intel.commailto:quanxian.w...@intel.com Do not set dpms to standby which cause system could be restored. diff --git a/src/shell.c b/src/shell.c index 4d6bc4f..1df571b 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2470,10 +2470,6 @@ lock(struct wl_listener *listener, void *data) struct workspace *ws = get_current_workspace(shell); if (shell-locked) { - wl_list_for_each(output, shell-compositor-output_list, link) - /* TODO: find a way to jump to other DPMS levels */ - if (output-set_dpms) - output-set_dpms(output, WESTON_DPMS_STANDBY); return; } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel