Commit Graph

128 Commits

Author SHA1 Message Date
Armin Krezović c6a55dbf04 desktop-shell: make panel clock configurable
This patch enhances the panel clock by adding a config file
option which can be used to either disable the clock or make
it also show seconds in the current clock format.

v2: Implement suggestions from Pekka:
    - Include Signed-off-by
    - Coding style fixes
    - Implement clock widget allocation by using
      width from cairo_text_extents
    - Highlight config option values in man page
v3: Implement suggestions from Pekka and Bryce:
    - Use CLOCK_FORMAT_* instead of FORMAT_* in the enum
    - Switch to using fixed clock widget size instead
      of one returned from cairo_text_extents
    - Fixes to config option highlighting in the man page
v4: Implement more suggestions from Pekka and Bryce:
    - Improve patch changelog
    - Move the check for CLOCK_FORMAT_NONE into the
      caller function
    - Fix a memory leak in panel_create introduced by
      previous revision of this patch

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57583
Signed-off-by: Armin Krezović <armin.krezovic@fet.ba>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-10 14:58:16 -08:00
Bryce Harrington 0d1a622375 clients: Use zalloc
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-09 22:54:54 -08:00
Jonas Ådahl 6d6fb61a32 desktop-shell: Rename protocol weston_desktop_shell
In the effort of going away from generic names of protocols only
relevant for weston, rename the weston desktop shell
weston_desktop_shell.

This also resets the version to 1, as there will be no prior versions
to weston_desktop_shell.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 14:58:58 +02:00
Jon Cruz 867d50eea7 Unified multiple definitions of container_of() macro.
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:58 -07:00
Jon Cruz 4678bab13c Remove redundant #include path component.
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:09 -07:00
Bryce Harrington 1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Michael Vetter 2a18a52844 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:12:32 -07:00
Dima Ryazanov cead794101 desktop-shell: Remove the panel popup
It doesn't work anymore, and it never did anything useful.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-13 15:27:14 +03:00
Pekka Paalanen 6c71aaeec5 Pass config file from compositor to everything
We have the Weston command line option '--no-config' which is meant to
prevent loading weston.ini at all. It works for Weston itself, but it
does not work for any clients that also want to read weston.ini.

To fix that, introduce a new environment variable WESTON_CONFIG_FILE.
Weston will set it to the absolute path of the config file it loads.
Clients will load the config file pointed to by WESTON_CONFIG_FILE. If
the environment variable is set but empty, no config file will be
loaded. If the variable is unset, things fall back to the default
"weston.ini".

Note, that Weston will only set WESTON_CONFIG_FILE, it never reads it.
The ability to specify a custom config file to load will be another patch.

All programs that loaded "weston.ini" are modified to honour
WESTON_CONFIG_FILE.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-27 09:38:12 +02:00
Arnaud Vrac fb754a0a05 desktop-shell: properly set background widget as opaque
Toytoolkit resets the opaque region which was set manually using the
wayland protocol directly, so use the widget API instead.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-28 13:41:00 +03:00
Jonny Lamb e67118c80a desktop-shell: add option to avoid creating the panel
This option is so we can disable showing any panel at all. The default
is to continue showing the panel and no example is added to weston.ini
because it's an uncommon request.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 13:26:41 +03:00
Jasper St. Pierre dda9313bd9 clients: Remove the window / user parameters from the menu function
We want the ability to create a detached menu.
2014-05-18 13:54:15 -07:00
Bill Spitzak 79b7cb3ee3 desktop-shell: Fix black edges on scaled desktop pattern
Filter sampling outside the source image can leak black into the edges
of the
desktop image. This is most easily seen by scaling the default tiled image
with this weston.ini:

	# no background-image and no background-color
	background-type=scale-crop
