Commit graph

84 commits

Author SHA1 Message Date
Pekka Paalanen 49f6d62e9d shared: fail reading a directory as a config file
open() will happily open directories and other non-normal files.
Attempting to parse them as config files makes no sense, so check that
the opened file is indeed a regular 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:02 +02:00
Jonny Lamb abff883d2c platform: rename create_egl_window to create_egl_surface
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 759fbf4d0f platform: remove global variables
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 0e2ab36df7 platform: provide platform_base fallbacks and remove ifdefs
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 4bdcb5732b clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:57:24 -07:00
Jonny Lamb 51a7ae5f89 clients & tests: use eglGetPlatformDisplayEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:56:38 -07:00
Pekka Paalanen 899b50b126 shared: add file_create_dated() helper
For easy creation of unique new files. I'm looking at you,
screenshooter.

This code is based on timeline.c weston_timeline_do_open().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-02-25 14:47:50 +02:00
Marek Chalupa eaea470510 cairo-util: fix shadows for small clients
If the client is small (< 128 pixels in any ward),
then the shadows overlap and create dark lines behind clients.
This is a problem mosly with pop-up menues. The lines become observable
when the menu has less than three items. The other case is when
the client doesn't restrict its size when resizing (try
'weston-eventdemo --max-width=1 --max-height=1' for example)

This fixes a part of the bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78511

v2:
  - rework computing of the size of corners
  - rewrite some comments
  - rename tile_mask to render_shadow (in separate patch)

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-19 15:46:30 +02:00
Marek Chalupa 0d7fe8d925 toytoolkit: rename tile_mask to render_shadow
This function is used and clearly designed only for drawing the shadows.
Rename it so that it has name after what it does and also move some
common code into the function.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-19 15:39:36 +02:00
Xiong Zhang 382de46a2f clients: Maximize window when double touch on title bar
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2014-09-22 10:19:44 +03:00
Bill Spitzak 28371f7d55 load_image: always print a message on failure if filename is not empty
It was rather inconsistent before. This may help users figure out why
backgrounds and icons don't show up. A better api where the error can
be queried might be nice, but this seems sufficient for current Weston use.

[Pekka Paalanen: removed one stray space.]

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 13:01:47 +03:00
Bill Spitzak 3011493e9b parse_options: fail on more malformed options
Fail on trailing text after numbers, such as --width=100mm

Fail on any text after booleans, such as --flag=false

Also fixed reading of memory after the null terminator of a long
option with no = sign in it.

[Pekka Paalanen: some whitespace style fixes.]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 12:36:55 +03:00
Xiong Zhang bfb4ade1a0 clients: Maximize window when double click on title bar
Signed-off-by: Xiong Zhang <panda0626@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 17:11:22 +03:00
Derek Foreman c7210434d4 tests: allow running make check without make install
desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed.  make check will
currently either fail or run pre-existing versions.

This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 17:47:33 +03:00
Boyan Ding 850a514137 cairo-util: Draw solid titlebar for frames with only buttons
Previously geometry was changed to leave space for titlebar if a frame
has only buttons but no title. This patch fixes theme_render_frame to
avoid transparent titlebar.

Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-08-19 16:45:15 +03:00
Boyan Ding 9c5aedfff2 cairo-util: Set geometry_dirty in frame_set_title
Title can decide the geometry of a frame because it may affect the
existence of titlebar, so setting geometry_dirty in frame_set_title for
potential change.

Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-07-05 01:05:07 -07:00
Boyan Ding c4902124f9 cairo-util: Fix geometry for frames with buttons but without title
There exist frames which have buttons without title such as a simple
X application piped through xwayland which doesn't specify a title.
We draw the title bar with buttons, but hide it under the window
because geometry thinks a window needs titlebar only if it has title.

This patch change the condition, making it titlebar is needed if a
frame has title or has button(s), which makes more sense.

Signed-off-by: Boyan Ding <stu_dby@126.com>
2014-07-05 01:05:06 -07:00
Jasper St. Pierre f11ad43ed0 cairo-util: Don't show a resize cursor on edges when we're maximized
This is substantially confusing to users, namely me.

