libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xwidget_private.h
Go to the documentation of this file.
1 /*
2  * 0BSD
3  *
4  * BSD Zero Clause License
5  *
6  * Copyright (c) 2019 Hermann Meyer
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted.
10 
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  *
19  */
20 
21 /**
22  * here are the private functions from xwidget
23  */
24 
25 #pragma once
26 
27 #ifndef XWIDGET_PRIVATE_H_
28 #define XWIDGET_PRIVATE_H_
29 
30 #include "xputty.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /**
37  * @brief _scroll_event - internal check which Adjustment_t change it's value
38  * on a motion event (POINTER_MOTION)
39  * @param *wid - pointer to the Widget_t receiving a event
40  * @param direction - up/down scroll diretion
41  * @return void
42  */
43 
44 void _scroll_event(Widget_t * wid, int direction);
45 /**
46  * @brief _toggle_event - internal check which Adjustment_t change it's value
47  * on a Button press event (BUTTON_PRESS)
48  * @param *wid - pointer to the Widget_t receiving a event
49  * @return void
50  */
51 
52 void _toggle_event(Widget_t * wid);
53 
54 /**
55  * @brief _check_enum - internal check if Adjustment_t is of type CL_ENUM
56  * and handle events acordingly
57  * @param *wid - pointer to the Widget_t receiving a event
58  * @param *xbutton - pointer to the XButtonEvent
59  * @return void
60  */
61 
62 void _check_enum(Widget_t * wid, XButtonEvent *xbutton);
63 
64 /**
65  * @brief _button_press - internal check which button is pressed (BUTTON_PRESS)
66  * @param *wid - pointer to the Widget_t receiving a event
67  * @param *xbutton - pointer to the XButtonEvent
68  * @param *user_data - void pointer to attached user_data
69  * @return void
70  */
71 
72 void _button_press(Widget_t * wid, XButtonEvent *xbutton, void* user_data);
73 
74 /**
75  * @brief _check_grab - internal check if a Widgt_t holds a grab
76  * when a BUTTON_PRESS event occur. If so, check if the button is pressed
77  * inside the grab Widget_t. If yes, handle the event. In any case destroy the grab
78  * @param *wid - pointer to the Widget_t receiving a event
79  * @param *xbutton - pointer to the XButtonEvent
80  * @param *main - pointer to main struct
81  * @return void
82  */
83 
84 void _check_grab(Widget_t * wid, XButtonEvent *xbutton, Xputty *main);
85 
86 /**
87  * @brief _propagate_child_expose - send expose to any child Widget_t
88  * @param *wid - pointer to the Widget_t send the event
89  * @return void
90  */
91 
93 
94 /**
95  * @brief _check_keymap - check if key is in map, send requests if so
96  * @param *w - pointer to the Widget_t receiving the event
97  * @param xkey - the XKeyEvent to check
98  * @return void
99  */
100 
101 void _check_keymap (void *w_ , XKeyEvent xkey);
102 
103 /**
104  * @brief _hide_all_tooltips - hide all active tooltips
105  * @param *wid - pointer to the Widget_t receiving the event
106  * @return void
107  */
108 
109 void _hide_all_tooltips(Widget_t *wid);
110 
111 /**
112  * @brief _has_pointer - check if the widget has the pointer
113  * @param *w - pointer to the Widget_t sending the request
114  * @param *button - pointer to the XButtonEvent sending the notify
115  * @return void
116  */
117 
118 void _has_pointer(Widget_t *w, XButtonEvent *button);
119 
120 /**
121  * @brief _set_adj_value - set value to adjustment from key event
122  * @param *w - pointer to the Widget_t receiving the event
123  * @param x - use x or y-axis
124  * @return void
125  */
126 
127 void _set_adj_value(void *w_, bool x, int direction);
128 
129 /**
130  * @brief _dummy1_callback - default debuging callback for evfunc's
131  * @param *w - pointer to the Widget_t receive the event
132  * @param user_data - void pointer to attached user_data
133  * @return void
134  */
135 
136 void _dummy1_callback(void *w_, void* _data, void* user_data);
137 
138 /**
139  * @brief _dummy1_callback - default debuging callback for xevfunc's
140  * @param *w - pointer to the Widget_t receive the event
141  * @param user_data - void pointer to attached user_data
142  * @return void
143  */
144 
145 void _dummy_callback(void *w_, void* user_data);
146 
147 /**
148  * @brief _resize_surface - intern check if a Widget_t surfaces needs resizing
149  * @param *wid - pointer to the Widget_t receive the event
150  * @param width - the new width
151  * @param height - the new height
152  * @return void
153  */
154 
155 void _resize_surface(Widget_t *wid, int width, int height);
156 
157 /**
158  * @brief _resize_childs - intern check if child widgets needs resizing
159  * @param *wid - pointer to the Widget_t receive the event
160  * @return void
161  */
162 
163 void _resize_childs(Widget_t *wid);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif // XWIDGET_PRIVATE_H__
_check_enum
void _check_enum(Widget_t *wid, XButtonEvent *xbutton)
_check_enum - internal check if Adjustment_t is of type CL_ENUM and handle events acordingly
Definition: xwidget_private.c:67
Xputty
Xputty - the main struct. It should be declared before any other call to a Xputty function....
Definition: xputty.h:177
_set_adj_value
void _set_adj_value(void *w_, bool x, int direction)
_set_adj_value - set value to adjustment from key event
Definition: xwidget_private.c:223
_button_press
void _button_press(Widget_t *wid, XButtonEvent *xbutton, void *user_data)
_button_press - internal check which button is pressed (BUTTON_PRESS)
Definition: xwidget_private.c:84
_resize_childs
void _resize_childs(Widget_t *wid)
_resize_childs - intern check if child widgets needs resizing
Definition: xwidget_private.c:260
_dummy_callback
void _dummy_callback(void *w_, void *user_data)
_dummy1_callback - default debuging callback for xevfunc's
Definition: xwidget_private.c:242
_hide_all_tooltips
void _hide_all_tooltips(Widget_t *wid)
_hide_all_tooltips - hide all active tooltips
Definition: xwidget_private.c:201
_toggle_event
void _toggle_event(Widget_t *wid)
_toggle_event - internal check which Adjustment_t change it's value on a Button press event (BUTTON_P...
Definition: xwidget_private.c:55
_has_pointer
void _has_pointer(Widget_t *w, XButtonEvent *button)
_has_pointer - check if the widget has the pointer
Definition: xwidget_private.c:211
xputty.h
_scroll_event
void _scroll_event(Widget_t *wid, int direction)
_scroll_event - internal check which Adjustment_t change it's value on a motion event (POINTER_MOTION...
Definition: xwidget_private.c:24
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
_check_grab
void _check_grab(Widget_t *wid, XButtonEvent *xbutton, Xputty *main)
_check_grab - internal check if a Widgt_t holds a grab when a BUTTON_PRESS event occur....
Definition: xwidget_private.c:112
_resize_surface
void _resize_surface(Widget_t *wid, int width, int height)
_resize_surface - intern check if a Widget_t surfaces needs resizing
Definition: xwidget_private.c:246
_propagate_child_expose
void _propagate_child_expose(Widget_t *wid)
_propagate_child_expose - send expose to any child Widget_t
Definition: xwidget_private.c:139
_check_keymap
void _check_keymap(void *w_, XKeyEvent xkey)
_check_keymap - check if key is in map, send requests if so
Definition: xwidget_private.c:155
_dummy1_callback
void _dummy1_callback(void *w_, void *_data, void *user_data)
_dummy1_callback - default debuging callback for evfunc's
Definition: xwidget_private.c:238