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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since a35b458 was b7fd2a0, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

  • 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.