Commit Graph

1055 Commits

Author SHA1 Message Date
Jonas Ådahl
82fced41cc simple-egl: Fix -Wsign-compare compiler warning
Fixes the following compiler warning:

simple-egl.c:434:36: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-01-27 21:12:33 -08:00
U. Artie Eoff
bae79ca741 clients/window: fail if NULL returned from frame_create
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:03:50 -08:00
U. Artie Eoff
86c68b328a weston-info: free allocated memory and check OOM conditions
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:02:37 -08:00
U. Artie Eoff
09827e2643 terminal: use xstrdup instead to handle OOM
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:30 -08:00
U. Artie Eoff
5cda4e328d use xzalloc wrapper instead
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:23 -08: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
6f394d59a1 resizor: Don't resize if maximized
https://bugs.freedesktop.org/show_bug.cgi?id=73723
2014-01-17 15:31:33 -08:00
Bryce W. Harrington
3abdafd12d terminal: Only set title if asprintf succeeded
Handles potential out of memory situation by skipping the title update.
This fixes the following warning:

  terminal.c: In function ‘resize_handler’:
  terminal.c:851:11: warning: ignoring return value of ‘asprintf’,
  declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-01-17 11:29:54 -08:00
Kristian Høgsberg
211b517e8c shell: Move maximize and fullscreen bindings to mod + SHIFT
mod + f and mod + m conflict with too many application bindings, in
particular if mod is mapped to ALT.
2014-01-11 13:58:33 -08:00
Kristian Høgsberg
b637a40df9 window: Properly destroy tooltip windows when parent window is destroyed
If we destroy a window with an active tooltip, we leave the tooltip
hanging around.  Call tooltip destructor when destroying a window.
This fixes the stuck tooltip observed when unplugging a monitor with
an active tooltip on the panel.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931
2014-01-10 00:27:35 -08:00
Kristian Høgsberg
d6d3b377f8 keyboard: Make debug output less verbose
The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.

Also drop a noisy fprintf() in input_panel_configure().
2014-01-09 23:58:14 -08:00
Kristian Høgsberg
700d6ad071 keyboard: Don't strcat() into a strdup()ed string
We need to reallocate the memory to hold the entire concatenated string,
but strcat() doesn't do that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750
2014-01-09 23:45:18 -08:00
Kristian Høgsberg
a548b4b85c keyboard: Fix insert_text() string utility
strncat() into a newly allocated buffer isn't well-defined.  I don't know
how this didn't crash all the time, getting blocks from malloc() with
a NUL in the first byte must be fairly common.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750
2014-01-09 23:39:20 -08:00
Neil Roberts
97b747cdda westoy: Add an option to explicitly disable cairo on a widget
The subsurfaces example creates a subsurface widget and uses EGL to
render to it directly rather than using the cairo context from the
widget. In theory this shouldn't cause any problems because the westoy
window code lazily creates the cairo surface when an application
creates a cairo context. However commit fdca95c7 changed the behaviour
to force the lazy creation at the beginning of each surface redraw.
This ends up making the triangle surface get two attaches – one from
Cairo and one from the direct EGL.

It looks like it would be difficult to reinstate the lazy surface
creation behaviour whilst still maintaining the error handling for
surface creation because none of the redraw handlers in the example
clients are designed to cope with that. Instead, this patch adds an
explicit option on a widget to disable creating the Cairo surface and
the subsurface example now uses that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72854
2014-01-09 15:03:15 -08:00
Pekka Paalanen
b0420aeb3d protocol: rename wl_surface_scaler to wl_viewport
This seems like a better name, and will not conflict if someone later
extends wl_surface with a request scaler_set (yeah, unlikely).

This code was written by Jonny Lamb, I just diffed his branches and made
a patch for Weston.

Cc: Jonny Lamb <jonny.lamb@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-01-08 21:33:19 -08:00
Kristian Høgsberg
ef9c8eb2db keyboard: Handle touch up event
This fixes arrow keys which trigger on button up.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73169
2014-01-07 12:57:59 -08:00
Kristian Høgsberg
966e3ed247 editor: Add missing touch-to-activate for the entries
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72996
2014-01-07 10:42:41 -08:00
Armin K
917711bd59 clients: Fix libexec clients install 2014-01-03 17:33:36 -08:00
Kristian Høgsberg
7885890df8 editor: Add keyboard_focus handler to schedule repaint
This let the editor client repaint the frame to indicate it's active
when it receives keyboard focus.
2014-01-01 23:57:42 -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
Kristian Høgsberg
f3fa832796 build: Move clients libexec_PROGRAMS under BUILD_CLIENTS conditional
All the libexec programs are only built when BUILD_CLIENTS is true,
so we can just assign libexec_PROGRAMS under the condition.  This lets us
drop most of the variable assignments and simplify it a bit.

