source: mainline/uspace/lib/ui/include/types/ui/window.h@ 5d380b6

ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5d380b6 was 5d380b6, checked in by Jiri Svoboda <jiri@…>, 3 years ago

Create menu windows in the correct seat

Add a mechanism to set the seat of a new display window, UI window,
UI popup - input device ID. This is set to the ID of the device which
activated the menu (mouse, keyboard). The display server determines
the correct seat from there.

This makes sure clicking outside closes the correct pop-up window.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 * Copyright (c) 2023 Jiri Svoboda
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 libui
30 * @{
31 */
32/**
33 * @file Window
34 */
35
36#ifndef _UI_TYPES_WINDOW_H
37#define _UI_TYPES_WINDOW_H
38
39#include <errno.h>
40#include <io/kbd_event.h>
41#include <io/pos_event.h>
42#include <types/ui/wdecor.h>
43
44struct ui_window;
45typedef struct ui_window ui_window_t;
46
47/** Window placement hint */
48typedef enum {
49 /** Use default (automatic) placement */
50 ui_wnd_place_default = 0,
51 /** Place window to the top-left corner of the screen */
52 ui_wnd_place_top_left,
53 /** Place window to the top-right corner of the screen */
54 ui_wnd_place_top_right,
55 /** Place window to the bottom-left corner of the screen */
56 ui_wnd_place_bottom_left,
57 /** Place window to the bottom-right corner of the screen */
58 ui_wnd_place_bottom_right,
59 /** Place window accross the entire screen */
60 ui_wnd_place_full_screen,
61 /** Place window as a popup window adjacent to rectangle */
62 ui_wnd_place_popup
63} ui_wnd_placement_t;
64
65/** Window flags */
66typedef enum {
67 /** Popup window */
68 ui_wndf_popup = 0x1,
69 /** Topmost window */
70 ui_wndf_topmost = 0x2,
71 /** Special system window */
72 ui_wndf_system = 0x4,
73 /** Maximized windows should avoid this window */
74 ui_wndf_avoid = 0x8
75} ui_wnd_flags_t;
76
77/** Window parameters */
78typedef struct {
79 /** Window rectangle */
80 gfx_rect_t rect;
81 /** Window caption */
82 const char *caption;
83 /** Window decoration style */
84 ui_wdecor_style_t style;
85 /** Window placement */
86 ui_wnd_placement_t placement;
87 /** Window flags */
88 ui_wnd_flags_t flags;
89 /** Parent rectangle for popup windows */
90 gfx_rect_t prect;
91 /** Input device associated with the window's seat */
92 sysarg_t idev_id;
93} ui_wnd_params_t;
94
95/** Window callbacks */
96typedef struct ui_window_cb {
97 void (*minimize)(ui_window_t *, void *);
98 void (*maximize)(ui_window_t *, void *);
99 void (*unmaximize)(ui_window_t *, void *);
100 void (*close)(ui_window_t *, void *);
101 void (*focus)(ui_window_t *, void *, unsigned);
102 void (*kbd)(ui_window_t *, void *, kbd_event_t *);
103 errno_t (*paint)(ui_window_t *, void *);
104 void (*pos)(ui_window_t *, void *, pos_event_t *);
105 void (*unfocus)(ui_window_t *, void *, unsigned);
106} ui_window_cb_t;
107
108#endif
109
110/** @}
111 */
Note: See TracBrowser for help on using the repository browser.