summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* scanner: don't emit the extern declarations for external typesGiulio Camuffo2015-06-011-7/+3
| | | | | | | | | | | | | | | | | We were emitting the extern declarations of all types used in the protocol, even if not defined in it. This caused warnings to be produced when using the -Wredundant-decls compiler flag when building an extension that uses e.g. wl_surface. However we only need the extern declarations if the protocol defines a factory for those external interfaces. That is a bad design and can be however done by including the dependent protocol header first. So only emit the extern declarations for the types that the protocol actually defines, this restoring the behavior we were using in 1.7. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=90677 Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Arnaud Vrac <rawoul@gmail.com>
* remove trailing whitespacesMichael Vetter2015-05-151-1/+1
| | | | | 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.
* scanner: simplify the getopt logicPekka Paalanen2015-05-081-30/+14
| | | | | | | | Use the same retvals for both short and long options. Whitespace fixes. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: add a new --include-core-only optionGiulio Camuffo2015-04-301-59/+149
| | | | | | | | | | | | | | | When using this new option the generated code will include the new core headers instead of the old ones. The default needs to remain unchanged for backward compatibility with old code. With this change the generated headers will now forward declare all types and interfaces it uses; that is needed when generating headers for a my-extension.xml with --include-core-only, since it may use types defined in wayland.xml. The same is done also without --include-core-only, since it is an harmless change. getopt_long() is used for the option handling. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* wayland-egl: add a core headerGiulio Camuffo2015-04-302-28/+57
| | | | | | | | The new core header doesn't include any other header, since it really is not needed. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* introduce new headers wayland-client-core.h and wayland-server-core.hGiulio Camuffo2015-04-304-526/+603
| | | | | | | | | | | | | | | | wayland-client.h and wayland-server.h include the protocol headers generated at build time. This means that a libwayland user cannot generate and use protocol code created from a wayland.xml newer than the installed libwayland, because it is not possible to only include the API header. Another use case is language bindings, which would generate their own protocol code and which only need to use the library ABI, not the generated C code. This commit adds wayland-client-core.h and wayland-server-core.h which do not include the protocol headers or any deprecated code. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: Fail on empty enumerationsJonas Ådahl2015-04-081-0/+4
| | | | | | | | | | | Without this patch, the scanner would generate invalid C which wouldn't compile anyway, so lets be nice and fail earlier and point out where the error is. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: David Fort <contact@hardening-consulting.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Add support for direct file reading and writing in wayland-scanner.Jussi Pakkanen2015-03-271-5/+21
| | | | | | | | Add support for direct file reading and writing in wayland-scanner. Signed-off-by: Jussi Pakkanen <jpakkane@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Acked-by: David Fort <rdp.effort@gmail.com>
* Spelling fixes (cosmetic)Bryce Harrington2015-03-192-3/+3
| | | | | | | | | | | | | | | | A few typos in comments and protocol docs, no code changes. ./src/wayland-util.h:281: recieved ==> received ./src/wayland-client.c:115: occured ==> occurred ./src/wayland-client.c:156: occured ==> occurred ./tests/test-compositor.c:76: parallely ==> parallelly ./tests/test-compositor.c:474: recieve ==> receive ./protocol/wayland.xml:1767: layed ==> laid ./protocol/wayland.xml:2112: dependant ==> dependent ./doc/publican/sources/Client.xml:25: recieved ==> received Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Bill Spitzak <spitzak@gmail.com>
* server: give more precise error messageMarek Chalupa2015-03-191-5/+6
| | | | | | | | | There are two same error messages with different cause. Let user know what is the cause of the error. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* client: Fix typoBryce Harrington2015-03-181-1/+1
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* event-loop: Dispatch idle callbacks twiceDerek Foreman2015-01-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | To fix a shutdown crash in weston's x11 compositor I want to move the weston X window close to an idle handler. Since idle handlers are processed at the start of an event loop, the handler that deals with window close will run at the start of the next input_loop dispatch, after which the dispatcher blocks on epoll forever (since all input events that will ever occur have been consumed). Dispatching idle callbacks both at the start and end of event-loop processing will prevent this permanent blocking. Note that just moving the callback dispatch could theoretically result in an idle callback being delayed indefinitely while waiting for epoll_wait() to complete. Callbacks are removed from the list when they're run, so the second dispatch won't result in any extra calls. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* client: unref or destroy proxy when releasing queueMarek Chalupa2015-01-281-43/+60
| | | | | | | | When we release event queue with queued events, we can leak proxies in some cases. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* client: release display queue in wl_display_disconnect()Marek Chalupa2015-01-281-0/+1
| | | | | | | Don't leak events, not even on exit Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* scanner: Fix header generation for server protocolsMariusz Ceier2015-01-271-1/+1
| | | | | | | | | | Server protocols headers should include wayland-server.h, instead of wayland-util.h. Otherwise they're not useable with C++ compiler unless wayland-server.h was included earlier. Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* cosmetic: Cleanup trailing whitespaceBryce Harrington2015-01-261-15/+15
|
* cosmetic: Move the deprecated functions back to the end of the fileDerek Foreman2015-01-261-50/+55
| | | | | | | | | | There are functions below the "Deprecated functions below" comment that are not deprecated. Move the deprecated functions back down, and add a comment at the end of the file to try to keep this from happening again. Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* doc: made functions taking wl_event_queue arg belong to wl_event_queueBill Spitzak2015-01-231-4/+19
| | | | | | | | | | The fact that these functions take both a display and queue argument is I think historical, and they really are methods on the queue. Also added some docs for wl_display_prepare_read_queue. Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* doc: Remove wl_map from documentationBill Spitzak2015-01-231-0/+4
| | | | | | | | This object is only in wayland-private.h so it's methods should not be in the documentation. Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* doc: Remove deprecated functions from documentationBill Spitzak2015-01-231-1/+3
| | | | | Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* doc: add missing \memberof to wl_display_get_protocol_errorBill Spitzak2015-01-231-4/+3
| | | | | Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* server: Use existing id variable when inserting created objectJonas Ådahl2015-01-231-3/+2
| | | | | | | | We already have the id variable there and it makes it slightly easier to read. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* client: update documentation about threadingMarek Chalupa2014-12-091-36/+116
| | | | | | | | | | | | | | | | | | | | | | | Remove out-dated documentation and add few more words about this topic. v2. replace a paragraph by better explanation from Pekka Paalanen fix other notes from reviewing v3. fix typo v4. fix flags for poll in an example add wl_display_cancel_read() to another example (so that user sees that it should be used) move proper use of wl_display_prepare_read before the explanation why it is wrong to use wl_display_displach Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* client: update obsolete commentsMarek Chalupa2014-12-092-46/+62
| | | | | | | | | | | | | | | | | | | | | 1) there is nothing like main thread since 3c7e8bfbb4745315b7bcbf69fa746c3d6718c305 anymore, so remove it from documentation and update the doc accordingly. 2) use calling 'default queue' instead of 'main queue'. In the code we use display->default_queue, so it'll be easier the understand. 3) update some obsolete or unprecise pieces of documentation v2. Not only remove out-of-date comment, but fix/remove more things across the wayland-client.[ch] v3. fixes (rephrasing unclear paragraphs etc.) according to Pakka Paalanen notes (thanks) Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* scanner.c: Use WL_PRINTF instead of __attribute__((format(printf)))Seedo Eldho Paul2014-11-281-1/+1
| | | | Signed-off-by: Seedo Eldho Paul <seedoeldhopaul@gmail.com>
* doc: fixed grammar and a typoDerek Foreman2014-11-271-2/+2
| | | | Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
* doc: Removed extra indentation from wl_list code sampleBill Spitzak2014-11-261-4/+4
| | | | | | | This is a minor documentation fix. I did not see any asterisks in the output as reported by Pekka Paalanen. Using doxygen 1.7.6.1. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* doc: Removed \ref when it refers to the subject the text is attached toBill Spitzak2014-11-252-6/+6
| | | | | | | This does not make a difference to doxygen output but may help other document generators not make redundant links. Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* doc: fixed a typoBill Spitzak2014-11-251-1/+1
| | | | Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* v4 doc: fixed reference to non-existent functionBill Spitzak2014-11-251-3/+0
| | | | | | | | | | | | (Fixed to remove accidental commit of another change) After some feedback from Marek Chalupa I decided to just remove this. There were suggestions about warning about multiple threads but it appears this would be true for many of these functions and thus it would be misleading to mention multiple threads only here (as it would imply that multiple threads work for other functions which is not true, I think). Acked-by: Marek Chalupa <mchqwerty@gmail.com>
* doc: Added \code tags around sample code in doxygen commentsBill Spitzak2014-11-253-31/+32
| | | | | | | Also removed \comment and used C++ comments. There does not appear to be any other way to put comments into code samples. Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* server: increase listen queue to 128Imran Zaman2014-11-241-1/+1
| | | | | | | | | | | This will allow more than 1 simultaneous client connections to the server without the possibility of connection refused error. Signed-off-by: Imran Zaman <imran.zaman@gmail.com> http://utcc.utoronto.ca/~cks/space/blog/unix/ListenBacklogMeaning http://stackoverflow.com/questions/19221105/connect-with-unix-domain-socket-and-full-backlog Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* client: read_events should return -1 after an errorMarek Chalupa2014-11-211-0/+5
| | | | | | | | | | | | | | | | | When a thread is sleeping, waiting until another thread read from the display, it always returns 0. Even when an error occured. In documentation stands: "return 0 on success or -1 on error. In case of error errno will be set accordingly" So this is a fix for this. Along with the read_events, fix a test so that it now complies with this behaviour (and we have this tested) Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* gitignore: adpat to scanner and protocol path changesOlivier Blin2014-11-191-4/+0
| | | | | | | | | | | Since commit 4c163b9b001bd93aaf97d7e962873a379eb90bfd, wayland-scanner is built in top builddir instead of src, and protocol files are generated in protocol subdir instead of src. Protocol files generated in the new path are already properly ignored in the toplevel gitignore file. Signed-off-by: Olivier Blin <olivier.blin@softathome.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* connection: abort if a listener function is NULLRyo Munakata2014-11-121-0/+5
| | | | | Signed-off-by: Ryo Munakata <ryomnktml@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Remove useless semicolon.Carlos Olmedo Escobar2014-11-121-1/+1
| | | | | Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
* doc: Added API documentation for wl_display_destroy and ↵Srivardhan Hebbar2014-11-111-0/+38
| | | | | | | | wl_display_add_socket functions. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> [Pekka Paalanen: minor re-wording.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* Don't document an absent parameter.Bryce Harrington2014-11-111-1/+0
| | | | | | | | | Quells a doxygen warning: src/wayland-server.c:790: warning: argument 'None' of command @param is not found in the argument list of wl_display::wl_display_create(void) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* scanner, client: Added more error checks when strtol function is usedImran Zaman2014-11-102-2/+7
| | | | | Signed-off-by: Imran Zaman <imran.zaman@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* wayland-server: Abort if a read from a client gives 0 lengthPhilip Withnall2014-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | This happens on EOF if using a poll function such as select() or kqueue() which doesn’t distinguish EOF events. Currently execution should never reach the point where recvmsg() returns EOF (len == 0). Instead, epoll() will detect this and indicate EPOLLHUP, which is handled a few lines above, closing the connection. However, other event mechanisms may not be able to distinguish EOF from regular readability (in the case of select()) or inconsistently across platforms (in the case of POLLHUP). There is also the possibility of half-closed connections (shutdown(), POLLRDHUP), though this may not be an issue with Wayland. This will not cause problems if the FD polls as readable but actually is not — in that case, recvmsg() will return EAGAIN. Signed-off-by: Philip Withnall <philip at tecnocode.co.uk> Signed-off-by: Karsten Otto <ottoka at posteo.de> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* event-loop.c: Use correct OS abstraction function for dupfd()Philip Withnall2014-11-051-1/+1
| | | | | | | | Signed-off-by: Philip Withnall <philip at tecnocode.co.uk> Signed-off-by: Karsten Otto <ottoka at posteo.de> Reviewed-by: David Fort <contact at hardening-consulting.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* connection: Fix sendmsg() on FreeBSDPhilip Withnall2014-11-051-1/+1
| | | | | | | | | | | | It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns EINVAL otherwise. It can't hurt to be tidy about things on other platforms either though. See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=99356#c5 Signed-off-by: Philip Withnall <philip at tecnocode.co.uk> Signed-off-by: Karsten Otto <ottoka at posteo.de> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* cosmetic: convert some function returns from int to boolDerek Foreman2014-11-042-7/+9
| | | | | | [Pekka Paalanen: change is_nullable_type() return value to bool.] Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* connection: Leave fd open in wl_connection_destroyBenjamin Herr2014-11-043-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling close() on the same file descriptor that a previous call to close() already closed is wrong, and racy if another thread received that same file descriptor as a eg. new socket or actual file. There are two situations where wl_connection_destroy() would close its file descriptor and then another function up in the call chain would close the same file descriptor: * When wl_client_create() fails after calling wl_connection_create(), it will call wl_connection_destroy() before returning. However, its caller will always close the file descriptor if wl_client_create() fails. * wl_display_disconnect() unconditionally closes the display file descriptor and also calls wl_connection_destroy(). So these two seem to expect wl_connection_destroy() to leave the file descriptor open. The other caller of wl_connection_destroy(), wl_client_destroy(), does however expect wl_connection_destroy() to close its file descriptor, alas. This patch changes wl_connection_destroy() to indulge this majority of two callers by simply not closing the file descriptor. For the benefit of wl_client_destroy(), wl_connection_destroy() then returns the unclosed file descriptor so that wl_client_destroy() can close it itself. Since wl_connection_destroy() is a private function called from few places, changing its semantics seemed like the more expedient way to address the double-close() problem than shuffling around the logic in wl_client_create() to somehow enable it to always avoid calling wl_connection_destroy(). Signed-off-by: Benjamin Herr <ben@0x539.de> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* doc: Mark up some code examplesBenjamin Herr2014-11-031-14/+18
| | | | | | | | These blocks were misformatted in normal paragraph style in the generated docs. Also, added \comment{} for comments within one code example. Signed-off-by: Benjamin Herr <ben@0x539.de>
* scanner: Remove stray newlineJonas Ådahl2014-09-231-1/+0
| | | | Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* scanner: Improve XML parse error reportingJonas Ådahl2014-09-231-2/+8
| | | | | | | Print the parse error and exit with a failure if expat can't parse the XML. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* shm: fix error in commentDerek Foreman2014-09-111-1/+1
|
* client: cancel read in wl_display_read_events() when last_error is setMarek Chalupa2014-09-111-3/+10
| | | | | | | | | | | Calling wl_display_read_events() after an error should be equivalent to wl_display_cancel_read(), so that display state is consistent. Thanks to Pekka Paalanen <pekka.paalanen@collabora.co.uk> for pointing that out. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* client: wake-up threads on all return paths from read_eventsMarek Chalupa2014-09-111-1/+6
| | | | | | | | | | If wl_connection_read returned EAGAIN, we must wake up sleeping threads. If we don't do this and the thread calling wl_connection_read won't call wl_display_read_events again, the sleeping threads will sleep indefinitely. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>