Commit Graph

1442 Commits

Author SHA1 Message Date
Kristian Høgsberg
ac58741940 compositor: Assign surface damage before setting up scanout buffers 2012-01-25 21:48:26 -05:00
Kristian Høgsberg
6af8eb9c7f desktop-shell: Build in sensible defaults
This adds a default background pattern and a terminal launcher in case
we don't have a config file.
2012-01-25 20:53:08 -05:00
Kristian Høgsberg
07f729441e desktop-shell: Support tiling of background images 2012-01-25 16:34:36 -05:00
Kristian Høgsberg
d654876510 cairo-util: Add png loader and image type sniffing 2012-01-25 16:30:48 -05:00
Kristian Høgsberg
8129bc0fb9 desktop-shell: Fall back to solid color if there's no background image 2012-01-25 14:55:33 -05:00
Kristian Høgsberg
ffe3bba13e cairo-util: Return NULL instead of exit() on jpeg load failure 2012-01-25 14:54:26 -05:00
Kristian Høgsberg
a97eca95d0 Install terminal as weston-terminal 2012-01-25 14:02:05 -05:00
Kristian Høgsberg
bcecca49b8 Revert "weston: Drop priviledges early, and seteuid when needed"
This reverts commit fc6ccb868f.

We still need root permissions for drmDrop/SetMaster.  Without
integration with ConsoleKit or systemd we also don't have access
to /dev/dri/cardX in the case where we open a new VT.
2012-01-24 12:41:19 -05:00
Benjamin Franzke
fc6ccb868f weston: Drop priviledges early, and seteuid when needed 2012-01-24 11:26:41 -05:00
Benjamin Franzke
ef548fd3ca setuid: Operate relative to $(DESTDIR) 2012-01-24 11:25:16 -05:00
Neil Roberts
6b28aadd47 window: Fix sending button events when there's no grab
The code which sends the button events was checking whether there is a
focus widget with a button handler but then always sending the button
event to the grab widget. If the grab widget is different from the
focus widget at this point then it will check the wrong widget for a
button handler and potentially crash. It is also possible for there to
be no grab widget here in the following situation:

1. Press and hold down the left mouse button
2. Press and hold down the right mouse button
3. Release the left mouse button
4. Release the right mouse button

