libxputty 0.1
Loading...
Searching...
No Matches
xwidget.c
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#include "xwidget.h"
23#include "xwidget_private.h"
24
26
27const char *widget_type_name(Widget_t *w) {
28 if (!w)
29 return widget_type_names[0]; // "WT_NONE"
30 else if (w->widget_type >= XPUTTY_WIDGET_NAME_COUNT)
31 return widget_type_names[XPUTTY_WIDGET_NAME_COUNT]; // "UNKNOWN"
32 else
33 return widget_type_names[w->widget_type];
34}
35
36
37int key_mapping(Display *dpy, XKeyEvent *xkey) {
38 if (xkey->keycode == XKeysymToKeycode(dpy,XK_Tab))
39 return (xkey->state & ShiftMask) ? 1 : 2;
40 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Up))
41 return 3;
42 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Right))
43 return 4;
44 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Down))
45 return 5;
46 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Left))
47 return 6;
48 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Home))
49 return 7;
50 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Insert))
51 return 8;
52 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_End))
53 return 9;
54 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Return))
55 return 10;
56 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_BackSpace))
57 return 11;
58 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_Delete))
59 return 12;
60 // keypad
61 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Subtract))
62 return 1;
63 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Add))
64 return 2;
65 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Up))
66 return 3;
67 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Right))
68 return 4;
69 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Down))
70 return 5;
71 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Left))
72 return 6;
73 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Home))
74 return 7;
75 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Insert))
76 return 8;
77 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_End))
78 return 9;
79 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Enter))
80 return 10;
81 else if (xkey->keycode == XKeysymToKeycode(dpy,XK_KP_Delete))
82 return 12;
83 else return 0;
84}
85
86void destroy_widget(Widget_t * w, Xputty *main) {
87 int count = childlist_find_child(main->childlist, w);
88 if (count == 0 && main->run == true) {
89 quit(w);
90 } else if(childlist_find_child(main->childlist, w)>=0) {
91 if(w->flags & REUSE_IMAGE) {
92 w->image = NULL;
93 }
94 if(w->flags & HAS_MEM) {
95 w->func.mem_free_callback(w, NULL);
96 }
98 int ch = childlist_has_child(w->childlist);
99 if (ch) {
100 int i = ch;
101 for(;i>0;i--) {
102 destroy_widget(w->childlist->childs[i-1],main);
103
104 }
105 destroy_widget(w,main);
106 }
107 if(w->flags & IS_WIDGET) {
108 Widget_t *p = (Widget_t *) w->parent;
110 }
114 cairo_surface_destroy(w->image);
115 cairo_destroy(w->crb);
116 cairo_surface_destroy(w->buffer);
117 cairo_destroy(w->cr);
118 cairo_surface_destroy(w->surface);
119
121 free(w->color_scheme);
122 free(w->childlist);
123 free(w);
124 w = NULL;
125 }
126}
127
128void configure_event(void *w_, void* user_data) {
129 Widget_t *wid = (Widget_t*)w_;
130 Metrics_t metrics;
131 os_get_window_metrics(wid, &metrics);
132 if (wid->width != metrics.width || wid->height != metrics.height) {
133 wid->scale.scale_x = (float)wid->scale.init_width - metrics.width;
134 wid->scale.scale_y = (float)wid->scale.init_height - metrics.height;
135 wid->scale.cscale_x = (float)((float)wid->scale.init_width/(float)metrics.width);
136 wid->scale.cscale_y = (float)((float)wid->scale.init_height/(float)metrics.height);
137 wid->scale.rcscale_x = (float)((float)metrics.width/(float)wid->scale.init_width);
138 wid->scale.rcscale_y = (float)((float)metrics.height/(float)wid->scale.init_height);
139 wid->scale.ascale = wid->scale.cscale_x < wid->scale.cscale_y ?
140 wid->scale.cscale_y : wid->scale.cscale_x;
141
142 _resize_surface(wid, metrics.width, metrics.height);
143
144 debug_print("Widget_t configure callback width %i height %i\n", metrics.width, metrics.height);
145
146 _resize_childs(wid);
147 }
148 wid->func.configure_notify_callback(wid,NULL);
149}
150
153}
154
156 cairo_scale(w->crb, w->scale.cscale_x,w->scale.cscale_y);
157}
158
160 cairo_scale(w->crb, w->scale.rcscale_x,w->scale.rcscale_y);
161}
162
164 int x, int y, int width, int height) {
165
166 Widget_t *w = (Widget_t*)malloc(sizeof(Widget_t));
167 assert(w != NULL);
168 debug_print("assert(w)\n");
169 memset(w, 0, sizeof(Widget_t));
170 w->image = NULL;
171
172 w->flags = IS_WINDOW;
173 w->flags &= ~NO_AUTOREPEAT;
174 w->flags &= ~FAST_REDRAW;
175 w->flags &= ~HIDE_ON_DELETE;
176 w->flags &= ~REUSE_IMAGE;
177 w->flags &= ~NO_PROPAGATE;
178 w->flags &= ~IS_SUBMENU;
179 w->flags &= ~DONT_PROPAGATE;
180 w->app = app;
181 w->parent = &win;
182 w->parent_struct = NULL;
183 w->private_struct = NULL;
184 w->label = NULL;
185 memset(w->input_label, 0, 32 * (sizeof w->input_label[0]));
186 w->state = 0;
187#ifdef __linux__
188 w->double_click = 0;
189#endif
190 w->data = 0;
191 w->x = x;
192 w->y = y;
193 w->width = width;
194 w->height = height;
195 w->scale.init_x = x;
196 w->scale.init_y = y;
197 w->scale.init_width = width;
198 w->scale.init_height = height;
199 w->scale.scale_x = 0.0;
200 w->scale.scale_y = 0.0;
201 w->scale.cscale_x = 1.0;
202 w->scale.cscale_y = 1.0;
203 w->scale.rcscale_x = 1.0;
204 w->scale.rcscale_y = 1.0;
205 w->scale.ascale = 1.0;
206 w->scale.gravity = CENTER;
207 w->adj_x = NULL;
208 w->adj_y = NULL;
209 w->adj = NULL;
210 w->color_scheme = (XColor_t*)malloc(sizeof(XColor_t));
211 memcpy(w->color_scheme, app->color_scheme, sizeof (struct XColor_t));
212 w->childlist = (Childlist_t*)malloc(sizeof(Childlist_t));
213 assert(w->childlist != NULL);
237
238 //XMapWindow(app->dpy, w->widget);
239 //debug_print("size of Func_t = %llu\n", sizeof(w->func)/sizeof(void*));
240
241 os_create_main_window_and_surface(w, app, win, x, y, width, height);
243#ifdef __linux__ // childlist already set up
245#endif
246 return w;
247}
248
250 int width = w->scale.init_width;
251 int height = w->scale.init_height;
252 assert(cairo_surface_status(w->surface) == CAIRO_STATUS_SUCCESS);
253 w->cr = cairo_create(w->surface);
254 cairo_select_font_face (w->cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
255 CAIRO_FONT_WEIGHT_NORMAL);
256
257 w->buffer = cairo_surface_create_similar (w->surface,
258 CAIRO_CONTENT_COLOR_ALPHA, width, height);
259 assert(cairo_surface_status(w->buffer) == CAIRO_STATUS_SUCCESS);
260 w->crb = cairo_create (w->buffer);
261 cairo_select_font_face (w->crb, "Sans", CAIRO_FONT_SLANT_NORMAL,
262 CAIRO_FONT_WEIGHT_NORMAL);
263}
264
266 int x, int y, int width, int height) {
267
268 Widget_t *w = (Widget_t*)malloc(sizeof(Widget_t));
269 assert(w != NULL);
270 debug_print("assert(w)\n");
271 memset(w, 0, sizeof(Widget_t));
272 w->image = NULL;
273
275 w->flags &= ~NO_AUTOREPEAT;
276 w->flags &= ~FAST_REDRAW;
277 w->flags &= ~HIDE_ON_DELETE;
278 w->flags &= ~REUSE_IMAGE;
279 w->flags &= ~NO_PROPAGATE;
280 w->flags &= ~IS_SUBMENU;
281 w->flags &= ~DONT_PROPAGATE;
282 w->app = app;
283 w->parent = parent;
284 w->parent_struct = NULL;
285 w->private_struct = NULL;
286 w->label = NULL;
287 memset(w->input_label, 0, 32 * (sizeof w->input_label[0]));
288 w->state = 0;
289#ifdef __linux__
290 w->double_click = 0;
291#endif
292 w->data = 0;
293 w->x = x;
294 w->y = y;
295 w->width = width;
296 w->height = height;
297 w->scale.gravity = CENTER;
298 w->scale.init_width = width;
299 w->scale.init_height = height;
300 w->scale.init_x = x;
301 w->scale.init_y = y;
302 w->scale.scale_x = 0.0;
303 w->scale.scale_y = 0.0;
304 w->scale.cscale_x = 1.0;
305 w->scale.cscale_y = 1.0;
306 w->scale.rcscale_x = 1.0;
307 w->scale.rcscale_y = 1.0;
308 w->scale.ascale = 1.0;
309 w->adj_x = NULL;
310 w->adj_y = NULL;
311 w->adj = NULL;
312 w->color_scheme = (XColor_t*)malloc(sizeof(XColor_t));
313 memcpy(w->color_scheme, app->color_scheme, sizeof (struct XColor_t));
314 w->childlist = (Childlist_t*)malloc(sizeof(Childlist_t));
315 assert(w->childlist != NULL);
317 childlist_add_child(parent->childlist, w);
340
341 //XMapWindow(app->dpy, w->widget);
342 //debug_print("size of Widget_t = %lld\n", sizeof(struct Widget_t));
343
344 os_create_widget_window_and_surface(w, app, parent, x, y, width, height);
346#ifdef __linux__ // childlist already set up
348#endif
349 return w;
350}
351
352void connect_func(void (**event)(), void (*handler)()) {
353 debug_print("address of a is: %p\n", (void*)event);
354 debug_print("address of b is: %p\n", (void*)handler);
355 *event = handler;
356 debug_print("address of a is: %p\n", (void*)(*event));
357}
358
359void widget_set_title(Widget_t *w, const char *title) {
360 os_set_title(w, title);
361}
362
364 w->func.map_notify_callback(w, NULL);
366}
367
369 int i=0;
370 for(;i<w->childlist->elem;i++) {
372 }
373 w->func.unmap_notify_callback(w, NULL);
375}
376
378 int i=0;
379 for(;i<w->app->childlist->elem;i++) {
381 }
382 w->func.unmap_notify_callback(w, NULL);
384}
385
387 if (w->flags & IS_POPUP || w->flags & IS_TOOLTIP ||
388 w->flags & IS_SUBMENU) {
389 return;
390 } else {
391 w->func.map_notify_callback(w, NULL);
393 int i=0;
394 for(;i<w->childlist->elem;i++) {
396 }
397 }
398}
399
401 if (w->flags & IS_SUBMENU) return;
402 w->func.map_notify_callback(w, NULL);
404 int i=0;
405 for(;i<w->childlist->elem;i++) {
407 }
408}
409
411 w->func.map_notify_callback(w, NULL);
413 int i=0;
414 for(;i<w->childlist->elem;i++) {
416 }
417}
418
420 int i = 0;
421 for(;i<wid->childlist->elem;i++) {
422 Widget_t *w = wid->childlist->childs[i];
423 if (w->flags & IS_TOOLTIP) {
424 os_show_tooltip(wid, w);
425 break;
426 }
427 }
428}
429
431 int i = 0;
432 for(;i<wid->childlist->elem;i++) {
433 Widget_t *w = wid->childlist->childs[i];
434 if (w->flags & IS_TOOLTIP) {
435 widget_hide(w);
436 break;
437 }
438 }
439}
440
442 return main->childlist->childs[0];
443}
444
448
449void transparent_draw(void * w_, void* user_data) {
450 Widget_t *wid = (Widget_t*)w_;
451 Metrics_t m;
452 os_get_window_metrics(wid, &m);
453 if (!m.visible) return;
454
455 cairo_push_group (wid->cr);
456
457 if (wid->flags & USE_TRANSPARENCY) {
458 Widget_t *parent = (Widget_t*)wid->parent;
459
460 debug_print("Widget_t _transparency \n");
461 cairo_set_source_surface (wid->crb, parent->buffer, -m.x, -m.y);
462 cairo_paint (wid->crb);
463 }
464
465 cairo_push_group (wid->crb);
466 wid->func.expose_callback(wid, user_data);
467 cairo_pop_group_to_source (wid->crb);
468 cairo_paint (wid->crb);
469
470 cairo_set_source_surface (wid->cr, wid->buffer,0,0);
471 cairo_paint (wid->cr);
472
473 cairo_pop_group_to_source (wid->cr);
474 cairo_paint (wid->cr);
475 if ( wid->flags & DONT_PROPAGATE) return;
477}
478
479void widget_draw(void * w_, void* user_data) {
480 Widget_t *wid = (Widget_t*)w_;
481
482 cairo_push_group (wid->cr);
483
484 if (wid->flags & USE_TRANSPARENCY) {
485 Widget_t *parent = (Widget_t*)wid->parent;
486 Metrics_t m;
487 os_get_window_metrics(wid, &m);
488
489 debug_print("Widget_t draw widget \n");
490 cairo_set_source_surface (wid->crb, parent->buffer, -m.x, -m.y);
491 cairo_paint (wid->crb);
492 }
493
494 cairo_push_group (wid->crb);
495 wid->func.expose_callback(wid, user_data);
496 cairo_pop_group_to_source (wid->crb);
497 cairo_paint (wid->crb);
498
499 cairo_set_source_surface (wid->cr, wid->buffer,0,0);
500 cairo_paint (wid->cr);
501
502 cairo_pop_group_to_source (wid->cr);
503 cairo_paint (wid->cr);
504}
505
506void widget_event_loop(void *w_, void* event, Xputty *main, void* user_data) {
507 os_widget_event_loop(w_, event, main, user_data);
508}
509
510void send_configure_event(Widget_t *w,int x, int y, int width, int height) {
511 os_send_configure_event(w, x, y, width, height);
512}
513
517
521
525
526void quit(Widget_t *w) {
527 os_quit(w);
528}
529
531 os_quit(w);
532}
533
Childlist_t - struct to hold a Widget_t child list Xputty main holds a list of any Widget_t created...
Definition xchildlist.h:49
Widget_t ** childs
Definition xchildlist.h:51
xevfunc configure_notify_callback
Definition xwidget.h:93
evfunc button_release_callback
Definition xwidget.h:101
xevfunc configure_callback
Definition xwidget.h:86
xevfunc map_notify_callback
Definition xwidget.h:94
xevfunc unmap_notify_callback
Definition xwidget.h:95
xevfunc expose_callback
Definition xwidget.h:85
evfunc key_release_callback
Definition xwidget.h:105
evfunc key_press_callback
Definition xwidget.h:104
xevfunc visibiliy_change_callback
Definition xwidget.h:98
evfunc double_click_callback
Definition xwidget.h:102
xevfunc leave_callback
Definition xwidget.h:88
xevfunc adj_callback
Definition xwidget.h:89
xevfunc value_changed_callback
Definition xwidget.h:90
xevfunc dnd_notify_callback
Definition xwidget.h:97
xevfunc user_callback
Definition xwidget.h:91
xevfunc mem_free_callback
Definition xwidget.h:92
evfunc motion_callback
Definition xwidget.h:103
xevfunc enter_callback
Definition xwidget.h:87
evfunc button_press_callback
Definition xwidget.h:100
xevfunc dialog_callback
Definition xwidget.h:96
Metrics_t - struct to receive window size, position & visibility Pass this struct to os_get_window_...
int init_height
Definition xwidget.h:355
float scale_y
Definition xwidget.h:359
float ascale
Definition xwidget.h:369
float cscale_y
Definition xwidget.h:363
Gravity gravity
Definition xwidget.h:347
float rcscale_x
Definition xwidget.h:365
float cscale_x
Definition xwidget.h:361
int init_width
Definition xwidget.h:353
int init_y
Definition xwidget.h:351
int init_x
Definition xwidget.h:349
float rcscale_y
Definition xwidget.h:367
float scale_x
Definition xwidget.h:357
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
int y
Definition xwidget.h:519
Resize_t scale
Definition xwidget.h:525
Adjustment_t * adj_y
Definition xwidget.h:495
vfunc event_callback
Definition xwidget.h:479
Adjustment_t * adj_x
Definition xwidget.h:493
int width
Definition xwidget.h:521
WidgetType widget_type
Definition xwidget.h:477
XColor_t * color_scheme
Definition xwidget.h:467
cairo_surface_t * image
Definition xwidget.h:491
Adjustment_t * adj
Definition xwidget.h:497
void * parent
Definition xwidget.h:471
int x
Definition xwidget.h:517
cairo_surface_t * surface
Definition xwidget.h:483
cairo_surface_t * buffer
Definition xwidget.h:487
cairo_t * crb
Definition xwidget.h:489
int state
Definition xwidget.h:511
Childlist_t * childlist
Definition xwidget.h:499
int data
Definition xwidget.h:509
xevfunc xpaste_callback
Definition xwidget.h:533
long long flags
Definition xwidget.h:461
char input_label[32]
Definition xwidget.h:459
void * private_struct
Definition xwidget.h:475
const char * label
Definition xwidget.h:463
Time double_click
Definition xwidget.h:506
cairo_t * cr
Definition xwidget.h:485
void * parent_struct
Definition xwidget.h:473
int height
Definition xwidget.h:523
Func_t func
Definition xwidget.h:481
Xputty * app
Definition xwidget.h:465
XColor_t - the Widget_t Color struct XColor_t could be used for theming you Widget_t set.
Definition xcolor.h:105
unsigned int state
int keycode
Xputty - the main struct. It should be declared before any other call to a Xputty function....
Definition xputty.h:228
XColor_t * color_scheme
Definition xputty.h:234
bool run
Definition xputty.h:256
Childlist_t * childlist
Definition xputty.h:230
void * delete_adjustment(Adjustment_t *adj)
delete_adjustment - freeing the memory of the Adjustment_t You usually don't need to call this,...
void childlist_add_child(Childlist_t *childlist, Widget_t *child)
childlist_add_child - internal use to add a child to the Childlist_t You usually didn't need to cal...
Definition xchildlist.c:42
int childlist_find_child(Childlist_t *childlist, Widget_t *child)
childlist_find_child - find a child in a the Childlist_t this could be sued to check if a Widget_t is...
Definition xchildlist.c:69
void childlist_destroy(Childlist_t *childlist)
childlist_destroy - internal use to free the Childlist_t You usually didn't need to call this
Definition xchildlist.c:38
void childlist_remove_child(Childlist_t *childlist, Widget_t *child)
childlist_remove_child - internal use to remove a child from the childlist You usually didn't need ...
Definition xchildlist.c:55
void childlist_init(Childlist_t *childlist)
childlist_init - internal use to allocate the array to min size You usually didn't need to call thi...
Definition xchildlist.c:25
int childlist_has_child(Childlist_t *childlist)
childlist_has_child - check if a Widget_t Childlist_t contain a child
Definition xchildlist.c:89
XID Display
HWND Window
void os_get_window_metrics(Widget_t *w, Metrics_t *metrics)
os_get_window_metrics - Get the Merics_t struct related to a Widget_t
void os_widget_show(Widget_t *w)
os_widget_show - Show a Widget_t
void os_widget_hide(Widget_t *w)
os_widget_hide - Hide a Widget_t
void os_destroy_window(Widget_t *w)
os_destroy_window - destroy a widget (close and remove from processing)
void os_send_button_press_event(Widget_t *w)
os_send_button_press_event - Send a button press event to a Widget_t see XButtonEvent
void os_send_button_release_event(Widget_t *w)
os_send_button_release_event - Send a button release event to a Widget_t see XButtonEvent
void os_send_systray_message(Widget_t *w)
os_send_send_systray_message - Send a systray event to a Widget_t only working on Linux for now
void os_send_configure_event(Widget_t *w, int x, int y, int width, int height)
os_send_configure_event - Send a configure event to a Widget_t
void os_set_title(Widget_t *w, const char *title)
os_set_title - Set the title of a Widget_t
void os_quit(Widget_t *w)
os_quit - quit the main loop and free all used memory
void os_show_tooltip(Widget_t *wid, Widget_t *w)
os_show_tooltip - Show a tooltip of a Widget_t
void os_widget_event_loop(void *w_, void *event, Xputty *main, void *user_data)
os_widget_event_loop - the Widget_t event loop on windows all messges goes into WndProc,...
void os_transparent_draw(void *w_, void *user_data)
os_transparent_draw - Draw the Widget_t to the back buffer
void os_create_widget_window_and_surface(Widget_t *w, Xputty *app, Widget_t *parent, int x, int y, int width, int height)
os_create_main_widget_and_surface - create a Widget_t with a acairo surface this function is used mai...
void os_create_main_window_and_surface(Widget_t *w, Xputty *app, Window win, int x, int y, int width, int height)
os_create_main_window_and_surface - create a Widget_t with a acairo surface this function is used mai...
void os_adjustment_callback(void *w_, void *user_data)
os_adjustment_callback - called when a adjustment value have changed used internal for redraw the Wid...
void os_expose_widget(Widget_t *w)
os_expose_widget - Draw the the back buffer to the Widget_t surface
void widget_set_title(Widget_t *w, const char *title)
widget_set_title - set window title for a Widget_t
Definition xwidget.c:359
Widget_t * create_widget(Xputty *app, Widget_t *parent, int x, int y, int width, int height)
*create_widget - create a widget A Widget_t could only be created as child of a other Widget_t To...
Definition xwidget.c:265
void widget_set_scale(Widget_t *w)
widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface
Definition xwidget.c:159
void transparent_draw(void *w_, void *user_data)
transparent_draw - copy parent surface to child surface you usaualy didn't need to call this,...
Definition xwidget.c:449
int key_mapping(Display *dpy, XKeyEvent *xkey)
_key_mapping - modifier key's mapped to a integer value
Definition xwidget.c:37
void expose_widget(Widget_t *w)
expose_widgets - send a expose event (EXPOSE) to a Widget_t
Definition xwidget.c:445
void quit_widget(Widget_t *w)
quit_widget - remove a widget from the processing loop
Definition xwidget.c:530
void create_cairo_context_and_buffer(Widget_t *w)
Definition xwidget.c:249
void send_button_release_event(Widget_t *w)
send_button_release_event - send ButtonRelease event to Widget_t simulate a BUTTON_RELEASE Event
Definition xwidget.c:518
Widget_t * create_window(Xputty *app, Window win, int x, int y, int width, int height)
*create_window - create a Window You need to create as least minimun one Window to get started....
Definition xwidget.c:163
Widget_t * get_toplevel_widget(Xputty *main)
*get_toplevel_widget - get pointer to the top level Widget_t
Definition xwidget.c:441
void connect_func(void(**event)(), void(*handler)())
connect_func - connect a event with a handler without type check. For supported events see: Func_t
Definition xwidget.c:352
void widget_event_loop(void *w_, void *event, Xputty *main, void *user_data)
widget_event_loop - the internal widget event loop
Definition xwidget.c:506
void quit(Widget_t *w)
quit - exit the main loop
Definition xwidget.c:526
void show_tooltip(Widget_t *wid)
show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available.
Definition xwidget.c:419
void widget_draw(void *w_, void *user_data)
widget_draw - redraw only the widget,not the child widgets
Definition xwidget.c:479
void submenu_widget_show_all(Widget_t *w)
submenu_widget_show_all - map/show submenu Widget_t with all childs
Definition xwidget.c:410
void hide_tooltip(Widget_t *wid)
hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped.
Definition xwidget.c:430
void send_configure_event(Widget_t *w, int x, int y, int width, int height)
send_configure_event - send a ConfigureNotify to Widget_t used to resize a Widget_t
Definition xwidget.c:510
void widget_show(Widget_t *w)
widget_show - map/show widget
Definition xwidget.c:363
void widget_reset_scale(Widget_t *w)
widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surfac...
Definition xwidget.c:155
void widget_show_all(Widget_t *w)
widget_show_all - map/show Widget_t with all childs
Definition xwidget.c:386
const char * widget_type_name(Widget_t *w)
widget_type_name - textual representation of (Widget_t*)->widget_type
Definition xwidget.c:27
void widget_hide(Widget_t *w)
widget_hide - unmap/hide a Widget_t
Definition xwidget.c:368
void send_systray_message(Widget_t *w)
send_systray_message - request a systray icon for Widget_t currently not working
Definition xwidget.c:522
void destroy_widget(Widget_t *w, Xputty *main)
destroy_widget - destroy a widget When a Widget_t receive a destroy_widget() call,...
Definition xwidget.c:86
void configure_event(void *w_, void *user_data)
Definition xwidget.c:128
void resize_childs(Widget_t *w)
resize_childs - intern check if child widgets needs resizing
Definition xwidget.c:151
void send_button_press_event(Widget_t *w)
send_button_press_event - send ButtonPress event to Widget_t simulate a BUTTON_PRESS Event
Definition xwidget.c:514
void widget_hide_all(Widget_t *w)
widget_hide_all - unmap/hide all Widget_t from app
Definition xwidget.c:377
void pop_widget_show_all(Widget_t *w)
pop_widget_show_all - map/show popup widget with all it's childs
Definition xwidget.c:400
This file contains definitions and structs used on all platforms. Platform specific definitions are l...
@ CENTER
Definition xwidget.h:320
@ IS_TOOLTIP
Definition xwidget.h:396
@ IS_WIDGET
Definition xwidget.h:388
@ USE_TRANSPARENCY
Definition xwidget.h:398
@ HAS_MEM
Definition xwidget.h:406
@ IS_WINDOW
Definition xwidget.h:390
@ DONT_PROPAGATE
Definition xwidget.h:420
@ REUSE_IMAGE
Definition xwidget.h:414
@ IS_POPUP
Definition xwidget.h:392
@ IS_SUBMENU
Definition xwidget.h:418
This file contains private function definitions used on all platforms.
void _resize_surface(Widget_t *wid, int width, int height)
_resize_surface - intern check if a Widget_t surfaces needs resizing
void _resize_childs(Widget_t *wid)
_resize_childs - intern check if child widgets needs resizing
void _dummy_callback(void *w_, void *user_data)
_dummy1_callback - default debuging callback for xevfunc's
void _propagate_child_expose(Widget_t *wid)
_propagate_child_expose - send expose to any child Widget_t
void _dummy1_callback(void *w_, void *_data, void *user_data)
_dummy1_callback - default debuging callback for evfunc's