https://bugs.freedesktop.org/show_bug.cgi?id=72812
2014-01-01 13:52:20 -08:00
Kristian Høgsberg
96e1c0b6e5 build: Don't try to build weston-info if client build is disabled
The weston-info sources are defined conditionally in the if BUILD_CLIENTS
section, but we always added weston-info to bin_PROGRAMS.

https://bugs.freedesktop.org/show_bug.cgi?id=72812
2014-01-01 13:52:20 -08:00
Kristian Høgsberg
ea520d510c build: Rename option and conditional for installing demo clients
Previously the option was --enable-demo-clients and the conditional was
ENABLE_DEMO_CLIENTS.  They control whether or not we install the demo clients
(ie all other clients than weston-terminal and weston-info).  Rename the
option and the conditional to better reflect this.
2014-01-01 13:52:20 -08:00
Kristian Høgsberg
c152ee11e3 window.c: Don't put buttons on frames for custom windows
Custom windows don't have a wl_shell_surface and can't do anything in
response to these button (except crash).  This only affects the unlock
dialog.

https://bugs.freedesktop.org/show_bug.cgi?id=72542
2013-12-31 15:35:51 -08:00
Kristian Høgsberg
c2010b3af0 nested: Add EGL_WL_create_wayland_buffer_from_image compat defines
Make it possible to compile this example with EGL implementations without
this extension.
2013-12-17 10:40:01 -08:00
Jonny Lamb
92d90f225d clients: add scaler test app
This client tests the wl_scaler and wl_surface_scaler protocol
extensions by cropping and then scaling a surface to ensure it is
rendered correctly. More details in comments in the code.
2013-12-16 22:55:47 -08:00
Jasper St. Pierre
80c798bdf0 Update .gitignore
Ignore the new stacking demo...
2013-12-09 12:19:40 -08:00
Kristian Høgsberg
1e65840b61 simple-egl: Add option to allow not syncing to compositor repaint cycle
It's the GO FASTER option.
2013-12-07 22:26:23 -08:00
Kristian Høgsberg
deb322237b simple-egl: Print fps for the spinning triangle
This is not a benchmark.
2013-12-07 22:26:23 -08:00
Kristian Høgsberg
acdae2e641 stacking: Set a keyboard focus handler so we can repaint the frame
Yes, perhaps this should be more automatic...
2013-12-05 15:37:29 -08:00
Neil Roberts
a5059eb187 nested: Add an option to disable subsurfaces
This adds a -b option to force the nested compositor example to use
the old blit renderer even if the appropriate extensions are
available.
2013-12-04 16:34:08 -08:00
Neil Roberts
1f020a1fdb nested: Add a renderer using subsurfaces
Adds a second renderer implementation to the nested compositor example
that creates a subsurface for each of the client's surfaces. The
client buffers are directly attached to the subsurface using the
EGL_WL_create_wayland_buffer_from_image extension instead of blitting
them in the redraw_handler.

The new renderer is always used if the parent compositor supports the
wl_subcompositor protocol and the EGL extension is available.
Otherwise it will fall back to the blit renderer.
2013-12-04 16:34:07 -08:00
Neil Roberts
5e10a04481 clients: Add a widget_get_wl_subsurface
Adds a simple accessor for the wl_subsurface for widgets created with
window_add_subsurface.
2013-12-04 16:34:07 -08:00
Neil Roberts
47b87d5ec0 nested: Add a ‘renderer’ mechanism with a vtable
Eventually the nested compositor example will want to be able to cope
with either rendering as it does now with a blit to an intermediate
surface or by attaching the client buffers directly to a subsurface
without copying. This patch moves the code that is specific to the
blitting mechanism into a separate set of functions with a vtable to
make it easier to add the second way of rendering in a later patch.
2013-12-04 16:34:07 -08:00
Neil Roberts
f9b2541df1 nested: Move the frame callback list to the surface
Previously the frame callback list was tracked as part of the global
compositor state. This patch moves the list to be part of the surface
state like it is in Weston. The frame callback now iterates the list
of surfaces to flush all of the callbacks. This change will be useful
when the example is converted to use subsurfaces so that it can have a
separate frame callback for the subsurface and flush the list for an
individual client surface rather than flushing globally.
2013-12-04 16:34:07 -08:00
Neil Roberts
2855766333 nested: Add damage tracking to the nested compositor example
The nested compositor example now responds to damage requests and
tracks them in the pending buffer state. This isn't currently used for
anything and it is immediately discarded when the surface is commited
but it will be used later when the example is converted to use
subsurfaces.
2013-12-04 16:34:07 -08:00
Neil Roberts
15a8d340fd nested: Add double-buffered state semantics to the nested example
The buffer and frame callback state on the surfaces in the nested
compositor example are now double-buffered so that they only take
effect when the commit request is received. This doesn't really make
much difference for the current state that the example has but it will
be useful when more state is added in later patches.
2013-12-04 16:34:07 -08:00
Neil Roberts
6bf23879e9 nested: Add the buffer reference semantics from Weston
This copies the buffer reference busy count implementation from Weston
to the nested compositor example and adds an internal nested_buffer
struct that we could eventually use to attach data. This will be
useful to adapt the example to use subsurfaces so that we can attach
our compositor-side buffer to the resource.
2013-12-04 16:34:07 -08:00
Neil Roberts
8fbe3a68d4 nested: Remove the surface from the surface list when destroyed
Otherwise if the surface is destroyed then it will crash when it later
tries to render all of the surfaces. You can replicate this by doing
killall weston-nested-client while the example is running.
2013-12-04 16:34:07 -08:00
Kristian Høgsberg
873b515aee tablet-shell: Remove
The tablet-shell is unmaintained and unused.  It is currently
dead-weight and a burden when we make changes to weston.  Let's
drop it for now, we can pull it out of git if we find a need for it later.
2013-12-04 10:18:29 -08:00
Pekka Paalanen
fdca95c7db window: handle insufficient buffer space
It is quite possible for os_create_anonymous_file() to fail when trying
to allocate a new wl_shm buffer. Propagate this failure out from
shm_surface_prepare. Most parts of toytoolkit are already avoiding NULL
cairo surfaces.

