neuswc

patched neuswc library (tracked)
git clone https://git.daat.foo/neuswc.git
Log | Files | Refs | README | LICENSE

screen.h (2752B)


      1 /* swc: libswc/screen.h
      2  *
      3  * Copyright (c) 2013, 2014 Michael Forney
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a copy
      6  * of this software and associated documentation files (the "Software"), to deal
      7  * in the Software without restriction, including without limitation the rights
      8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9  * copies of the Software, and to permit persons to whom the Software is
     10  * furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice shall be included in
     13  * all copies or substantial portions of the Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     21  * SOFTWARE.
     22  */
     23 
     24 #ifndef SWC_SCREEN_H
     25 #define SWC_SCREEN_H
     26 
     27 #include "primary_plane.h"
     28 #include "swc.h"
     29 
     30 #include <wayland-util.h>
     31 
     32 struct output;
     33 struct pixman_region32;
     34 
     35 struct screen_modifier {
     36 	/**
     37 	 * Takes the screen geometry and sets 'usable' to the usable region of the
     38 	 * screen. 'usable' is an already initialized pixman region.
     39 	 */
     40 	void (*modify)(struct screen_modifier *modifier,
     41 	               const struct swc_rectangle *geometry,
     42 	               struct pixman_region32 *usable);
     43 
     44 	struct wl_list link;
     45 };
     46 
     47 struct screen {
     48 	struct swc_screen base;
     49 	const struct swc_screen_handler *handler;
     50 	void *handler_data;
     51 
     52 	struct wl_signal destroy_signal;
     53 	uint8_t id;
     54 	/* no hardware behind it: the backend owns the primary plane */
     55 	bool virtual;
     56 #ifdef ENABLE_DRM
     57 	uint32_t crtc;
     58 #endif
     59 
     60 	struct {
     61 		struct primary_plane primary;
     62 		struct plane *cursor;
     63 	} planes;
     64 
     65 	struct wl_global *global;
     66 	struct wl_list resources;
     67 
     68 	struct wl_list outputs;
     69 	struct wl_list modifiers;
     70 	struct wl_list link;
     71 };
     72 
     73 bool
     74 screens_initialize(void);
     75 void
     76 screens_finalize(void);
     77 
     78 /* crtc and cursor_plane are the drm backend's, the framebuffer's pass 0 and
     79  * NULL */
     80 struct screen *
     81 screen_new(uint32_t crtc, struct output *output, struct plane *cursor_plane);
     82 struct screen *
     83 screen_new_virtual(struct output *output, const struct view_impl *impl);
     84 void
     85 screen_resize(struct screen *screen, uint32_t width, uint32_t height);
     86 void
     87 screen_destroy(struct screen *screen);
     88 
     89 static inline uint32_t
     90 screen_mask(struct screen *screen)
     91 {
     92 	return 1 << screen->id;
     93 }
     94 
     95 void
     96 screen_update_usable_geometry(struct screen *screen);
     97 
     98 #endif