2014-05-09 14:03:05 -07:00
Kristian Høgsberg 4c3661fd7b desktop-shell: Only use default background if no background color is set
Previously we would only use the set background color if the
background-image value was explicitly set to empty or a non-existing
image.  With this change, we only load the default background image
if there's no configure background image or background color.  In case
of both an image and a color, the image takes precedence as before.
2014-04-21 22:54:37 -07:00
U. Artie Eoff 3c946779df clients/desktop-shell: check OOM conditions
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:12 -08:00
Kristian Høgsberg 4598f965fa desktop-shell: Remove debug code from previous commit 2014-01-01 16:32:09 -08:00
Kristian Høgsberg 7c4f6cc145 shell: Only assign focus on click if there is a pointer focus surface
If we don't have a background image from the desktop-shell client or the
pointer for some other reason doesn't have a focus we trigger a
segfault as we try to deref the seat->pointer->focus NULL pointer.

https://bugs.freedesktop.org/show_bug.cgi?id=73066
2014-01-01 16:28:32 -08:00
Xiong Zhang 83d8ee779e window, desktop-shell: deal with output unplug on client side
when output is removed, weston-desktop-shell should destroy panel
and background surface on destroyed output.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-10-23 22:36:37 -07:00
Kristian Høgsberg 67b8215bcb terminal: Add context menu with new terminal/copy/paste 2013-10-23 16:52:05 -07:00
Jason Ekstrand ee7fefcffc Rename frame_create and frame_set_child_size with a window_ prefix
This is to avoid a collision with an actual frame structure.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Kristian Høgsberg 6a11a8ab54 Revert "Resize the shell when the mode is switched"
This breaks panel resizing as it doesn't account for output rotation.

https://bugs.freedesktop.org/show_bug.cgi?id=70249

This reverts commit a356f7b1ef.
2013-10-09 15:23:16 -07:00
Hardening a356f7b1ef Resize the shell when the mode is switched
Resize the panel and the background when we're notified of a mode
switch.
2013-09-29 14:23:54 -07:00
Kristian Høgsberg 1abe0486bb config-parser: Make weston_config_parse() tkae a file name
Take a basename of the config file to parse instead of an fd.
2013-09-21 23:05:45 -07:00
Brian J Lovin c4df4082c2 desktop-shell: Add support for touch unlock
Add support for unlocking on touch up using the
green button on the unlock dialog

Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
2013-08-26 22:11:11 -07:00
Rusty Lynch 1084da506e Add touch support for wl_shell_surface_move 2013-08-16 10:56:00 -07:00
Rusty Lynch 4384a24a9e desktop-shell: Add touch support to panel launcher icons 2013-08-12 16:54:10 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Tomeu Vizoso bee45a14cd window: Allow hinting of a preference for RGB565 when creating a window
And check if the renderer supports the RGB565 format for wl_shm buffers
before creating the cairo surface and requesting the buffer.

It can save quite some memory with big surfaces such as desktop
backgrounds.
2013-08-06 16:49:27 -07:00
Rob Bradford 09252d4b5e desktop-shell: Refactor launcher configuration reading to avoid leaking 2013-07-30 11:06:42 -07:00
Kristian Høgsberg b886212545 Use xmalloc in desktop-shell.c 2013-07-25 16:44:45 -07:00
Ander Conselvan de Oliveira e492549536 desktop-shell: Don't crash on output hotplug
The panel and background were never created for hotplugged outputs and
since some parts of the code assume that they always exist that would
lead to desktop-shell client to crash in that case.

This was easier to spot when the display was locked, because Weston
respawns the shell client and the user might not notice since there is
no flicker.

https://bugs.freedesktop.org/show_bug.cgi?id=66531
2013-07-05 16:48:32 -04:00
Ander Conselvan de Oliveira 6d75da7906 desktop-shell: Adapt to the new config parser API
This lets the code for adding panel launchers and setting up the
background to be moved into panel_* and background_* functions.