krh: Edited to just set grip size to zero.
2014-04-30 21:02:37 -07:00
Jasper St. Pierre a4d9723341 cairo-util: Kill a duplicate test
If !(x < margin), then clearly margin <= x. No need to test for it again.
2014-04-30 20:54:01 -07:00
Andrew Wedgbury 9cd661e746 Make sure config.h is included before any system headers
There was an issue recently in screen-share.c where config.h was not
being included, resulting in the wrong definition for off_t being used on
32 bit systems. I checked and I don't think this problem is happening
elsewhere, but to help avoid this sort of problem in the future, I went
through and made sure that config.h is included first whenever system
headers are included.

The config.h header should be included before any system headers, failing
to do this can result in the wrong type sizes being defined on certain
systems, e.g. off_t from sys/types.h

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-04-07 10:22:28 -07:00
Jasper St. Pierre 7407345446 xdg-shell: Add set_margin request
This is used to figure out the size of "invisible" decorations, which we'll
use to better know the visible extents of the surface, which we can use for
constraining, titlebars, and more.
2014-02-06 13:05:03 -08:00
Kristian Høgsberg 0987f81ee9 build: Move shared/Makefile.am into toplevel Makefile.am 2014-02-01 01:05:35 -08:00
Kristian Høgsberg e73eccdb66 build: Move clients/Makefile.am into toplevel Makefile.am 2014-02-01 01:05:33 -08:00
U. Artie Eoff 6d71c3c05a shared/frame: NULL check before attempting to deref
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:16:58 -08:00
U. Artie Eoff 107de96ba7 shared/frame: fix potential memory leak in frame_create
In frame_create, we need to destroy any frame buttons created
in preceding calls to frame_button_create during the function
execution if any of the successive calls to frame_button_create
fail.

This has minimal severity since most, if not all, cases in
frame_button_create that result in a fail (i.e. NULL result) means
a program is OOM and the program will have to exit/abort anyway.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:07:07 -08:00
Pekka Paalanen 5b4ddbc11e os: use posix_fallocate in creating sharable buffers
If posix_fallocate is available, use it instead of ftruncate. Unlike
ftruncate, when posix_fallocate succeeds, it guarantees that you cannot
run out of disk space, when later writing to the mmap()'ed file.

With posix_fallocate, if os_create_anonymous_file() succeeds, the
program cannot get a SIGBUS later from accessing this file via mmap. If
there is insufficient disk space, the function fails and errno is set to
ENOSPC.

This is useful on systems, that limit the available buffer space by
having XDG_RUNTIME_DIR on a small tmpfs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-12-02 16:20:27 -08:00
Jason Ekstrand 0bdd58f6c0 cairo-util: Rework frame button handling
This makes button handling more correct concerning drags.  Also,
frame_pointer_button returns the original button location in the case of a
release.  This makes filtering of button events much easier for users of
the cair-util frame code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:35:06 -08:00
Kristian Høgsberg 89f4bc4fc4 window.c: Don't put titlebars on menu windows 2013-10-23 22:12:13 -07:00
Kristian Høgsberg c680e90489 window.c: Use frame code for drawing menus
This gives us a nice frame and drop shadows for the menus.
2013-10-23 21:49:30 -07:00
Jason Ekstrand 3f66cf92ed Use cairo-util frame in tinytoolkit
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-14 12:27:55 -07:00
Jason Ekstrand 01c9ec3477 Add decoration frame support to cairo-util
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Alexandru DAMIAN 5f42930a41 config: Don't crash if we don't have a config file
Adding a check in weston_config_full_path so that
we don't crash if we started without a config file.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
2013-09-26 16:24:33 -07:00
Kristian Høgsberg eeefc9e311 compositor: Log the full path of the config file we're using 2013-09-21 23:17:35 -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
Kristian Høgsberg 81c2c2eb5e shared: Remove no longer used parse_config_file() 2013-09-21 23:05:12 -07:00
Armin K b502f906db evdev-touchpad: Set some options using weston.ini
This patch adds 3 new options to weston.ini to allow
the user to change default constant_accel_factor,
min_accel_factor and max_accel_factor. If no options
are set, it falls back using defaults as it did before.

v2: create weston_config_section_get_double and use it
instead of manualy converting string to double.

v3: add default values in weston_config_get_double
instead of using conditionals.

