Bug 57583 - desktop-shell panel clock should be configurable
Summary: desktop-shell panel clock should be configurable
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: weston (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-26 23:53 UTC by Joe Konno
Modified: 2016-03-11 11:00 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Joe Konno 2012-11-26 23:53:09 UTC
As mentioned in bug #57562, the desktop-shell panel clock ought to be configurable. Krh put the following ideas forward:

  1) panel clock configurable by a string enum-- user can specify none/minutes/seconds

  2) panel clock configurable by a strftime() string with 'none' as a special case

The second option would require more input validation than the first, but either is possible.
Comment 1 Scott Moreau 2012-11-27 19:19:03 UTC
(In reply to comment #0)
> As mentioned in bug #57562, the desktop-shell panel clock ought to be
> configurable. Krh put the following ideas forward:
> 
>   1) panel clock configurable by a string enum-- user can specify
> none/minutes/seconds
> 
>   2) panel clock configurable by a strftime() string with 'none' as a
> special case
> 
> The second option would require more input validation than the first, but
> either is possible.


I looked into this and wrote a patch to make the clock format configurable. When I did this I noticed the the width allocated for the clock is hard coded to 170. I figured it would make sense to determine the width based on the text extents from cairo. However when I tried this I noticed an oddity in toytoolkit where window_get_surface() returns NULL before the first redraw (because window_set_surface() is called from window_create_surface() which creates a surface on each redraw). This means that there is no valid cairo surface available from window_get_surface() when the first widget resize is called. I managed to get it working by calling window_create_surface() when the window is created in toytoolkit, but this requires setting a non-zero allocation size. It does not necessarily have to be a valid size, just something that allows us to create the initial cairo_surface. (i.e. width=1, height=1 works)

Kristian suggested we can make font configurable too.

One other thing I will mention here is the clock update timer must be configured based on the format. The default is 60 seconds, but for formats including types such as "%s", "%S" and "%T", the timer then needs to be set to fire every second. The function I wrote uses strstr() to check for these but maybe there's a better way to solve this problem.

I am not posting a patch at this time, because of these issues.
Comment 2 Pekka Paalanen 2012-11-28 07:27:23 UTC
Getting the text extents should not be a problem after this hack:
http://cgit.freedesktop.org/wayland/weston/commit/?id=3cbb08944b06c9df2da3247a74be96172de81054
Comment 3 Pekka Paalanen 2016-03-03 09:11:08 UTC
This is being worked on by Armin Krezović:
https://patchwork.freedesktop.org/patch/75664/
Comment 4 Armin K 2016-03-11 11:00:26 UTC
This has been implemented in weston in the following commit:

c6a55db desktop-shell: make panel clock configurable


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.