diff options
author | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:20:32 +1000 |
commit | 3ad3455551be0d7859ecb02290376206d5e66498 (patch) | |
tree | 497917e12b4d7f458dff9765d9b53f64c4e03fc3 /libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c | |
parent | Update EFL to latest beta. (diff) | |
download | SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.zip SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.gz SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.bz2 SledjHamr-3ad3455551be0d7859ecb02290376206d5e66498.tar.xz |
And actually include new files, plus elementary libraries.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c new file mode 100644 index 0000000..9f540d4 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_output.c | |||
@@ -0,0 +1,79 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include "Ecore.h" | ||
6 | #include "ecore_private.h" | ||
7 | #include "ecore_wl_private.h" | ||
8 | #include "Ecore_Wayland.h" | ||
9 | |||
10 | /* local function prototypes */ | ||
11 | static void _ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w __UNUSED__, int h __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__); | ||
12 | static void _ecore_wl_output_cb_mode(void *data, struct wl_output *wl_output __UNUSED__, unsigned int flags, int w, int h, int refresh __UNUSED__); | ||
13 | |||
14 | /* wayland listeners */ | ||
15 | static const struct wl_output_listener _ecore_wl_output_listener = | ||
16 | { | ||
17 | _ecore_wl_output_cb_geometry, | ||
18 | _ecore_wl_output_cb_mode | ||
19 | }; | ||
20 | |||
21 | void | ||
22 | _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id) | ||
23 | { | ||
24 | Ecore_Wl_Output *output; | ||
25 | |||
26 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
27 | |||
28 | if (!(output = malloc(sizeof(Ecore_Wl_Output)))) return; | ||
29 | |||
30 | memset(output, 0, sizeof(Ecore_Wl_Output)); | ||
31 | |||
32 | output->display = ewd; | ||
33 | |||
34 | output->output = wl_display_bind(ewd->wl.display, id, &wl_output_interface); | ||
35 | wl_list_insert(ewd->outputs.prev, &output->link); | ||
36 | wl_output_add_listener(output->output, &_ecore_wl_output_listener, output); | ||
37 | } | ||
38 | |||
39 | void | ||
40 | _ecore_wl_output_del(Ecore_Wl_Output *output) | ||
41 | { | ||
42 | if (!output) return; | ||
43 | if (output->destroy) (*output->destroy)(output, output->data); | ||
44 | if (output->output) wl_output_destroy(output->output); | ||
45 | wl_list_remove(&output->link); | ||
46 | free(output); | ||
47 | } | ||
48 | |||
49 | /* local functions */ | ||
50 | static void | ||
51 | _ecore_wl_output_cb_geometry(void *data, struct wl_output *wl_output __UNUSED__, int x, int y, int w __UNUSED__, int h __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__) | ||
52 | { | ||
53 | Ecore_Wl_Output *output; | ||
54 | |||
55 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
56 | |||
57 | output = data; | ||
58 | output->allocation.x = x; | ||
59 | output->allocation.y = y; | ||
60 | } | ||
61 | |||
62 | static void | ||
63 | _ecore_wl_output_cb_mode(void *data, struct wl_output *wl_output __UNUSED__, unsigned int flags, int w, int h, int refresh __UNUSED__) | ||
64 | { | ||
65 | Ecore_Wl_Output *output; | ||
66 | Ecore_Wl_Display *ewd; | ||
67 | |||
68 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
69 | |||
70 | output = data; | ||
71 | ewd = output->display; | ||
72 | if (flags & WL_OUTPUT_MODE_CURRENT) | ||
73 | { | ||
74 | output->allocation.w = w; | ||
75 | output->allocation.h = h; | ||
76 | _ecore_wl_disp->output = output; | ||
77 | if (ewd->output_configure) (*ewd->output_configure)(output, ewd->data); | ||
78 | } | ||
79 | } | ||