Note that this changes the behavior of the default launcher. Before
this change a default launcher would be added only if there was no
config file. Now a launcher is also added if there is no valid
launcher section.
2013-07-05 16:47:29 -04:00
Alexander Larsson edddbd14ac Convert all scales to int32_t
The type changed in the protocol, so update weston for this.
2013-05-28 15:27:45 -04:00
Pekka Paalanen a402b0567f desktop-shell: new wallpaper mode scale-crop
Scale-crop mode scales the wallpaper to tightly fill the whole output,
but preserving wallpaper aspect ratio. If aspect ratio differs from the
output's, the wallpaper is centered cutting it from top/bottom or
left/right.

Add this to the weston.ini man page, and explain all three modes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 18:07:30 -04:00
Pekka Paalanen 79346ab3a5 shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.

To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.

If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.

shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 18:07:30 -04:00
Alexander Larsson c584fa60d4 desktop-shell: Respect output scale and translate
We pick the window scale/tranform based on what the output uses, which means
we can avoid rotations in the compositor, and get sharper rendering
in scaled outputs.
2013-05-22 16:18:42 -04:00
Ossama Othman a50e6e4c50 config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config.  This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.

To avoid a TOCTOU race the config file is actually open()ed during the
search.  Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
2013-05-14 14:36:37 -04:00
Philipp Brüschweiler 96386b8e5e desktop-shell: better error logging
v2: only call cairo_surface_status once
2013-04-15 20:57:55 -04:00
Kristian Høgsberg 4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Pekka Paalanen 9564c75163 desktop-shell: background should be opaque
Toytoolkit does not support setting opaqueness for anything else than
the immediate child widget of the frame widget. Backgrounds do not have
frames, so we need to poke it in manually.

This should allow Weston to paint the background without blending.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:59:23 -04:00
Kristian Høgsberg fa80e11c84 Update to new fd and wl_registry APIs
This commit updates the clients and the wayland compositor backend to
use the new wl_registry mechanism and the thread safe fd API.
2012-10-10 21:34:38 -04:00
U. Artie Eoff 44874d9f02 desktop-shell: destroy data before exiting.
desktop-shell never returned from display_run() since it
was essentially killed when weston exited.  To fix this,
it is necessary to watch for EPOLLHUP in window.c so that
toytoolkit clients will return from display_run() when
weston quits.  This allows for clients to clean up
as needed.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:37:40 -04:00
Philipp Brüschweiler 467668c9a4 desktop-shell: don't segfault on invalid icon path
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
2012-08-29 15:31:25 -04:00
Philipp Brüschweiler 16d59d7780 desktop-shell: respect CURSOR_NONE as grab cursor 2012-08-29 15:12:57 -04:00
Pekka Paalanen b6df4f7de4 desktop-shell: use the standard 'environ' variable
The variable '__environ' seems to be libc implementation specific, and
not avaible on Android.

Use the POSIX standard variable 'environ', which also luckily happens to
be available on Android, which is not POSIX.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:36 -04:00
Kristian Høgsberg d1936b9e2b desktop-shell: Break command lines into env vars, executable and arguments
We now support specifying environment variables and arguments in launchers
by saying

  path=GDK_BACKEND=wayland gnome-terminal --full-screen

for example.

https://bugs.freedesktop.org/show_bug.cgi?id=47920
2012-07-23 22:59:33 -04:00
Scott Moreau ec116022ec desktop-shell: Declare grab_cursor as enum cursor_type. 2012-07-23 10:48:45 -04:00
Ander Conselvan de Oliveira 07a91cd9fd desktop-shell: Don't get a shell surface for the grab surface
The grab surface does not depend on any of the shell surface
functionality, so don't allocated one.
2012-07-16 13:35:26 -04:00
Martin Olsson 8df662ad87 clients: Silence 2x gcc 4.6.3 "warn_unused_result" compiler warnings
window.c:1173:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
desktop-shell.c:305:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
2012-07-09 17:50:46 -04:00
Ander Conselvan de Oliveira b9d2a0fc0a shell: Show approprite cursors during move and resize grabs
This patch expands the busy cursor mechanism so that it is possible for
the desktop-shell client to show the appropriate cursor during grabs.
2012-06-28 14:13:57 -04:00