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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 8a64320e was 2c7fdaa, checked in by Martin Decky <martin@…>, 10 years ago

resize only those windows that declare and support resizing capabilities
introduce generic window flags

  • 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 <sys/types.h>
40#include <async.h>
41#include <loc.h>
42#include <io/kbd_event.h>
43#include <io/pos_event.h>
44
45typedef enum {
46 WINDOW_MAIN = 1,
47 WINDOW_DECORATED = 2,
48 WINDOW_RESIZEABLE = 4
49} window_flags_t;
50
51typedef enum {
52 GF_EMPTY = 0,
53 GF_MOVE_X = 1,
54 GF_MOVE_Y = 2,
55 GF_RESIZE_X = 4,
56 GF_RESIZE_Y = 8,
57 GF_SCALE_X = 16,
58 GF_SCALE_Y = 32
59} window_grab_flags_t;
60
61typedef enum {
62 WINDOW_PLACEMENT_ANY = 0,
63 WINDOW_PLACEMENT_CENTER_X = 1,
64 WINDOW_PLACEMENT_CENTER_Y = 2,
65 WINDOW_PLACEMENT_CENTER =
66 WINDOW_PLACEMENT_CENTER_X | WINDOW_PLACEMENT_CENTER_Y,
67 WINDOW_PLACEMENT_LEFT = 4,
68 WINDOW_PLACEMENT_RIGHT = 8,
69 WINDOW_PLACEMENT_TOP = 16,
70 WINDOW_PLACEMENT_BOTTOM = 32,
71 WINDOW_PLACEMENT_ABSOLUTE_X = 64,
72 WINDOW_PLACEMENT_ABSOLUTE_Y = 128,
73 WINDOW_PLACEMENT_ABSOLUTE =
74 WINDOW_PLACEMENT_ABSOLUTE_X | WINDOW_PLACEMENT_ABSOLUTE_Y
75} window_placement_flags_t;
76
77typedef struct {
78 sysarg_t object;
79 sysarg_t slot;
80 sysarg_t argument;
81} signal_event_t;
82
83typedef struct {
84 sysarg_t offset_x;
85 sysarg_t offset_y;
86 sysarg_t width;
87 sysarg_t height;
88 window_placement_flags_t placement_flags;
89} resize_event_t;
90
91typedef enum {
92 ET_KEYBOARD_EVENT,
93 ET_POSITION_EVENT,
94 ET_SIGNAL_EVENT,
95 ET_WINDOW_FOCUS,
96 ET_WINDOW_UNFOCUS,
97 ET_WINDOW_RESIZE,
98 ET_WINDOW_REFRESH,
99 ET_WINDOW_DAMAGE,
100 ET_WINDOW_CLOSE
101} window_event_type_t;
102
103typedef union {
104 kbd_event_t kbd;
105 pos_event_t pos;
106 signal_event_t signal;
107 resize_event_t resize;
108} window_event_data_t;
109
110typedef struct {
111 link_t link;
112 window_event_type_t type;
113 window_event_data_t data;
114} window_event_t;
115
116extern int win_register(async_sess_t *, window_flags_t, service_id_t *,
117 service_id_t *);
118
119extern int win_get_event(async_sess_t *, window_event_t *);
120
121extern int win_damage(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
122extern int win_grab(async_sess_t *, sysarg_t, sysarg_t);
123extern int win_resize(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
124 window_placement_flags_t, void *);
125extern int win_close(async_sess_t *);
126extern int win_close_request(async_sess_t *);
127
128#endif
129
130/** @}
131 */
Note: See TracBrowser for help on using the repository browser.