v4: don't pass diagonal as pointer.
2013-08-12 22:42:17 -07:00
Peter Hutterer b1bc4a68b0 Add zalloc(size_t) allocator function
Same as calloc(1, len).
2013-08-08 13:46:13 -07:00
Kristian Høgsberg c0bf8173dd shared: Add out-of-memory handling to theme_create() 2013-07-25 15:54:20 -07:00
Quentin Glidic d2d70f2aeb tests: Move config-parser.test to tests/
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2013-07-08 18:14:04 -04:00
Quentin Glidic 6e2c12496b shared: Export configuration functions
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2013-07-03 18:28:59 -04:00
Pekka Paalanen d7bc6351f8 shared: build fix for config-parser test
One more wayland-util.h not found issue, triggered by having libwayland
installed to a custom prefix.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2012-02-07 17:47:01 -05:00
Daniel Stone c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Pekka Paalanen ab5dd94c93 shared: fix build of libshared-cairo
Another case of missing wayland-util.h, as we didn't pass any libwayland
CFLAGS. This is triggerable on a system, where libwayland is installed
in a custom prefix, and pixman, cairo, libpng, and webp are either
not installed or are installed in the standard path.

COMPOSITOR_CFLAGS contains more than just the libwayland CFLAGS, though.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-06-04 23:16:49 -04:00
Kristian Høgsberg 82189f7abd config-parser: Add tests for expect behavuor on NULL configs and sections 2013-05-28 15:34:46 -04:00
Mun Gwan-gyeong 7732540f71 config-parser: Avoid null dereference when exiting. (case: weston starts without config file.)
backtrace:
 (gdb) bt
 #0  0xb7704424 in __kernel_vsyscall ()
 #1  0xb757ddde in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
 #2  <signal handler called>
 #3  weston_config_destroy (config=0x0) at config-parser.c:508
 #4  0xb75cbc0e in x11_destroy (ec=0x93506b0) at compositor-x11.c:1473
 #5  0x0804e0e9 in main (argc=1, argv=0xbffe5354) at compositor.c:3337
2013-05-28 15:30:27 -04:00
Mun Gwan-gyeong 151a52834e config-parser: Avoid null dereference when handling config-parser ( when weston starts without config file. )
backtrace:
 (gdb) bt
 #0  weston_config_next_section (config=0x0, section=0xbfb2b608, name=0xbfb2b618) at config-parser.c:485
 #1  0xb75b1371 in x11_compositor_create (config=0x1, argv=0xbfb2ba44, argc=<optimized out>, use_pixman=0, no_input=0, fullscreen=0, display=0xb75b55f9)
    at compositor-x11.c:1582
 #2  backend_init (display=0x8354490, argc=0xbfb2b9b0, argv=0xbfb2ba44, config=0x0) at compositor-x11.c:1674
 #3  0x0804df7b in main (argc=1, argv=0xbfb2ba44) at compositor.c:3289
2013-05-28 15:30:14 -04:00
Kristian Høgsberg f73f316248 config-parser: Add section iterator API
The X backend needs to iterate through all outputs.
2013-05-26 20:50:53 -04:00
Mun Gwan-gyeong 72a3ab7b85 config-parser: Avoid null dereference when handling config-parser
backtrace:
 (gdb) bt
 #0  weston_config_get_section (config=0x0, section=0x8062f31 "keyboard", key=0x0, value=0x0)
     at config-parser.c:265
 #1  0x080535a1 in weston_compositor_init (ec=0x905b690, display=0x9056490, argc=0xbf8bd2f0,
     argv=0xbf8bd384, config_fd=-1) at compositor.c:2819
 #2  0xb75d72bb in x11_compositor_create (config_fd=-1, argv=0xbf8bd384, argc=<optimized out>,
     use_pixman=0, no_input=0, fullscreen=0, display=0x9056490) at compositor-x11.c:1527
 #3  backend_init (display=0x9056490, argc=0xbf8bd2f0, argv=0xbf8bd384, config_fd=-1)
     at compositor-x11.c:1746
2013-05-26 20:07:47 -04:00
Mun Gwan-gyeong d664196cfb config-parser-test: fix compile error
Add COMPOSITOR_CFLAGS to Makefile.am
2013-05-26 20:04:28 -04:00
Kristian Høgsberg 732747114a Add new config parser
The current config parser, parses the ini file and pulls out the values
specified by the struct config_section passed to parse_config_file() and
then throw the rest away.  This means that every place we want to get
info out of the ini file, we have to parse the whole thing again.  It's not
a big overhead, but it's also not a convenient API.

This patch adds a parser that parses the ini file to a data structure and
puts that in weston_compositor->config along with API to query comfig
keys from the data structure.  The old parser is still available, but
we'll transition to the new approach over the next few commits.
2013-05-23 21:25:42 -04:00