In this case the grab will be released at step 3 because the code only
keeps track of the grab for one button. Then it will try to send the
release event for the right mouse button to a NULL widget so it will
crash.
2012-01-24 11:25:15 -05:00
Tiago Vignatti
a12d6113ce evdev: fix uninitialised pointer value
==30224== Conditional jump or move depends on uninitialised value(s)
==30224==    at 0x40EE3A0: evdev_flush_motion (evdev.c:284)
==30224==    by 0x40EE6DC: evdev_input_device_data (evdev.c:352)
==30224==    by 0x4034710: wl_event_source_fd_dispatch (event-loop.c:76)
==30224==    by 0x4035171: wl_event_loop_dispatch (event-loop.c:462)
==30224==    by 0x4032F76: wl_display_run (wayland-server.c:785)
==30224==    by 0x8050972: main (compositor.c:2183)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-01-20 13:35:27 -05:00
Kristian Høgsberg
5f5324e098 gears: Make window transparent
We need this for the window decorations.
2012-01-19 14:05:21 -05:00
Kristian Høgsberg
824c6d0e38 window: Use CAIRO_OPERATOR_OVER for rendering the menu
We forgot to switch back from CAIRO_OPERATOR_SOURCE, which is broken,
but also hits a broken fallback in cairo-gl.
2012-01-19 13:54:11 -05:00
Kristian Høgsberg
44d4de656b configure: Add --enable-setuid-install
This adds support for installing the compositor setuid.
2012-01-19 13:32:17 -05:00
Pekka Paalanen
8423a89d41 compositor: initialise segv_action.sa_mask
Valgrind complained sa_mask member is not initialised, fix that.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:19:02 -05:00
Pekka Paalanen
9e30a82e25 desktop-shell: don't crash on menu
Add dummy menu callback function, so we don't crash after every time
someone opens the menu.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:19:01 -05:00
Pekka Paalanen
cb108439d2 shell: deal with weston_compositor_pick_surface() = NULL
I could crash Weston by trying to open another menu from a panel while
one menu from it was already showing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
440		if (surface->resource.client == client) {
(gdb) bt
 0  0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
 1  0x0000000000406977 in weston_device_repick (device=0x70b4e0, time=4130706528) at compositor.c:360
 2  0x0000000000406a36 in weston_compositor_repick (compositor=0x619960) at compositor.c:382
 3  0x0000000000406ac8 in destroy_surface (resource=0x6fc6f0) at compositor.c:397
 4  0x00007ffff7bd33d8 in destroy_resource (element=0x6fc6f0, data=0x7fffffffd9fc) at wayland-server.c:355
 5  0x00007ffff7bd8d98 in for_each_helper (entries=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:264
 6  0x00007ffff7bd8dd4 in wl_map_for_each (map=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:270
 7  0x00007ffff7bd34dc in wl_client_destroy (client=0x7577d0) at wayland-server.c:385
 8  0x00007ffff7bd2e36 in wl_client_connection_data (fd=17, mask=1, data=0x7577d0) at wayland-server.c:187
 9  0x00007ffff7bd5bde in wl_event_source_fd_dispatch (source=0x74cda0, ep=0x7fffffffdae0) at event-loop.c:76
 10 0x00007ffff7bd665b in wl_event_loop_dispatch (loop=0x618900, timeout=-1) at event-loop.c:462
 11 0x00007ffff7bd42a9 in wl_display_run (display=0x6188b0) at wayland-server.c:785
 12 0x000000000040b1e1 in main (argc=1, argv=0x7fffffffdef8) at compositor.c:2182

Modify popup_grab_focus() to deal with a NULL surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:18:49 -05:00
Pekka Paalanen
6d174cff7a window: menu leak fixes
When a menu self-destructs, free also the widget and struct menu.

As menus are self-destructing, it does not make sense to store the
window pointer, since we cannot clear it automatically. Therefore,
rename window_create_menu() to window_show_menu() that does not return
the window pointer. It also calls window_schedule_redraw() internally.

Fixes Valgrind reported memory leaks.

The alternative would be to explicitly destroy the menu in application's
menu callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 16:42:05 +02:00
Pekka Paalanen
84d62dc999 resizor: free the widget on destroy
Plugs a memory leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 16:41:59 +02:00
Pekka Paalanen
e156fb681e window: remove pointers to widget on destroy
Input devices may hold a pointer to the widget being destroyed. Reset
such pointers in widget_destroy().

This fixes a use-after-free in window_destroy(), if an application
destroys its widgets before the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 16:41:55 +02:00
Pekka Paalanen
4dde2fc6f6 window: destroy frame in window_destroy()
Fix a memory leak reported by Valgrind, by destroying the window
decorations widget, if it exists.

All widget pointers returned from toytoolkit to the application should
be destroyed by the application explicitly.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 16:41:48 +02:00
Kristian Høgsberg
90b53815ba compositor: Flush surface damage to surface below on destroy
When we destroy a surface, we damage the surface below so that the area
exposed by the disappearing surface will be repainted.  However, if that
surface also is destroyed, the damage information is lost and we fail to
repaint that area.

This commit introduces weston_surface_flush_damage(), which flushes the
surface damage the the surface below when a surface is destroyed.  When
multiple surfaces are destroyed at the same time, the damage now accumulates
and sinks down through the surface stack as it should.
2012-01-18 21:41:37 -05:00
Kristian Høgsberg
6916d9cb6f drm: Don't print warning if cursor stride isn't right
gbm_bo_create_from_egl_image() should catch this based on the
GBM_BO_USE_CURSOR_64X64 flag.  It currently doesn't so we end up with
a cursor buffer with invalid stride.
2012-01-18 15:21:28 -05:00
Kristian Høgsberg
2d57439592 clients: Allow compiling with the cairo glesv2 backend
This disables gears and wscreensaver, which use full GL.
2012-01-18 14:50:58 -05:00
Pekka Paalanen
40e49ac7b5 desktop-shell: fix the unlock dialog decorations
The decorations were not responding, could not move or resize the
dialog, and it painted with a black shade.

When the dialog is created, schedule a resize instead of a repaint. The
resize will initialise the widget tree, and let everything draw and work
as it should.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-18 13:09:56 -05:00
Kristian Høgsberg
08fcbf0f3d tty: Use SIGUSR1 for both enter and leave signals
Now that we track has_vt, we can use the same handler for both enter and leave.
2012-01-18 12:42:16 -05:00
Kristian Høgsberg
62d2774956 tty: Switch back to launch tty if we switched away 2012-01-18 12:38:33 -05:00
Kristian Høgsberg
34f80ff813 drm: Cancel any scheduled repaints in the leave vt handler
If we don't cancel the repaint, we end up pointlessly redrawing the output.
What's worse is that pageflipping to the new buffer eventually fails and
we miss the finish_frame callback, leaving the compositor stuck when we
re-enter the vt.
2012-01-18 11:50:31 -05:00
Kristian Høgsberg
835cd49772 drm: Reset kms mode on vt enter
Normally the repaint will trigger a pageflip, which flips back to our
fb, but that doesn't work if the kms output has been turned off or
set to a different mode.
2012-01-18 11:48:46 -05:00
Kristian Høgsberg
54f14c3c3e drm: Complain if pageflip fails
We still don't handle the error in any way, but there's not much we can do.
It's typically a case of not having drm master."
2012-01-18 11:47:41 -05:00
Kristian Høgsberg
f03a616c21 shell: Set desktop-shell deathstamp at initial launch
Timestamp 0 is a valid timestamp and we can't use that as an uninitialized
timestamp.
2012-01-17 11:07:42 -05:00
Pekka Paalanen
57cd0ed916 wscreensaver: get decorations back
In the great toytoolkit widget revolution, wscreensaver demo mode lost
its window decorations. Bring them back.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-17 10:59:29 -05:00
Pekka Paalanen
4d733ee246 shell: respawn desktop-shell if it dies
If the desktop-shell client goes away for any reason, respawn it. To
avoid harmful looping, limit the respawning to 5 times within 30
seconds, and then give up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-17 10:58:52 -05:00
Kristian Høgsberg
39d908e63a tty: Open a new vt if not running on a VT
This is typically when launcing from a pty such as an X (or Wayland)
terminal or from an ssh session.  Opening a new vt typically requires root
priviledges, so weston must be setuid root or laucnhed as root for this
to work.
2012-01-16 22:44:34 -05:00
Pekka Paalanen
0bd892750d window: remove duplicate widget_resize_handler_t
Fixes the following build failure:

In file included from window.c:58:0:
window.h:194:16: error: redefinition of typedef 'widget_resize_handler_t'
window.h:178:16: note: previous declaration of 'widget_resize_handler_t' was here

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-16 21:02:43 -05:00
Kristian Høgsberg
0690da60d4 compositor: Install a SEGV handler to try and clean up the VT if we crash 2012-01-16 11:54:30 -05:00
Kristian Høgsberg
353e57f908 tty: Fix order of VT ack/release ioctls and the vt handler
We can only set up once we've acquired the VT and we shouldn't release the
VT until we've cleaned up.  Before we would release the VT first, and then
race to drop drm master as X tried to get drm master.  Which would kill X.
2012-01-16 10:57:14 -05:00
Kristian Høgsberg
23a47a80e2 evdev: Drop noisy debug messages on vt swtich 2012-01-16 10:54:07 -05:00
Kristian Høgsberg
a018fb0dbf compositor-drm: Exit if we failed to get drm master
We can do anything without drm master.  Also log an error in case we
fail to drop it, which will be trouble for whoever we're switching to.
2012-01-16 10:53:01 -05:00
Kristian Høgsberg
5743010af0 xserver: Create WM window, handle client messages 2012-01-15 22:16:11 -05:00
Olivier Le Thanh Duong
643eac56e7 evdev: Correct warning on missing input device 2012-01-15 16:20:49 -05:00
Kristian Høgsberg
de13448c92 xserver: Just dup fd instead of two fcntls to get a non-O_CLOEXEC fd
Yeah, it's the same number of lines of code, but this actually checks
the error return.
2012-01-15 16:05:43 -05:00
Kristian Høgsberg
1760ebb236 xserver: Set DISPLAY for clients launched by the compositor 2012-01-15 16:04:33 -05:00
Kristian Høgsberg
ea093d4883 xserver: Don't set -logfile option, only available to root user 2012-01-15 15:51:12 -05:00
Kristian Høgsberg
92734c5673 tty: Leave tty in KD_GRAPHICS mode during vt switches
Part of the point of KD_GRAPHICS mode is that the kernel doesn't try
to restore the VT contents when we switch bach, but leaves that
to the user mode process.  This avoids ugly flicker of text mode contents
before the compositor takes over.
2012-01-15 15:25:06 -05:00
Kristian Høgsberg
c5b9ddb610 compositor-drm: Fail, and fail early if we can't set up the tty
Typically a permissions problem.  Weston should be setuid root or
be launched by a setuid helper.
2012-01-15 15:25:05 -05:00
Kristian Høgsberg
00513ab7cc tty: Close tty fd on exit 2012-01-15 15:25:05 -05:00
Kristian Høgsberg
1201b75bec tty: If no tty option is given, use stdin and make sure it's a vt 2012-01-15 15:25:01 -05:00
Richard Hughes
2f6219f127 Explicitly add GIO to the client libs
This prevents a build warning on Fedora 16 of:
   undefined reference to symbol 'g_file_get_basename'
2012-01-13 13:01:25 -05:00