source: mainline/uspace/lib/c/include/io/window.h@ d5a89a3

Last change on this file since d5a89a3 was 4805495, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 6 years ago

Make sure libc and abi header guards are reserved identifiers

It's only needed for a small subset that end up included from standard
headers, but for consistency this changes all of them.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Copyright (c) 2012 Petr Koupy
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libc
30 * @{
31 */
32/** @file
33 */
34
35#ifndef _LIBC_IO_WINDOW_H_
36#define _LIBC_IO_WINDOW_H_
37
38#include <stdbool.h>
39#include <async.h>
40#include <loc.h>
41#include <io/kbd_event.h>
42#include <io/pos_event.h>
43
44typedef enum {
45 WINDOW_MAIN = 1,
46 WINDOW_DECORATED = 2,
47 WINDOW_RESIZEABLE = 4
48} window_flags_t;
49
50typedef enum {
51 GF_EMPTY = 0,
52 GF_MOVE_X = 1,
53 GF_MOVE_Y = 2,
54 GF_RESIZE_X = 4,
55 GF_RESIZE_Y = 8,
56 GF_SCALE_X = 16,
57 GF_SCALE_Y = 32
58} window_grab_flags_t;
59
60typedef enum {
61 WINDOW_PLACEMENT_ANY = 0,
62 WINDOW_PLACEMENT_CENTER_X = 1,
63 WINDOW_PLACEMENT_CENTER_Y = 2,
64 WINDOW_PLACEMENT_CENTER =
65 WINDOW_PLACEMENT_CENTER_X | WINDOW_PLACEMENT_CENTER_Y,
66 WINDOW_PLACEMENT_LEFT = 4,
67 WINDOW_PLACEMENT_RIGHT = 8,
68 WINDOW_PLACEMENT_TOP = 16,
69 WINDOW_PLACEMENT_BOTTOM = 32,
70 WINDOW_PLACEMENT_ABSOLUTE_X = 64,
71 WINDOW_PLACEMENT_ABSOLUTE_Y = 128,
72 WINDOW_PLACEMENT_ABSOLUTE =
73 WINDOW_PLACEMENT_ABSOLUTE_X | WINDOW_PLACEMENT_ABSOLUTE_Y
74} window_placement_flags_t;
75
76typedef struct {
77 sysarg_t object;
78 sysarg_t slot;
79 sysarg_t argument;
80} signal_event_t;
81
82typedef struct {
83 sysarg_t offset_x;
84 sysarg_t offset_y;
85 sysarg_t width;
86 sysarg_t height;
87 window_placement_flags_t placement_flags;
88} resize_event_t;
89
90typedef enum {
91 ET_KEYBOARD_EVENT,
92 ET_POSITION_EVENT,
93 ET_SIGNAL_EVENT,
94 ET_WINDOW_FOCUS,
95 ET_WINDOW_UNFOCUS,
96 ET_WINDOW_RESIZE,
97 ET_WINDOW_REFRESH,
98 ET_WINDOW_DAMAGE,
99 ET_WINDOW_CLOSE
100} window_event_type_t;
101
102typedef union {
103 kbd_event_t kbd;
104 pos_event_t pos;
105 signal_event_t signal;
106 resize_event_t resize;
107} window_event_data_t;
108
109typedef struct {
110 link_t link;
111 window_event_type_t type;
112 window_event_data_t data;
113} window_event_t;
114
115extern errno_t win_register(async_sess_t *, window_flags_t, service_id_t *,
116 service_id_t *);
117
118extern errno_t win_get_event(async_sess_t *, window_event_t *);
119
120extern errno_t win_damage(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
121extern errno_t win_grab(async_sess_t *, sysarg_t, sysarg_t);
122extern errno_t win_resize(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
123 window_placement_flags_t, void *);
124extern errno_t win_close(async_sess_t *);
125extern errno_t win_close_request(async_sess_t *);
126
127#endif
128
129/** @}
130 */
Note: See TracBrowser for help on using the repository browser.