swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

screen.h (2361B)


      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 "swc.h"
     28 #include "primary_plane.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, const struct swc_rectangle *geometry, struct pixman_region32 *usable);
     41 
     42 	struct wl_list link;
     43 };
     44 
     45 struct screen {
     46 	struct swc_screen base;
     47 	const struct swc_screen_handler *handler;
     48 	void *handler_data;
     49 
     50 	struct wl_signal destroy_signal;
     51 	uint8_t id;
     52 	uint32_t crtc;
     53 
     54 	struct {
     55 		struct primary_plane primary;
     56 		struct plane *cursor;
     57 	} planes;
     58 
     59 	struct wl_global *global;
     60 	struct wl_list resources;
     61 
     62 	struct wl_list outputs;
     63 	struct wl_list modifiers;
     64 	struct wl_list link;
     65 };
     66 
     67 bool screens_initialize(void);
     68 void screens_finalize(void);
     69 
     70 struct screen *screen_new(uint32_t crtc, struct output *output, struct plane *cursor_plane);
     71 void screen_destroy(struct screen *screen);
     72 
     73 static inline uint32_t
     74 screen_mask(struct screen *screen)
     75 {
     76 	return 1 << screen->id;
     77 }
     78 
     79 void screen_update_usable_geometry(struct screen *screen);
     80 
     81 #endif