libxputty  0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
xwidget.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 #pragma once
22 
23 #ifndef XWIDGET_H
24 #define XWIDGET_H
25 
26 #include "xputty.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*---------------------------------------------------------------------
33 -----------------------------------------------------------------------
34  basic X11 widgets
35 -----------------------------------------------------------------------
36 ----------------------------------------------------------------------*/
37 
38 #define SYSTEM_TRAY_REQUEST_DOCK 0
39 #define SYSTEM_TRAY_BEGIN_MESSAGE 1
40 #define SYSTEM_TRAY_CANCEL_MESSAGE 2
41 
42 /**
43  * @brief *vfunc - function pointer to connect Xevents from the main loop to Widget_t
44  * @param *widget - void pointer to the Widget_t
45  * @param *main - pointer to Xputty main struct running the loop
46  * @param *event - void pointer to the XEvent
47  * @param *user_data - void pointer to attached user_data, maybe NULL
48  * @return void
49  */
50 
51 typedef void (*vfunc)(void * widget, void * event, Xputty *main, void* user_data);
52 
53 /**
54  * @brief *evfunc - function pointer to connect Xevents from a Widget_t to a event handler
55  * @param *widget - void pointer to the Widget_t
56  * @param *event - void pointer to the XEvent
57  * @param *user_data - void pointer to attached user_data, maybe NULL
58  * @return void
59  */
60 
61 typedef void (*evfunc)(void * widget, void * event, void* user_data);
62 
63 
64 /**
65  * @brief *xevfunc - function pointer to connect XEvents from a Widget_t to a event handler
66  * @param *widget - void pointer to the widget
67  * @param *user_data - void pointer to attached user_data, maybe NULL
68  * @return void
69  */
70 
71 typedef void (*xevfunc)(void * widget, void* user_data);
72 
73 /**
74  *
75  * @brief Func_t - struct to hold all supported event callbacks
76  *
77  */
78 
79 typedef struct {
92 
98 } Func_t;
99 
100 /**
101  *
102  * @brief EventType - enum to hold identifier for all supported event callbacks
103  * \n Events could be connected to a handler by using this identifier
104  * @param EXPOSE - (*xevfunc) expose_callback(void * widget, void* user_data)
105  * @param CONFIGURE - (*xevfunc) configure_callback(void * widget, void* user_data)
106  * @param ENTER - (*xevfunc) enter_callback(void * widget, void* user_data)
107  * @param LEAVE - (*xevfunc) leave_callback(void * widget, void* user_data)
108  * @param ADJ_INTERN - (*xevfunc) adj_callback(void * widget, void* user_data)
109  * @param VALUE_CHANGED - (*xevfunc) value_changed_callback(void * widget, void* user_data)
110  * @param USER - (*xevfunc) user_callback(void * widget, void* user_data)
111  * @param MEM_FREE - (*xevfunc) mem_free_callback(void * widget, void* user_data)
112  * @param CONFIGURE_NOTIFY - (*xevfunc) configure_notify_callback(void * widget, void* user_data)
113  * @param MAP_NOTIFY - (*xevfunc) map_notify_callback(void * widget, void* user_data)
114  * @param UNMAP_NOTIFY - (*xevfunc) unmap_notify_callback(void * widget, void* user_data)
115  * @param DIALOG_RESPONS - (*xevfunc) dialog_callback(void * widget, void* user_data)
116  * @param BUTTON_PRESS - (*evfunc) button_press_callback(void * widget, void * event, void* user_data)
117  * @param BUTTON_RELEASE - (*evfunc) button_release_callback(void * widget, void * event, void* user_data)
118  * @param POINTER_MOTION - (*evfunc) motion_callback(void * widget, void * event, void* user_data)
119  * @param KEY_PRESS - (*evfunc) key_press_callback(void * widget, void * event, void* user_data)
120  * @param KEY_RELEASE - (*evfunc) key_release_callback(void * widget, void * event, void* user_data)
121  */
122 
123 typedef enum {
124  EXPOSE = 1,
141 } EventType;
142 
143 /**
144  *
145  * @brief Gravity - enum to indicate how to resize a widget
146  * @param NORTHWEST - Widget_t adjust nord/west
147  * @param NORTHEAST - Widget_t adjust nord/east
148  * @param SOUTHWEST - Widget_t adjust south/west
149  * @param SOUTHEAST - Widget_t adjust south/east
150  * @param CENTER - Widget_t adjust centered
151  * @param ASPECT - Widget_t adjust in a aspect frame
152  * @param NONE - Widget_t request no adjustment in frame
153  */
154 
155 typedef enum {
156 /** Widget_t adjust nord/west */
158 /** Widget_t adjust nord/east */
160 /** Widget_t adjust south/west */
162 /** Widget_t adjust south/east */
164 /** Widget_t adjust centered */
166 /** Widget_t adjust in a aspect frame */
168 /** Widget_t has fixed size */
170 /** Widget_t adjust in a aspect frame */
172 /** Widget_t request no adjustment in frame */
173  NONE ,
174 }Gravity;
175 
176 /**
177  *
178  * @brief Resize_t - struct used to resize child widgets
179  * @param init_x - initial x position on Parent
180  * @param init_y - initial y position on Parent
181  * @param init_width - initial width
182  * @param init_height - initial height
183  * @param scale_x - scalling size of the x axsis
184  * @param scale_y - scalling size of the y axsis
185  * @param cscale_x - scalling factor of the x axsis
186  * @param cscale_y - scalling factor of the y axsis
187  * @param ascale - scalling factor for aspect scalling
188  */
189 
190 typedef struct {
191 /** indicate how the widget wish to be resized */
193 /** initial x position on Parent */
194  int init_x;
195 /** initial y position on Parent */
196  int init_y;
197 /** initial width */
199 /** initial height */
201 /** scalling size of the x axsis */
202  float scale_x;
203 /** scalling size of the y axsis */
204  float scale_y;
205 /** scalling factor of the x axsis */
206  float cscale_x;
207 /** scalling factor of the y axsis */
208  float cscale_y;
209 /** rescalling factor of the x axsis */
210  float rcscale_x;
211 /** rescalling factor of the y axsis */
212  float rcscale_y;
213 /** scalling factor for aspect scalling */
214  float ascale;
215 } Resize_t;
216 
217 /**
218  *
219  * @brief anonymous enum - flags to set Widget_t propertys
220  * @param IS_WIDGET - Widget_t is a sub widget
221  * @param IS_WINDOW - Widget_t has no Widget_t parent
222  * @param IS_POPUP - Widget_t is a pop up widget
223  * @param IS_RADIO - Widget_t is part of a radio group
224  * @param USE_TRANSPARENCY - Widget_t need transparent draw (buffer)
225  * @param HAS_FOCUS - Mouse pointer is above Widget_t
226  * @param HAS_POINTER - Mouse pointer is pressed on Widget_t
227  * @param HAS_TOOLTIP - Widget_t have tooltip
228  * @param HAS_MEM - Widget_t have mem to be released
229  */
230 
231 enum {
232  /** Widget_t is a sub widget */
233  IS_WIDGET = 1<<0,
234  /** Widget_t has no Widget_t parent */
235  IS_WINDOW = 1<<1,
236  /** Widget_t is a pop up widget */
237  IS_POPUP = 1<<2,
238  /** Widget_t is part of a radio group */
239  IS_RADIO = 1<<3,
240  /** Widget_t is a tooltip widget */
241  IS_TOOLTIP = 1<<4,
242  /** Widget_t need transparent draw (buffer) */
244  /** Mouse pointer is above Widget_t */
245  HAS_FOCUS = 1<<6,
246  /** Mouse pointer is pressed on Widget_t */
247  HAS_POINTER = 1<<7,
248  /** Widget_t have tooltip */
249  HAS_TOOLTIP = 1<<8,
250  /** Widget_t have mem to be released */
251  HAS_MEM = 1<<9,
252  /** Widget_t didn't receive autorepeated keys */
253  NO_AUTOREPEAT = 1<<10,
254  /** Widget_t need fast redrawing */
255  FAST_REDRAW = 1<<11,
256  /** Hide Widget_t instead delete on "WM_DELETE_WINDOW" */
257  HIDE_ON_DELETE = 1<<12,
258  /** Widget_t reuse a surface from a other Widget_t */
259  REUSE_IMAGE = 1<<13,
260  /** Widget_t didn't receive redraw events on propagate */
261  NO_PROPAGATE = 1<<14,
262 
263 };
264 
265 /**
266  *
267  * @brief Widget_t - struct to hold the basic Widget_t info
268  * @param *app - pointer to the main struct
269  * @param widget - the X11 Window
270  * @param *parent - pointer to the Parent Window or Widget_t
271  * @param event_callback - the main XEvent callback
272  * @param func - struct holding the event callbacks
273  * @param *surface - pointer to the cairo xlib surface
274  * @param *cr - pointer to the cairo xlib surface context
275  * @param *buffer - pointer to the cairo buffer surface
276  * @param *crb - pointer to the cairo buffer surface context
277  * @param *image - pointer to the cairo image surface
278  * @param data - int to hold user data
279  * @param flags - unsigned int to hold Widget_t flags
280  * @param *label - pointer to the widget label
281  * @param input_label - char array the widget input label
282  * @param state - int to hold the widget state
283  * @param pos_x - mouse pointer x position on button press
284  * @param pos_y - mouse pointer y position on button press
285  * @param x - x position of Window on Parent
286  * @param y - y position of Window on Parent
287  * @param width - widget width
288  * @param height - widget height
289  * @param scale - struct used to resize child widgets
290  * @param *adj_x - pointer to the x axis adjustment
291  * @param *adj_y - pointer to the y axis adjustment
292  * @param *adj - pointer to the adjustment in use
293  * @param *childlist - pointer to Widget_t child list
294  * @param xic - Locale and UTF 8 support interface
295  * @param xim - Context to Locale and UTF 8 support
296  */
297 
298 struct Widget_t {
299 /** pointer to the main struct */
301 /** the X11 newly created Window */
302  Window widget;
303 /** pointer to the Parent Window or Widget_t */
304  void *parent;
305 /** pointer to the Parent struct */
307 /** the main XEvent callback */
309 /** struct holding the event callbacks */
311 /** pointer to the cairo xlib surface */
312  cairo_surface_t *surface;
313 /** pointer to the cairo xlib surface context */
314  cairo_t *cr;
315 /** pointer to the cairo buffer surface used for transparency */
316  cairo_surface_t *buffer;
317 /** pointer to the cairo buffer surface context */
318  cairo_t *crb;
319 /** pointer to the cairo image surface used to load a png */
320  cairo_surface_t *image;
321 /** int to hold user data */
322  int data;
323 /** int to hold Widget_t flags */
324  long long flags;
325 /** pointer to the widget label */
326  const char* label;
327 /** char array to hold user input */
328  char input_label[32];
329 /** pointer to the x axis adjustment */
331 /** pointer to the y axis adjustment */
333 /** pointer to the adjustment in use*/
335 /** pointer to Widget_t child list */
337 /** Locale and UTF 8 support */
338  XIC xic;
339 /** Context to Locale and UTF 8 support */
340  XIM xim;
341 /** int to hold the widget state default = 0 */
342  int state;
343 /** mouse pointer x position on button press */
344  int pos_x;
345 /** mouse pointer y position on button press */
346  int pos_y;
347 /** x position of Window related to the Parent */
348  int x;
349 /** y position of Window related to the Parent */
350  int y;
351 /** the widget size x-axis */
352  int width;
353 /** the widget size y-axis */
354  int height;
355 /** struct used to resize child widgets */
357 };
358 
359 
360 /**
361  * @brief *create_window - create a Window
362  * \n You need to create as least minimun one Window to get started.
363  * \n The first created Window is the top_level_widget()
364  * \n A Window could be created on the DefaultRootWindow() or embeded
365  * into a other XWindow
366  * @param *app - pointer to the Xputty *main struct to use
367  * @param win - pointer to the Parrent Window (may be Root)
368  * @param x,y,width,height - the position/geometry to create the window
369  * @return Widget_t * - pointer to the Widget_t struct
370  */
371 
372 Widget_t *create_window(Xputty *app, Window win,
373  int x, int y, int width, int height);
374 
375 /**
376  * @brief *create_widget - create a widget
377  * \n A Widget_t could only be created as child of a other Widget_t
378  * \n To create a Widget_t you need to create a Widget_t with create_window()
379  * before.
380  * @param *app - pointer to the Xputty *main struct to use
381  * @param *parent - pointer to the Parrent Widget_t
382  * @param x,y,width,height - the position/geometry to create the widget
383  * @return Widget_t* - pointer to the Widget_t struct
384  */
385 
387  int x, int y, int width, int height);
388 
389 /**
390  * @brief connect_func - connect a event with a handler
391  * without type check. For supported events see: Func_t
392  * @param **event - the event to connect
393  * @param *handler - the handler to handle the event
394  * @return void
395  */
396 
397 void connect_func(void (**event)(), void (*handler)());
398 
399 /**
400  * @brief widget_set_title - set window title for a Widget_t
401  * @param *w - pointer to the Widget_t to set the title
402  * @param *title - the title to store
403  * @return void
404  */
405 
406 void widget_set_title(Widget_t *w, const char *title);
407 
408 /**
409  * @brief widget_show - map/show widget
410  * @param *w - pointer to the Widget_t to map
411  * @return void
412  */
413 
414 void widget_show(Widget_t *w);
415 
416 /**
417  * @brief pop_widget_show_all - map/show popup widget with all it's childs
418  * @param *w - pointer to the Widget_t to map
419  * @return void
420  */
421 
423 
424 /**
425  * @brief widget_hide - unmap/hide a Widget_t
426  * @param *w - pointer to the Widget_t to unmap
427  * @return void
428  */
429 
430 void widget_hide(Widget_t *w);
431 
432 /**
433  * @brief widget_show_all - map/show Widget_t with all childs
434  * @param *w - pointer to the Widget_t to map
435  * @return void
436  */
437 
438 void widget_show_all(Widget_t *w);
439 
440 /**
441  * @brief show_tooltip - check if a Widget_t have a tooltip,
442  * and show it, if a tooltip is available.
443  * @param *wid - pointer to the Widget_t receiving the event
444  * @return void
445  */
446 
447 void show_tooltip(Widget_t *wid);
448 
449 /**
450  * @brief hide_tooltip - check if a Widget_t have a tooltip,
451  * and hide it, if a tooltip is mapped.
452  * @param *wid - pointer to the Widget_t receiving the event
453  * @return void
454  */
455 
456 void hide_tooltip(Widget_t *wid);
457 
458 /**
459  * @brief *get_toplevel_widget - get pointer to the top level Widget_t
460  * @param *main - pointer to the main Xputty struct
461  * @return void
462  */
463 
465 
466 /**
467  * @brief quit - exit the main loop
468  * @param *w - pointer to the Widget_t sending the request
469  * @return void
470  */
471 
472 void quit(Widget_t *w);
473 
474 /**
475  * @brief quit_widget - remove a widget from the processing loop
476  * @param *w - pointer to the Widget_t sending the request
477  * @return void
478  */
479 
480 void quit_widget(Widget_t *w);
481 
482 /**
483  * @brief transparent_draw - copy parent surface to child surface
484  * \n you usaualy didn't need to call this, it's used automaticaly
485  * when a Widget_t have set the flag USE_TRANSPARENCY
486  * \n this is the default setting for Widget_t
487  * @param *wid - pointer to the Widget_t receiving the event
488  * @param *user_data - void pointer to attached user_data
489  * @return void
490  */
491 
492 void transparent_draw(void * wid, void* user_data);
493 
494 /**
495  * @brief widget_reset_scale - used to reset scaling mode after a image surface
496  * is drawn to the Widget_t surface with widget_set_scale()
497  * @param *w - pointer to the Widget_t sending the request
498  * @return void
499  */
500 
502 
503 /**
504  * @brief widget_set_scale - set scaling mode to scale a image surface
505  * to the size of the Widget_t surface
506  * @param *w - pointer to the Widget_t sending the request
507  * @return void
508  */
509 
510 void widget_set_scale(Widget_t *w);
511 
512 /**
513  * @brief destroy_widget - destroy a widget
514  * \n When a Widget_t receive a destroy_widget() call, it will propagate that
515  * to all childs in it's Childlist_t. So all childs get destroyed before the
516  * Widget_t itself close.
517  * @param *w - pointer to the Widget_t sending the request
518  * @param *main - pointer to main struct
519  * @return void
520  */
521 
522 void destroy_widget(Widget_t *w, Xputty *main);
523 
524 /**
525  * @brief widget_event_loop - the internal widget event loop
526  * @param *w - void pointer to the Widget_t receiving the event
527  * @param *event - void pointer to the XEvent
528  * @param *main - void pointer to the Xputty *main struct running
529  * the event loop
530  * @param *user_data - void pointer to attached user_data
531  * @return void
532  */
533 
534 void widget_event_loop(void *w_, void* event, Xputty *main, void* user_data);
535 
536 /**
537  * @brief send_configure_event - send a ConfigureNotify to Widget_t
538  * \n used to resize a Widget_t
539  * @param *w - pointer to the Widget_t to send the notify
540  * @param x,y - the new Widget_t position
541  * @param width,height - the new Widget_t size
542  * @return void
543  */
544 
545 void send_configure_event(Widget_t *w,int x, int y, int width, int height);
546 
547 /**
548  * @brief send_button_press_event - send ButtonPress event to Widget_t
549  * \n simulate a BUTTON_PRESS Event
550  * @param *w - pointer to the Widget_t to send the notify
551  * @return void
552  */
553 
555 
556 /**
557  * @brief send_button_release_event - send ButtonRelease event to Widget_t
558  * \n simulate a BUTTON_RELEASE Event
559  * @param *w - pointer to the Widget_t to send the notify
560  * @return void
561  */
562 
564 
565 /**
566  * @brief send_systray_message - request a systray icon for Widget_t
567  * \n currently not working
568  * @param *w - pointer to the Widget_t to send the notify
569  * @return void
570  */
571 
573 
574 /**
575  * @brief expose_widgets - send a expose event (EXPOSE) to a Widget_t
576  * @param w - the Widget_t to send the event to
577  * @return void
578  */
579 
580 void expose_widget(Widget_t *w);
581 
582 /**
583  * @brief _key_mapping - modifier key's mapped to a integer value
584  * @param *dpy - pointer to the Display in use
585  * @param *xkey - the key to map
586  * @return int - value (1-10) or 0 when not mapped
587  */
588 
589 int key_mapping(Display *dpy, XKeyEvent *xkey);
590 
591 #ifdef __cplusplus
592 }
593 #endif
594 
595 #endif //XWIDGET_H
Func_t::leave_callback
xevfunc leave_callback
Definition: xwidget.h:83
CONFIGURE_NOTIFY
@ CONFIGURE_NOTIFY
Definition: xwidget.h:132
HAS_TOOLTIP
@ HAS_TOOLTIP
Definition: xwidget.h:249
Func_t::enter_callback
xevfunc enter_callback
Definition: xwidget.h:82
Xputty
Xputty - the main struct. It should be declared before any other call to a Xputty function....
Definition: xputty.h:177
send_button_press_event
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:630
NORTHWEST
@ NORTHWEST
Definition: xwidget.h:157
Widget_t::y
int y
Definition: xwidget.h:350
expose_widget
void expose_widget(Widget_t *w)
expose_widgets - send a expose event (EXPOSE) to a Widget_t
Definition: xwidget.c:461
POINTER_MOTION
@ POINTER_MOTION
Definition: xwidget.h:138
Resize_t::scale_x
float scale_x
Definition: xwidget.h:202
SOUTHWEST
@ SOUTHWEST
Definition: xwidget.h:161
Func_t::configure_callback
xevfunc configure_callback
Definition: xwidget.h:81
Widget_t::width
int width
Definition: xwidget.h:352
Resize_t::gravity
Gravity gravity
Definition: xwidget.h:192
BUTTON_RELEASE
@ BUTTON_RELEASE
Definition: xwidget.h:137
Resize_t::init_x
int init_x
Definition: xwidget.h:194
quit
void quit(Widget_t *w)
quit - exit the main loop
Definition: xwidget.c:701
pop_widget_show_all
void pop_widget_show_all(Widget_t *w)
pop_widget_show_all - map/show popup widget with all it's childs
Definition: xwidget.c:418
widget_set_title
void widget_set_title(Widget_t *w, const char *title)
widget_set_title - set window title for a Widget_t
Definition: xwidget.c:387
hide_tooltip
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:446
Widget_t::image
cairo_surface_t * image
Definition: xwidget.h:320
Resize_t::scale_y
float scale_y
Definition: xwidget.h:204
MENUITEM
@ MENUITEM
Definition: xwidget.h:171
vfunc
void(* vfunc)(void *widget, void *event, Xputty *main, void *user_data)
*vfunc - function pointer to connect Xevents from the main loop to Widget_t
Definition: xwidget.h:51
Widget_t::data
int data
Definition: xwidget.h:322
widget_show
void widget_show(Widget_t *w)
widget_show - map/show widget
Definition: xwidget.c:391
Resize_t::cscale_y
float cscale_y
Definition: xwidget.h:208
key_mapping
int key_mapping(Display *dpy, XKeyEvent *xkey)
_key_mapping - modifier key's mapped to a integer value
Definition: xwidget.c:26
connect_func
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:380
Widget_t::parent_struct
void * parent_struct
Definition: xwidget.h:306
REUSE_IMAGE
@ REUSE_IMAGE
Definition: xwidget.h:259
NONE
@ NONE
Definition: xwidget.h:173
send_button_release_event
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:649
widget_set_scale
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:141
Func_t::key_release_callback
evfunc key_release_callback
Definition: xwidget.h:97
NO_AUTOREPEAT
@ NO_AUTOREPEAT
Definition: xwidget.h:253
create_widget
Widget_t * create_widget(Xputty *app, Widget_t *win, 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:268
transparent_draw
void transparent_draw(void *wid, void *user_data)
transparent_draw - copy parent surface to child surface you usaualy didn't need to call this,...
Definition: xwidget.c:469
Func_t::expose_callback
xevfunc expose_callback
Definition: xwidget.h:80
Widget_t::pos_y
int pos_y
Definition: xwidget.h:346
CENTER
@ CENTER
Definition: xwidget.h:165
IS_WINDOW
@ IS_WINDOW
Definition: xwidget.h:235
HAS_POINTER
@ HAS_POINTER
Definition: xwidget.h:247
Widget_t::crb
cairo_t * crb
Definition: xwidget.h:318
LEAVE
@ LEAVE
Definition: xwidget.h:127
HAS_FOCUS
@ HAS_FOCUS
Definition: xwidget.h:245
Resize_t::rcscale_y
float rcscale_y
Definition: xwidget.h:212
Func_t::user_callback
xevfunc user_callback
Definition: xwidget.h:86
Func_t::motion_callback
evfunc motion_callback
Definition: xwidget.h:95
Widget_t::flags
long long flags
Definition: xwidget.h:324
Widget_t::adj
Adjustment_t * adj
Definition: xwidget.h:334
widget_event_loop
void widget_event_loop(void *w_, void *event, Xputty *main, void *user_data)
widget_event_loop - the internal widget event loop
Definition: xwidget.c:497
HIDE_ON_DELETE
@ HIDE_ON_DELETE
Definition: xwidget.h:257
Func_t::unmap_notify_callback
xevfunc unmap_notify_callback
Definition: xwidget.h:90
Widget_t::cr
cairo_t * cr
Definition: xwidget.h:314
xevfunc
void(* xevfunc)(void *widget, void *user_data)
*xevfunc - function pointer to connect XEvents from a Widget_t to a event handler
Definition: xwidget.h:71
CONFIGURE
@ CONFIGURE
Definition: xwidget.h:125
xputty.h
Widget_t::scale
Resize_t scale
Definition: xwidget.h:356
EventType
EventType
EventType - enum to hold identifier for all supported event callbacks Events could be connected to ...
Definition: xwidget.h:123
get_toplevel_widget
Widget_t * get_toplevel_widget(Xputty *main)
*get_toplevel_widget - get pointer to the top level Widget_t
Definition: xwidget.c:457
KEY_PRESS
@ KEY_PRESS
Definition: xwidget.h:139
send_systray_message
void send_systray_message(Widget_t *w)
send_systray_message - request a systray icon for Widget_t currently not working
Definition: xwidget.c:668
Func_t::key_press_callback
evfunc key_press_callback
Definition: xwidget.h:96
quit_widget
void quit_widget(Widget_t *w)
quit_widget - remove a widget from the processing loop
Definition: xwidget.c:713
Widget_t::pos_x
int pos_x
Definition: xwidget.h:344
DIALOG_RESPONSE
@ DIALOG_RESPONSE
Definition: xwidget.h:135
Func_t
Func_t - struct to hold all supported event callbacks.
Definition: xwidget.h:79
HAS_MEM
@ HAS_MEM
Definition: xwidget.h:251
Widget_t::app
Xputty * app
Definition: xwidget.h:300
Resize_t::init_y
int init_y
Definition: xwidget.h:196
BUTTON_PRESS
@ BUTTON_PRESS
Definition: xwidget.h:136
Func_t::button_press_callback
evfunc button_press_callback
Definition: xwidget.h:93
USE_TRANSPARENCY
@ USE_TRANSPARENCY
Definition: xwidget.h:243
IS_RADIO
@ IS_RADIO
Definition: xwidget.h:239
Widget_t::state
int state
Definition: xwidget.h:342
Resize_t::ascale
float ascale
Definition: xwidget.h:214
Func_t::map_notify_callback
xevfunc map_notify_callback
Definition: xwidget.h:89
MAP_NOTIFY
@ MAP_NOTIFY
Definition: xwidget.h:133
NO_PROPAGATE
@ NO_PROPAGATE
Definition: xwidget.h:261
Adjustment_t
Adjustment_t - struct to hold a controller adjustment.
Definition: xadjustment.h:80
Widget_t::widget
Window widget
Definition: xwidget.h:302
ENTER
@ ENTER
Definition: xwidget.h:126
FIXEDSIZE
@ FIXEDSIZE
Definition: xwidget.h:169
show_tooltip
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:427
USER
@ USER
Definition: xwidget.h:130
Widget_t
Widget_t - struct to hold the basic Widget_t info.
Definition: xwidget.h:298
VALUE_CHANGED
@ VALUE_CHANGED
Definition: xwidget.h:129
ADJ_INTERN
@ ADJ_INTERN
Definition: xwidget.h:128
Resize_t::rcscale_x
float rcscale_x
Definition: xwidget.h:210
ASPECT
@ ASPECT
Definition: xwidget.h:167
Childlist_t
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_reset_scale
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:137
Widget_t::xic
XIC xic
Definition: xwidget.h:338
Widget_t::surface
cairo_surface_t * surface
Definition: xwidget.h:312
IS_POPUP
@ IS_POPUP
Definition: xwidget.h:237
destroy_widget
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:71
UNMAP_NOTIFY
@ UNMAP_NOTIFY
Definition: xwidget.h:134
Func_t::mem_free_callback
xevfunc mem_free_callback
Definition: xwidget.h:87
Widget_t::height
int height
Definition: xwidget.h:354
MEM_FREE
@ MEM_FREE
Definition: xwidget.h:131
Func_t::button_release_callback
evfunc button_release_callback
Definition: xwidget.h:94
IS_WIDGET
@ IS_WIDGET
Definition: xwidget.h:233
Widget_t::childlist
Childlist_t * childlist
Definition: xwidget.h:336
create_window
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:145
IS_TOOLTIP
@ IS_TOOLTIP
Definition: xwidget.h:241
Func_t::adj_callback
xevfunc adj_callback
Definition: xwidget.h:84
FAST_REDRAW
@ FAST_REDRAW
Definition: xwidget.h:255
Widget_t::input_label
char input_label[32]
Definition: xwidget.h:328
Widget_t::adj_y
Adjustment_t * adj_y
Definition: xwidget.h:332
Widget_t::func
Func_t func
Definition: xwidget.h:310
evfunc
void(* evfunc)(void *widget, void *event, void *user_data)
*evfunc - function pointer to connect Xevents from a Widget_t to a event handler
Definition: xwidget.h:61
send_configure_event
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:612
Widget_t::xim
XIM xim
Definition: xwidget.h:340
Func_t::configure_notify_callback
xevfunc configure_notify_callback
Definition: xwidget.h:88
EXPOSE
@ EXPOSE
Definition: xwidget.h:124
Widget_t::buffer
cairo_surface_t * buffer
Definition: xwidget.h:316
Widget_t::parent
void * parent
Definition: xwidget.h:304
Widget_t::event_callback
vfunc event_callback
Definition: xwidget.h:308
Gravity
Gravity
Gravity - enum to indicate how to resize a widget.
Definition: xwidget.h:155
Widget_t::label
const char * label
Definition: xwidget.h:326
Func_t::value_changed_callback
xevfunc value_changed_callback
Definition: xwidget.h:85
widget_hide
void widget_hide(Widget_t *w)
widget_hide - unmap/hide a Widget_t
Definition: xwidget.c:396
Widget_t::x
int x
Definition: xwidget.h:348
Widget_t::adj_x
Adjustment_t * adj_x
Definition: xwidget.h:330
Resize_t::cscale_x
float cscale_x
Definition: xwidget.h:206
Resize_t::init_width
int init_width
Definition: xwidget.h:198
NORTHEAST
@ NORTHEAST
Definition: xwidget.h:159
Resize_t
Resize_t - struct used to resize child widgets.
Definition: xwidget.h:190
Resize_t::init_height
int init_height
Definition: xwidget.h:200
widget_show_all
void widget_show_all(Widget_t *w)
widget_show_all - map/show Widget_t with all childs
Definition: xwidget.c:405
SOUTHEAST
@ SOUTHEAST
Definition: xwidget.h:163
Func_t::dialog_callback
xevfunc dialog_callback
Definition: xwidget.h:91
KEY_RELEASE
@ KEY_RELEASE
Definition: xwidget.h:140