summaryrefslogtreecommitdiff
path: root/shared
Commit message (Collapse)AuthorAgeFilesLines
* shared: Print .c file/line number in x* routinesBryce Harrington2016-03-171-24/+4
| | | | | | | | | | | | | Switches from inline to pre-processor definitions in order to utilize __FILE__ and __LINE__ from the .c file in order to display the location of memory allocation failures when failing. Now xmalloc, et al calls will produce: [weston-info] clients/weston-info.c:714: out of memory (1024) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* clients & tests: Unify multiple definitions of x*alloc and related functionsBryce Harrington2016-03-172-0/+124
| | | | | | | | | | | | | Direct fail_on_null calls now produce output like: [weston-info] clients/weston-info.c:714: out of memory xmalloc, et al produce output on failure like: [weston-info] out of memory (-1) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* platform: explicitly cast the return value of ↵Matthias Treydte2016-03-081-4/+6
| | | | | | | | weston_platform_get_egl_proc_address This allows the header to be consumed by C++ compilers, because C++ does away with C's implicit cast from (void*). Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* option-parser: Handle short double-arg optionsBryce Harrington2016-03-081-3/+38
| | | | | | | | | | | | | | weston allows both short and long style options to take arguments. In the case of short options, allow an optional space between the option name and value. E.g., previously you could launch weston this way: weston -i2 -cmyconfig.ini now you can also launch it like this: weston -i 2 -c myconfig.ini Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* configure: Make jpeglib an optional dependency.Emmanuel Gil Peyrot2016-03-071-7/+23
| | | | | | | | | It doesn’t make sense to fail the entire build when jpeglib isn’t present, so this commit makes it optional just like libwebp in the previous one, disabled with --without-jpeg and forced with --with-jpeg. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* config-parser: Check malloc and strdup returnsBryce Harrington2016-02-221-0/+22
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* configure: Make WebP support togglable, and improve its error message.Emmanuel Gil Peyrot2016-02-191-2/+9
| | | | | | | | | | | | | | | The current way was enabling WebP support whenever libwebp was found, giving no way to the user to disable it if they had the library installed but didn’t want to link against it. This adds a --without-webp configure option to never link against it, and a --with-webp one to fail the build if it isn’t found, the default being to use it if it is present. Additionally, we now tell the user when WebP support has been disabled and they try to load a WebP file. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* cairo-util: return theme location from frame_touch_downDerek Foreman2015-12-082-9/+10
| | | | | | | | I'll be using this in a follow up patch that adds touch input to weston's wayland backend. Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* shared: work around EGL header idiosyncrasyAhmet Acar2015-11-131-0/+1
| | | | | | | | | | | | | | | | When no X11 headers are present eglplatform.h will break unless certain defines are set prior to its inclusion. including wayland-egl.h defines WL_EGL_PLATFORM which will stop the attempted inclusion of the X11 headers. Maybe this isn't the best solution to the problem, but it's harmless and gets the job done. Closes bug: https://bugs.freedesktop.org/show_bug.cgi?id=92104 Reviewed-by: Derek Foreman <derekf@osg.samsung.com> (patch by Ahmet Acar, commit log by Derek Foreman)
* log: Open log file CLOEXEC so child processes don't get the fdDerek Foreman2015-07-162-8/+17
| | | | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* compositor,shared: add millihz_to_nsec()Pekka Paalanen2015-07-161-0/+14
| | | | | | | | A helper to improbe readability. Cc: Daniel Stone <daniels@collabora.com> Cc: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* shared: introduce timespec-util.hPekka Paalanen2015-07-161-0/+61
| | | | | | Copyright is set according to the moved code from compositor.c. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Unified multiple definitions of container_of() macro.Jon Cruz2015-06-152-4/+38
| | | | | | | | | 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>
* Moved the MIN() macro to the helper include.Jon Cruz2015-06-151-0/+11
| | | | | | | | | | Removed multiple definitions of the MIN() macro from existing locations and unified with a single definition. Updated sources to use the shared version. 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>
* Moved helper macro to a discrete include file.Jon Cruz2015-06-153-4/+50
| | | | | | | | | | | To help reduce code duplication and also 'kitchen-sink' includes the ARRAY_LENGTH macro was moved to a stand-alone file and referenced from the sources consuming it. Other macros will be added in subsequent passes. 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>
* shared: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington2015-06-1516-256/+304
|
* Whitespace correctionsMurray Calavera2015-06-061-1/+1
| | | | Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
* toytoolkit: fix EGL surface creation for lazy driversManuel Bachmann2015-03-301-2/+3
| | | | | | | | | | | Some DRI drivers, including VMware vmwgfx, do not support calling eglQueryString() with a EGL_NO_DISPLAY parameter. Allow toytoolkit to create EGL surfaces with them, by falling back to the old creation method. Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* toytoolkit: fix new EGL extensions fallback typedefsManuel Bachmann2015-03-301-2/+7
| | | | | | | | | The dummy typedefs for "get_platform_display()" and "create_platform_window()" were badly defined, which prevented building Weston on older systems. Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Pass config file from compositor to everythingPekka Paalanen2015-03-272-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* shared: fail reading a directory as a config filePekka Paalanen2015-03-271-0/+8
| | | | | | | | | | | 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>
* platform: rename create_egl_window to create_egl_surfaceJonny Lamb2015-03-261-6/+6
| | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* platform: remove global variablesJonny Lamb2015-03-261-26/+29
| | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* platform: provide platform_base fallbacks and remove ifdefsJonny Lamb2015-03-261-14/+33
| | | | Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* clients & tests: use eglCreatePlatformWindowSurfaceEXT when supportedJonny Lamb2015-03-201-0/+23
| | | | | Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* clients & tests: use eglGetPlatformDisplayEXT when supportedJonny Lamb2015-03-201-0/+79
| | | | | Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* shared: add file_create_dated() helperPekka Paalanen2015-02-252-0/+158
| | | | | | | | | | | 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>
* cairo-util: fix shadows for small clientsMarek Chalupa2014-11-191-46/+83
| | | | | | | | | | | | | | | | | | | | 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>
* toytoolkit: rename tile_mask to render_shadowMarek Chalupa2014-11-192-8/+8
| | | | | | | | | 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>
* clients: Maximize window when double touch on title barXiong Zhang2014-09-222-0/+56
| | | | Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
* load_image: always print a message on failure if filename is not emptyBill Spitzak2014-09-111-2/+12
| | | | | | | | | | 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>
* parse_options: fail on more malformed optionsBill Spitzak2014-09-111-28/+69
| | | | | | | | | | | | | 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>
* clients: Maximize window when double click on title barXiong Zhang2014-09-042-0/+35
| | | | | Signed-off-by: Xiong Zhang <panda0626@gmail.com> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* tests: allow running make check without make installDerek Foreman2014-08-222-0/+15
| | | | | | | | | | | | | 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>
* cairo-util: Draw solid titlebar for frames with only buttonsBoyan Ding2014-08-193-5/+10
| | | | | | | | 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>
* cairo-util: Set geometry_dirty in frame_set_titleBoyan Ding2014-07-051-0/+1
| | | | | | | | 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>
* cairo-util: Fix geometry for frames with buttons but without titleBoyan Ding2014-07-051-2/+2
| | | | | | | | | | | | 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>
* cairo-util: Don't show a resize cursor on edges when we're maximizedJasper St. Pierre2014-04-301-3/+8
| | | | | | This is substantially confusing to users, namely me. krh: Edited to just set grip size to zero.
* cairo-util: Kill a duplicate testJasper St. Pierre2014-04-301-2/+2
| | | | If !(x < margin), then clearly margin <= x. No need to test for it again.
* Make sure config.h is included before any system headersAndrew Wedgbury2014-04-071-2/+2
| | | | | | | | | | | | | | | 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>
* xdg-shell: Add set_margin requestJasper St. Pierre2014-02-062-0/+11
| | | | | | 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.
* build: Move shared/Makefile.am into toplevel Makefile.amKristian Høgsberg2014-02-011-34/+0
|
* build: Move clients/Makefile.am into toplevel Makefile.amKristian Høgsberg2014-02-011-1/+1
|
* shared/frame: NULL check before attempting to derefU. Artie Eoff2014-01-191-7/+6
| | | | Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
* shared/frame: fix potential memory leak in frame_createU. Artie Eoff2014-01-191-18/+25
| | | | | | | | | | | | | 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>
* os: use posix_fallocate in creating sharable buffersPekka Paalanen2013-12-021-1/+18
| | | | | | | | | | | | | | | | 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>
* cairo-util: Rework frame button handlingJason Ekstrand2013-11-072-42/+122
| | | | | | | | | 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>
* window.c: Don't put titlebars on menu windowsKristian Høgsberg2013-10-233-49/+74
|
* window.c: Use frame code for drawing menusKristian Høgsberg2013-10-232-8/+20
| | | | This gives us a nice frame and drop shadows for the menus.
* Use cairo-util frame in tinytoolkitJason Ekstrand2013-10-142-1/+97
| | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>