If cairo surface allocation fails, do not try to call the widget redraw
functions, those are not prepared to deal with NULL. Also do not
schedule a frame callback, this allows us to retry drawing the next
time.

If redraw fails for the main_surface of a window, restore the widget
geometry to what the compositor currently is showing. This keeps the
window visual appearance in sync with application state, so interacting
with the application does not break too badly.

If the very first draw of any window fails, then forcefully exit the
program. E.g. if weston-desktop-shell fails to allocate buffers for the
unlock dialog, w-d-s exits, and weston unlocks the screen automatically.

This patch allows e.g. weston-terminal to stop from enlarging while
resizing, if new sized buffers can no longer the allocated. Even then,
the application stays usable, as it can often repaint in the last
successful size. It does not crash, and the user is able to resize it
smaller, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-12-02 16:20:58 -08:00
Philip Withnall
17c2fb4f29 clients: Add a new weston-stacking demo
This allows creation of a variety of window types, for the purposes of
testing window ordering and stacking in Weston.
2013-12-02 11:44:50 -08:00
Philip Withnall
c971d2a8b3 clients: Add window_is_transient() helper to the toy toolkit window 2013-12-02 11:44:50 -08:00
Xiong Zhang
bf3c1c6913 distinguish touch screen and pointer dnd in client
Data device interface in client just handle with pointer's dnd.
If a touch screen trigger dnd, it will use pointer struct like i
nput->sx, input->sy, input->pointer_focus. So if pointer is moving
when touch screen trigeer a dnd, wrong behaviore will occur.
Before touch screen start dnd, system call touch_grab()
to mark the following drag and drop operation is generated by
touch screen.
Defined some common variables in struct input to track dnd.

Note, touch screen and pointer can't generate drag and drop at the
same time, becuae data device protocol can't identify the drag
and drop event is generated by touch screen or pointer.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
2013-11-25 16:32:12 -08:00
Xiong Zhang
853a7799d6 client/dnd.c: add dnd support for touch screen in client
Adding the interface for touch screen event in clients/dnd.c, once
user touch down on this app, it will trigger a touch and drag
operation.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
2013-11-25 16:32:08 -08:00
Xiong Zhang
49c6aeee70 terminal: add touch screen selection support
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
2013-11-25 11:26:00 -08:00
Kristian Høgsberg
1d781ee204 terminal: Update terminal->end whenever we write a character
We used to only update it on newline, which breaks when somebody moves
the cursor below terminal->end and writes stuff.  Instead update it whenever
we write a character to the terminal.

https://bugs.freedesktop.org/show_bug.cgi?id=71935
2013-11-24 17:01:26 -08:00
Kristian Høgsberg
dcfff55ef3 terminal: Init tab ruler after setting terminal->width
terminal_init_tabs() needs an accurate terminal->width to be able
to correctly initialize the tab ruler.
2013-11-22 22:43:20 -08:00
Kristian Høgsberg
617e9a37f2 dnd: Simplify drag icon creation
We used to have to composite the pointer on top of the drag icon, but
the final protocol allows us to specify both a drag icon and a cursor.
Remove the complexity that dealt with that.
2013-11-22 11:59:40 -08:00