libxputty 0.1
Loading...
Searching...
No Matches
xmenu_private.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 "xmenu_private.h"
23
24
25int _menu_remove_low_dash(char *str) {
26
27 char *src;
28 char *dst;
29 int i = 0;
30 int r = 0;
31 for (src = dst = str; *src != '\0'; src++) {
32 *dst = *src;
33 if (*dst != '_') {
34 dst++;
35 } else {
36 r = i;
37 }
38 i++;
39 }
40 *dst = '\0';
41 return r;
42}
43
44void _draw_menu_label(void *w_, void* user_data) {
45 Widget_t *w = (Widget_t*)w_;
46 Metrics_t metrics;
47 os_get_window_metrics(w, &metrics);
48 int height = metrics.height;
49
50 cairo_text_extents_t extents;
52 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
53 cairo_text_extents(w->crb, "A", &extents);
54 double lh = extents.height;
55
56 if (strstr(w->label, "_")) {
57 cairo_text_extents(w->crb, "--", &extents);
58 double underline = extents.width;
59 strncpy(w->input_label,w->label, sizeof(w->input_label)-1);
61 int len = strlen(w->input_label);
62 cairo_text_extents(w->crb,w->input_label , &extents);
63 int set_line = (extents.width/len) * pos;
64 cairo_move_to (w->crb, 10, (height+lh)*0.5);
65 cairo_show_text(w->crb, w->input_label);
66 cairo_set_line_width(w->crb, 1.0);
67 cairo_move_to (w->crb, 10 + set_line, (height+lh)*0.55);
68 cairo_line_to(w->crb,10 + set_line + underline, (height+lh)*0.55);
69 cairo_stroke(w->crb);
70 } else {
71 cairo_text_extents(w->crb,w->label , &extents);
72 cairo_move_to (w->crb, 10, (height+lh)*0.5);
73 cairo_show_text(w->crb, w->label);
74 }
75
76 cairo_new_path (w->crb);
77}
78
79void _check_menu_state(void *w_, void* user_data) {
80 Widget_t *w = (Widget_t*)w_;
81 Widget_t *parent = w->parent;
82 int i = parent->childlist->elem-1;
83 for(;i>-1;i--) {
84 Widget_t *wid = parent->childlist->childs[i];
86 if ((wid->childlist->childs[0] == w->app->hold_grab) && (wid !=w)) {
87#ifdef _WIN32 //SetCaptureDisabled//XUngrabPointer
88 //ReleaseCapture(); // SetCapture() is currently disabled in pop_menu_show()
89#else
90 XUngrabPointer(w->app->dpy,CurrentTime);
91#endif
93 w->app->hold_grab = NULL;
94 if (w->app->submenu) {
96 w->app->submenu = NULL;
97 }
98 pop_menu_show(w, w->childlist->childs[0], 6, true);
99 break;
100 }
101 }
102 }
103 os_transparent_draw(w_, user_data);
104}
105
106void _menu_released(void *w_, void* button_, void* user_data) {
107 Widget_t *w = (Widget_t*)w_;
108 XButtonEvent *xbutton = (XButtonEvent*)button_;
109 if (w->flags & HAS_POINTER && xbutton->button == Button1) {
110 pop_menu_show(w, w->childlist->childs[0], 6, true);
111 }
112}
113
114void _menu_entry_released(void *w_, void* item_, void* user_data) {
115 Widget_t *w = (Widget_t*)w_;
116 Widget_t * bar = NULL;
117 int i = w->app->childlist->elem-1;
118 for(;i>-1;i--) {
119 Widget_t *wid = w->app->childlist->childs[i];
120 if (wid == w) {
121 bar = w->app->childlist->childs[i-1];
122 int old_value = (int)adj_get_value(bar->adj);
123 adj_set_value(bar->adj, (float)*(int*)item_);
124 if (old_value == *(int*)item_) {
125 bar->func.value_changed_callback(bar, NULL);
126 }
127 break;
128 }
129 }
130}
131
132void _draw_menu_slider(void *w_, void* user_data) {
133 Widget_t *w = (Widget_t*)w_;
134 int v = (int)w->adj->max_value;
135 if (!v) return;
136 Metrics_t metrics;
137 os_get_window_metrics(w, &metrics);
138 int width = metrics.width;
139 int height = metrics.height;
140 if (!metrics.visible) return;
141 float sliderstate = adj_get_state(w->adj);
143 cairo_rectangle(w->crb, 0,0,width,height);
144 cairo_fill_preserve(w->crb);
146 cairo_fill(w->crb);
148 cairo_rectangle(w->crb, 0,(height-10)*sliderstate,width,10);
149 cairo_fill(w->crb);
150}
151
152void _draw_menu(void *w_, void* user_data) {
153 Widget_t *w = (Widget_t*)w_;
154 if (!w) return;
156 cairo_paint (w->crb);
157}
158
159void _draw_submenu(void *w_, void* user_data) {
160 Widget_t *w = (Widget_t*)w_;
161 if (!w) return;
162 Metrics_t metrics;
163 os_get_window_metrics(w, &metrics);
164 int width = metrics.width;
165 int height = metrics.height;
166 if (!metrics.visible) return;
167
169 cairo_rectangle(w->crb, 0, 0, width , height);
170 if(w->state==1) {
172 } else if(w->state==2) {
174 } else if(w->state==3) {
176 }
177 cairo_fill_preserve(w->crb);
178 cairo_set_line_width(w->crb, 1.0);
180 cairo_stroke(w->crb);
181
182 cairo_text_extents_t extents;
185 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
186
187 if (strstr(w->label, "_")) {
188 cairo_text_extents(w->crb, "--", &extents);
189 double underline = extents.width;
190 strncpy(w->input_label,w->label, sizeof(w->input_label)-1);
192 int len = strlen(w->input_label);
193 cairo_text_extents(w->crb,w->input_label , &extents);
194 int set_line = (extents.width/len) * pos;
195 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
196 cairo_show_text(w->crb, w->input_label);
197 cairo_set_line_width(w->crb, 1.0);
198 cairo_move_to (w->crb, 20 + set_line, (height+extents.height)*0.55);
199 cairo_line_to(w->crb,20 + set_line + underline, (height+extents.height)*0.55);
200 cairo_stroke(w->crb);
201 } else {
202 cairo_text_extents(w->crb,w->label , &extents);
203 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
204 cairo_show_text(w->crb, w->label);
205 }
206 cairo_move_to (w->crb, (width-15), (height+extents.height)*0.5);
207 cairo_show_text(w->crb, ">");
208 cairo_new_path (w->crb);
209}
210
211void _enter_submenu(void *w_, void* user_data) {
212 Widget_t *w = (Widget_t*)w_;
213 Metrics_t metrics;
214 os_get_window_metrics(w, &metrics);
215 if (!metrics.visible) return;
217 if (w->app->submenu) {
218 if (w->app->submenu != w->childlist->childs[0]) {
220 w->app->submenu = NULL;
221 }
222 }
223 pop_submenu_show(w, w->childlist->childs[0], 6, false);
224 }
225 os_transparent_draw(w_, user_data);
226}
227
228void _leave_submenu(void *w_, void* user_data) {
229 Widget_t *w = (Widget_t*)w_;
230
231 if (!w->data) {
232#ifdef __linux__
233 XCrossingEvent notify;
234 memset(&notify, 0, sizeof(notify));
235 notify.type = LeaveNotify;
236 notify.display = w->app->dpy;
237 notify.send_event = True;
238 notify.subwindow = w->widget;
239 notify.window = w->widget;
240 notify.x = 1;
241 notify.y = 1;
242 notify.same_screen = True;
243 notify.focus = False;
244 XSendEvent(w->app->dpy, w->widget,True,LeaveWindowMask, (XEvent*)&notify);
245#endif
246 w->data = 1;
247 return;
248 }
249 w->data = 0;
251 Widget_t *parent = (Widget_t*) w->parent;
252 int i=0;
253 for(;i<parent->childlist->elem;i++) {
254 if (parent->childlist->childs[i]->flags & HAS_FOCUS) {
256 if (w->app->submenu == w->childlist->childs[0])
257 w->app->submenu = NULL;
258 break;
259 }
260 }
261
262 }
263 os_transparent_draw(w_, user_data);
264}
265
266void _draw_item(void *w_, void* user_data) {
267 Widget_t *w = (Widget_t*)w_;
268 if (!w) return;
269 Metrics_t metrics;
270 os_get_window_metrics(w, &metrics);
271 int width = metrics.width;
272 int height = metrics.height;
273 if (!metrics.visible) return;
274
276 cairo_rectangle(w->crb, 0, 0, width , height);
277 if(w->state==1) {
279 } else if(w->state==2) {
281 } else if(w->state==3) {
283 }
284 cairo_fill_preserve(w->crb);
285 cairo_set_line_width(w->crb, 1.0);
287 cairo_stroke(w->crb);
288
289 cairo_text_extents_t extents;
292 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
293 cairo_text_extents(w->crb,w->label , &extents);
294 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
295 cairo_show_text(w->crb, w->label);
296 cairo_new_path (w->crb);
297}
298
299void _draw_value_item(void *w_, void* user_data) {
300 Widget_t *w = (Widget_t*)w_;
301 if (!w) return;
302 Metrics_t metrics;
303 os_get_window_metrics(w, &metrics);
304 int width = metrics.width-2;
305 int height = metrics.height-2;
306 if (!metrics.visible) return;
307
309 cairo_rectangle(w->crb, 0, 0, width , height);
310 if(w->state==1) {
312 } else if(w->state==2) {
314 } else if(w->state==3) {
316 }
317 cairo_fill_preserve(w->crb);
318 cairo_set_line_width(w->crb, 1.0);
320 cairo_stroke(w->crb);
322 cairo_text_extents_t extents;
324 char s[64];
325 const char* format[] = {"%.1f", "%.2f", "%.3f"};
326 float value = adj_get_value(w->adj);
327 if (fabs(w->adj->step)>0.99) {
328 snprintf(s, 63,"%d", (int) value);
329 } else if (fabs(w->adj->step)>0.09) {
330 snprintf(s, 63, format[1-1], value);
331 } else {
332 snprintf(s, 63, format[2-1], value);
333 }
334 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
335 cairo_text_extents(w->crb, s, &extents);
336 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
337 cairo_show_text(w->crb, s);
338 cairo_new_path (w->crb);
339}
340
341void _draw_accel_item(void *w_, void* user_data) {
342 Widget_t *w = (Widget_t*)w_;
343 if (!w) return;
344 Metrics_t metrics;
345 os_get_window_metrics(w, &metrics);
346 int width = metrics.width;
347 int height = metrics.height;
348 if (!metrics.visible) return;
349
351 cairo_rectangle(w->crb, 0, 0, width , height);
352 if(w->state==1) {
354 } else if(w->state==2) {
356 } else if(w->state==3) {
358 }
359 cairo_fill_preserve(w->crb);
360 cairo_set_line_width(w->crb, 1.0);
362 cairo_stroke(w->crb);
363
364 cairo_text_extents_t extents;
367 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
368
369 if (strstr(w->label, "_")) {
370 cairo_text_extents(w->crb, "--", &extents);
371 double underline = extents.width;
372 strncpy(w->input_label,w->label, sizeof(w->input_label)-1);
374 int len = strlen(w->input_label);
375 cairo_text_extents(w->crb,w->input_label , &extents);
376 int set_line = (extents.width/len) * pos;
377 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
378 cairo_show_text(w->crb, w->input_label);
379 cairo_set_line_width(w->crb, 1.0);
380 cairo_move_to (w->crb, 20 + set_line, (height+extents.height)*0.55);
381 cairo_line_to(w->crb,20 + set_line + underline, (height+extents.height)*0.55);
382 cairo_stroke(w->crb);
383 } else {
384 cairo_text_extents(w->crb,w->label , &extents);
385 cairo_move_to (w->crb, 20, (height+extents.height)*0.5);
386 cairo_show_text(w->crb, w->label);
387 }
388 cairo_new_path (w->crb);
389}
390
391void _draw_accel_check_item(void *w_, void* user_data) {
392 _draw_accel_item(w_, user_data);
393 Widget_t *w = (Widget_t*)w_;
394 Metrics_t metrics;
395 os_get_window_metrics(w, &metrics);
396 int height = metrics.height;
397 if (w->flags & IS_RADIO) {
398 cairo_arc(w->crb, height/3, height/2, height/6, 0, 2 * M_PI );
399 } else {
400 cairo_rectangle(w->crb, height/6, height/3, height/3 , height/3);
401 }
403 cairo_fill(w->crb);
404 if ((int) w->adj_y->value) {
405 if (w->flags & IS_RADIO) {
406 cairo_arc(w->crb, height/3, height/2, height/6-2, 0, 2 * M_PI );
407 } else {
408 cairo_rectangle(w->crb, height/6+1, height/3+1, height/3-2 , height/3-2);
409 }
411 cairo_fill(w->crb);
412 }
413}
414
415void _draw_check_item(void *w_, void* user_data) {
416 _draw_item(w_, user_data);
417 Widget_t *w = (Widget_t*)w_;
418 Metrics_t metrics;
419 os_get_window_metrics(w, &metrics);
420 int height = metrics.height;
421 if (w->flags & IS_RADIO) {
422 cairo_arc(w->crb, height/3, height/2, height/6, 0, 2 * M_PI );
423 } else {
424 cairo_rectangle(w->crb, height/6, height/3, height/3 , height/3);
425 }
427 cairo_fill(w->crb);
428 if ((int) w->adj_y->value) {
429 if (w->flags & IS_RADIO) {
430 cairo_arc(w->crb, height/3, height/2, height/6-2, 0, 2 * M_PI );
431 } else {
432 cairo_rectangle(w->crb, height/6+1, height/3+1, height/3-2 , height/3-2);
433 }
435 cairo_fill(w->crb);
436 }
437}
438
439void _set_viewpoint(void *w_, void* user_data) {
440 Widget_t *w = (Widget_t*)w_;
441 Widget_t *menu = (Widget_t*)w->parent;
442 Widget_t* slider = menu->childlist->childs[1];
443 int v = (int)max(0,adj_get_value(w->adj));
444 Metrics_t metrics;
445 os_get_window_metrics(w->childlist->childs[0], &metrics);
446 int height = metrics.height;
447 os_move_window(w->app->dpy,w,0, -height*v);
448 adj_set_state(slider->adj,adj_get_state(w->adj));
449}
450
451void _set_menu_viewpoint(void *w_, void* user_data) {
452 Widget_t *w = (Widget_t*)w_;
453 Widget_t *menu = (Widget_t*)w->parent;
454 Widget_t*view_port = menu->childlist->childs[0];
455 adj_set_state(view_port->adj,adj_get_state(w->adj));
456}
457
458void _check_item_button_pressed(void *w_, void* button_, void* user_data) {
459 Widget_t *w = (Widget_t*)w_;
460 if (w->flags & HAS_FOCUS) {
461 float value = w->adj_y->value ? 0.0 : 1.0;
462 adj_set_value(w->adj_y, value);
463 }
464}
465
466void _radio_item_button_pressed(void *w_, void* button_, void* user_data) {
467 Widget_t *w = (Widget_t*)w_;
468 if (w->flags & HAS_FOCUS) {
470 }
471}
472
473void _value_item_released(void *w_, void* button_, void* user_data) {
474 Widget_t *w = (Widget_t*)w_;
475 expose_widget(w);
476}
477
478void _configure_menu(Widget_t *parent, Widget_t *menu, int elem, bool above) {
479 Widget_t* view_port = menu->childlist->childs[0];
480 Widget_t *slider = menu->childlist->childs[1];
481 if (!view_port->childlist->elem) return;
482 Metrics_t metrics;
483 os_get_window_metrics(view_port->childlist->childs[0], &metrics);
484 int height = metrics.height;
485 int x1, y1;
486 int posy = (above) ? parent->height : 0;
487 int posx = (above) ? 0 : parent->width ;
488 os_translate_coords(parent, parent->widget, os_get_root_window(parent->app, IS_WIDGET), posx, posy, &x1, &y1);
489 int item_width = 1.0;
490 cairo_text_extents_t extents;
491 int i = view_port->childlist->elem-1;
492 set_adjustment(view_port->adj,0.0, view_port->adj->value, 0.0, i-(elem-1),1.0, CL_VIEWPORT);
493 bool is_not_scrolable = false;
494 if(view_port->childlist->elem <= elem) {
495 elem = view_port->childlist->elem;
496 is_not_scrolable = true;
497 }
498 for(;i>-1;i--) {
499 Widget_t *w = view_port->childlist->childs[i];
500 cairo_set_font_size (w->crb, w->app->normal_font/w->scale.ascale);
501 cairo_text_extents(w->crb,w->label , &extents);
502
503 item_width = max(item_width, (int)extents.width+40);
504 if(is_not_scrolable) w->scale.gravity = NORTHEAST;
505 }
506 if(above) {
507 if(item_width<parent->width)item_width = parent->width;
508 }
509 slider->adj->step = max(0.0,1.0/(view_port->childlist->elem-elem));
510 adj_set_scale(slider->adj, ((float)view_port->childlist->elem/(float)elem)/25.0);
511
512 int screen_height = os_get_screen_height(parent);
513 if (y1+(height*elem) > screen_height) y1 = y1-((height*elem)+parent->height);
514 os_resize_window (menu->app->dpy, menu, item_width, height*elem);
515 os_resize_window (view_port->app->dpy, view_port, item_width, height*view_port->childlist->elem);
516 os_move_window(menu->app->dpy,slider,item_width-10, 0);
517 os_resize_window(menu->app->dpy,slider,10,height*elem);
518 os_move_window(menu->app->dpy,menu,x1, y1);
519}
float max_value
Definition xadjustment.h:92
Widget_t ** childs
Definition xchildlist.h:51
xevfunc value_changed_callback
Definition xwidget.h:90
Metrics_t - struct to receive window size, position & visibility Pass this struct to os_get_window_...
float ascale
Definition xwidget.h:369
Gravity gravity
Definition xwidget.h:347
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
Resize_t scale
Definition xwidget.h:525
Adjustment_t * adj_y
Definition xwidget.h:495
int width
Definition xwidget.h:521
Adjustment_t * adj
Definition xwidget.h:497
void * parent
Definition xwidget.h:471
Window widget
Definition xwidget.h:469
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
long long flags
Definition xwidget.h:461
char input_label[32]
Definition xwidget.h:459
const char * label
Definition xwidget.h:463
int height
Definition xwidget.h:523
Func_t func
Definition xwidget.h:481
Xputty * app
Definition xwidget.h:465
int button
int normal_font
Definition xputty.h:248
Display * dpy
Definition xputty.h:232
Widget_t * hold_grab
Definition xputty.h:238
Childlist_t * childlist
Definition xputty.h:230
Widget_t * submenu
Definition xputty.h:242
void adj_set_state(Adjustment_t *adj, float state)
adj_set_state - set the current state of the Adjustment_t
void adj_set_value(Adjustment_t *adj, float value)
adj_set_value - set the current value to the Adjustment_t
float adj_get_value(Adjustment_t *adj)
adj_get_value - get the current value of the Adjustment_t
void set_adjustment(Adjustment_t *adj, float std_value, float value, float min_value, float max_value, float step, CL_type type)
*set_adjustment - set a new range to a existing Adjustment_t or create if it not exists yet
Definition xadjustment.c:80
@ CL_VIEWPORT
Definition xadjustment.h:57
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
void adj_set_scale(Adjustment_t *adj, float value)
adj_set_scale - internal use to scale the pointer movement (0.1 -1.0)
int childlist_has_child(Childlist_t *childlist)
childlist_has_child - check if a Widget_t Childlist_t contain a child
Definition xchildlist.c:89
void use_frame_color_scheme(Widget_t *w, Color_state st)
use_frame_color_scheme - use frame Colors to paint on Widget_t
Definition xcolor.c:280
Color_state get_color_state(Widget_t *wid)
get_color_state - get the Color_state to use in relation to the Widget_t state
Definition xcolor.c:222
void use_text_color_scheme(Widget_t *w, Color_state st)
use_text_color_scheme - use text Colors to paint on Widget_t
Definition xcolor.c:266
void use_bg_color_scheme(Widget_t *w, Color_state st)
use_bg_color_scheme - use background Colors to paint on Widget_t
Definition xcolor.c:252
void use_fg_color_scheme(Widget_t *w, Color_state st)
use_fg_color_scheme - use forground Colors to paint on Widget_t
Definition xcolor.c:245
void use_shadow_color_scheme(Widget_t *w, Color_state st)
use_shadow_color_scheme - use shadow Colors to paint on Widget_t
Definition xcolor.c:273
void use_base_color_scheme(Widget_t *w, Color_state st)
use_base_color_scheme - use base Colors to paint on Widget_t
Definition xcolor.c:259
@ NORMAL_
Definition xcolor.h:44
@ SELECTED_
Definition xcolor.h:46
@ PRELIGHT_
Definition xcolor.h:45
@ ACTIVE_
Definition xcolor.h:47
void radio_item_set_active(Widget_t *w)
radio_item_set_active - activate selected radio item
Definition xmenu.c:326
void pop_menu_show(Widget_t *parent, Widget_t *menu, int elem, bool above)
pop_menu_show - pop up a menu to a Widget_t
Definition xmenu.c:27
void pop_submenu_show(Widget_t *parent, Widget_t *menu, int elem, bool above)
pop_submenu_show - pop up a submenu to a Widget_t
Definition xmenu.c:41
void _draw_submenu(void *w_, void *user_data)
_draw_submenu - draw submenu on expose call
void _set_menu_viewpoint(void *w_, void *user_data)
_set_menu_viewpoint - move the view_port to position by slider
void _configure_menu(Widget_t *parent, Widget_t *menu, int elem, bool above)
_configure_menu - set final size and position of menu to a Widget_t
void _check_menu_state(void *w_, void *user_data)
_check_menu_state - follow the mouse pointer when a menu is active
void _draw_item(void *w_, void *user_data)
_draw_item - draw item on expose call
int _menu_remove_low_dash(char *str)
void _draw_value_item(void *w_, void *user_data)
_draw_value_item - draw item on expose call
void _value_item_released(void *w_, void *button_, void *user_data)
_value_item_released - redraw item on button released
void _radio_item_button_pressed(void *w_, void *button_, void *user_data)
_radio_item_button_pressed - redraw item on button press
void _draw_menu_slider(void *w_, void *user_data)
_draw_menu_slider - draw the menu slider on expose call
void _menu_entry_released(void *w_, void *item_, void *user_data)
_menu_entry_released - the menu release func
void _check_item_button_pressed(void *w_, void *button_, void *user_data)
_check_item_button_pressed - redraw item on button press
void _set_viewpoint(void *w_, void *user_data)
_set_viewpoint - move the view_port to position
void _draw_accel_item(void *w_, void *user_data)
_draw_accel_item - draw accel item on expose call
void _menu_released(void *w_, void *button_, void *user_data)
_menu_released - popup the menu on click
void _draw_accel_check_item(void *w_, void *user_data)
_accel_draw_check_item - draw item on expose call
void _draw_menu_label(void *w_, void *user_data)
_draw_menu_label - draw the menu label on expose call
void _enter_submenu(void *w_, void *user_data)
_enter_submenu - enter submenu
void _draw_check_item(void *w_, void *user_data)
_draw_check_item - draw item on expose call
void _draw_menu(void *w_, void *user_data)
_draw_menu - draw menu on expose call
void _leave_submenu(void *w_, void *user_data)
_leave_submenu - leave submenu
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_resize_window(Display *dpy, Widget_t *w, int x, int y)
os_resize_window - Resize a Widget_t
Window os_get_root_window(Xputty *main, int flag)
os_get_root_window - get a pointer to the root window (desktop)
void os_translate_coords(Widget_t *w, Window from_window, Window to_window, int from_x, int from_y, int *to_x, int *to_y)
os_translate_coords - get x,y related to destination Window
void os_move_window(Display *dpy, Widget_t *w, int x, int y)
os_move_window - Move a Widget_t
void os_transparent_draw(void *w_, void *user_data)
os_transparent_draw - Draw the Widget_t to the back buffer
int os_get_screen_height(Widget_t *w)
os_get_screen_height - Get the height of the used Display
void expose_widget(Widget_t *w)
expose_widgets - send a expose event (EXPOSE) to a Widget_t
Definition xwidget.c:445
@ NORTHEAST
Definition xwidget.h:302
@ IS_WIDGET
Definition xwidget.h:388
@ HAS_POINTER
Definition xwidget.h:402
@ IS_RADIO
Definition xwidget.h:394
@ HAS_FOCUS
Definition xwidget.h:400
void widget_hide(Widget_t *w)
widget_hide - unmap/hide a Widget_t
Definition xwidget.c:368