rofi  1.5.1
widget.c
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2017 Qball Cow <qball@gmpclient.org>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  */
27 
28 #include <glib.h>
29 #include <math.h>
30 #include "widgets/widget.h"
32 #include "theme.h"
33 
35 #define WIDGET_DEFAULT_PADDING 0
36 
37 void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name )
38 {
39  wid->type = type;
40  wid->parent = parent;
41  wid->name = g_strdup ( name );
46 
47  wid->padding = rofi_theme_get_padding ( wid, "padding", wid->def_padding );
48  wid->border = rofi_theme_get_padding ( wid, "border", wid->def_border );
49  wid->border_radius = rofi_theme_get_padding ( wid, "border-radius", wid->def_border_radius );
50  wid->margin = rofi_theme_get_padding ( wid, "margin", wid->def_margin );
51 
52  // bled by default
53  wid->enabled = rofi_theme_get_boolean ( wid, "enabled", TRUE );
54 }
55 
56 void widget_set_state ( widget *widget, const char *state )
57 {
58  if ( g_strcmp0 ( widget->state, state ) ) {
59  widget->state = state;
60  // Update border.
63 
65  }
66 }
67 
68 int widget_intersect ( const widget *widget, int x, int y )
69 {
70  if ( widget == NULL ) {
71  return FALSE;
72  }
73 
74  if ( x >= ( widget->x ) && x < ( widget->x + widget->w ) ) {
75  if ( y >= ( widget->y ) && y < ( widget->y + widget->h ) ) {
76  return TRUE;
77  }
78  }
79  return FALSE;
80 }
81 
82 void widget_resize ( widget *widget, short w, short h )
83 {
84  if ( widget != NULL ) {
85  if ( widget->resize != NULL ) {
86  if ( widget->w != w || widget->h != h ) {
87  widget->resize ( widget, w, h );
88  }
89  }
90  else {
91  widget->w = w;
92  widget->h = h;
93  }
94  // On a resize we always want to udpate.
96  }
97 }
98 void widget_move ( widget *widget, short x, short y )
99 {
100  if ( widget != NULL ) {
101  widget->x = x;
102  widget->y = y;
103  }
104 }
105 
107 {
108  if ( widget != NULL ) {
109  return widget->type;
110  }
111  return WIDGET_TYPE_UNKNOWN;
112 }
113 
115 {
116  if ( widget != NULL ) {
117  return widget->enabled;
118  }
119  return FALSE;
120 }
121 
123 {
124  if ( widget && !widget->enabled ) {
125  widget->enabled = TRUE;
126  widget_update ( widget );
129  }
130 }
132 {
133  if ( widget && widget->enabled ) {
134  widget->enabled = FALSE;
135  widget_update ( widget );
138  }
139 }
140 void widget_draw ( widget *widget, cairo_t *d )
141 {
142  // Check if enabled and if draw is implemented.
143  if ( widget && widget->enabled && widget->draw ) {
144  // Don't draw if there is no space.
145  if ( widget->h < 1 || widget->w < 1 ) {
146  widget->need_redraw = FALSE;
147  return;
148  }
149  // Store current state.
150  cairo_save ( d );
151  const int margin_left = distance_get_pixel ( widget->margin.left, ROFI_ORIENTATION_HORIZONTAL );
152  const int margin_top = distance_get_pixel ( widget->margin.top, ROFI_ORIENTATION_VERTICAL );
153  const int margin_right = distance_get_pixel ( widget->margin.right, ROFI_ORIENTATION_HORIZONTAL );
154  const int margin_bottom = distance_get_pixel ( widget->margin.bottom, ROFI_ORIENTATION_VERTICAL );
163 
164  double vspace = widget->h - margin_top - margin_bottom - top / 2.0 - bottom / 2.0;
165  double hspace = widget->w - margin_left - margin_right - left / 2.0 - right / 2.0;
166  if ( ( radius_bl + radius_tl ) > ( vspace ) ) {
167  int j = floor ( ( vspace ) / 2.0 );
168  radius_bl = MIN ( radius_bl, j );
169  radius_tl = MIN ( radius_tl, j );
170  }
171  if ( ( radius_br + radius_tr ) > ( vspace ) ) {
172  int j = floor ( ( vspace ) / 2.0 );
173  radius_br = MIN ( radius_br, j );
174  radius_tr = MIN ( radius_tr, j );
175  }
176  if ( ( radius_tl + radius_tr ) > ( hspace ) ) {
177  int j = floor ( ( hspace ) / 2.0 );
178  radius_tr = MIN ( radius_tr, j );
179  radius_tl = MIN ( radius_tl, j );
180  }
181  if ( ( radius_bl + radius_br ) > ( hspace ) ) {
182  int j = floor ( ( hspace ) / 2.0 );
183  radius_br = MIN ( radius_br, j );
184  radius_bl = MIN ( radius_bl, j );
185  }
186 
187  // Background painting.
188  // Set new x/y position.
189  cairo_translate ( d, widget->x, widget->y );
190  cairo_set_line_width ( d, 0 );
191  // Set outlines.
192  cairo_move_to ( d, margin_left + radius_tl + left / 2.0, margin_top + radius_tl + top / 2.0 );
193  if ( radius_tl ) {
194  cairo_arc ( d, margin_left + radius_tl + left / 2.0, margin_top + radius_tl + top / 2.0, radius_tl, -1.0 * G_PI, -G_PI_2 );
195  }
196  cairo_line_to ( d, widget->w - margin_right - radius_tr - right / 2.0, margin_top + top / 2.0 );
197  if ( radius_tr ) {
198  cairo_arc ( d, widget->w - margin_right - radius_tr - right / 2.0, margin_top + radius_tr + top / 2.0, radius_tr, -G_PI_2, 0 * G_PI );
199  }
200  cairo_line_to ( d, widget->w - margin_right - right / 2.0, widget->h - margin_bottom - radius_br - bottom / 2.0 );
201  if ( radius_br ) {
202  cairo_arc ( d, widget->w - margin_right - radius_br - right / 2.0, widget->h - margin_bottom - radius_br - bottom / 2.0, radius_br, 0.0 * G_PI, G_PI_2 );
203  }
204  cairo_line_to ( d, margin_left + radius_bl + left / 2.0, widget->h - margin_bottom - bottom / 2.0 );
205  if ( radius_bl ) {
206  cairo_arc ( d, margin_left + radius_bl + left / 2.0, widget->h - margin_bottom - radius_bl - bottom / 2.0, radius_bl, G_PI_2, 1.0 * G_PI );
207  }
208  cairo_line_to ( d, margin_left + left / 2.0, margin_top + radius_tl + top / 2.0 );
209  cairo_close_path ( d );
210 
211  cairo_set_source_rgba ( d, 1.0, 1.0, 1.0, 1.0 );
212  rofi_theme_get_color ( widget, "background-color", d );
213  cairo_fill_preserve ( d );
214  cairo_clip ( d );
215 
216  widget->draw ( widget, d );
217  widget->need_redraw = FALSE;
218 
219  cairo_restore ( d );
220 
221  if ( left || top || right || bottom ) {
222  cairo_save ( d );
223  cairo_translate ( d, widget->x, widget->y );
224  cairo_new_path ( d );
225  rofi_theme_get_color ( widget, "border-color", d );
226  if ( left > 0 ) {
227  double offset = ( radius_tl > 0 ) ? floor ( top / 2.0 ) : 0;
228  cairo_set_line_width ( d, left );
230  cairo_move_to ( d, margin_left + left / 2.0, margin_top + radius_tl + offset );
231  offset = ( radius_bl > 0 ) ? floor ( bottom / 2.0 ) : 0;
232  cairo_line_to ( d, margin_left + left / 2.0, widget->h - margin_bottom - radius_bl - offset );
233  cairo_stroke ( d );
234  }
235  if ( radius_tl > 0 ) {
237  if ( left == top ) {
238  cairo_set_line_width ( d, left );
239  cairo_arc ( d,
240  margin_left + left / 2.0 + radius_tl, margin_top + radius_tl + top / 2.0, radius_tl, -G_PI, -G_PI_2 );
241  cairo_stroke ( d );
242  }
243  else {
244  cairo_set_line_width ( d, 0 );
245  double minof = ceil ( MIN ( left / 2.0, top / 2.0 ) );
246  double radius_outer = radius_tl + minof;
247  double radius_inner = radius_tl - minof;
248  cairo_arc ( d, margin_left + radius_outer, margin_top + radius_outer, radius_outer, -G_PI, -G_PI_2 );
249  cairo_line_to ( d, margin_left + radius_tl + ceil ( left / 2.0 ), margin_top );
250  cairo_line_to ( d, margin_left + radius_tl + ceil ( left / 2.0 ), margin_top + top );
251  cairo_arc_negative ( d, margin_left + left + radius_inner, margin_top + top + radius_inner, radius_inner, -G_PI_2, G_PI );
252  cairo_line_to ( d, margin_left + left, margin_top + radius_tl + ceil ( top / 2.0 ) );
253  cairo_line_to ( d, margin_left, margin_top + radius_tl + ceil ( top / 2.0 ) );
254  cairo_close_path ( d );
255  cairo_fill ( d );
256  }
257  }
258  if ( top > 0 ) {
259  double offset = ( radius_tl > 0 ) ? floor ( left / 2.0 ) : 0;
260  cairo_set_line_width ( d, top );
262  cairo_move_to ( d, margin_left + radius_tl + offset, margin_top + top / 2.0 );
263  offset = ( radius_tr > 0 ) ? floor ( right / 2.0 ) : 0;
264  cairo_line_to ( d, widget->w - margin_right - radius_tr - offset, margin_top + top / 2.0 );
265  cairo_stroke ( d );
266  }
267  if ( radius_tr > 0 ) {
269  if ( top == right ) {
270  cairo_set_line_width ( d, right );
271  cairo_arc ( d, widget->w - margin_right - right / 2.0 - radius_tr, margin_top + radius_tr + right / 2.0, radius_tr, -G_PI_2, 0 * G_PI );
272  cairo_stroke ( d );
273  }
274  else {
275  cairo_set_line_width ( d, 0 );
276  double minof = ceil ( MIN ( right / 2.0, top / 2.0 ) );
277  double radius_outer = radius_tr + minof;
278  double radius_inner = radius_tr - minof;
279  cairo_arc ( d, widget->w - margin_right - radius_outer, margin_top + radius_outer, radius_outer, -G_PI_2, 0 );
280  cairo_line_to ( d, widget->w - margin_right, margin_top + radius_tr + ceil ( top / 2.0 ) );
281  cairo_line_to ( d, widget->w - margin_right - right, margin_top + radius_tr + ceil ( top / 2.0 ) );
282  cairo_arc_negative ( d, widget->w - margin_right - right - radius_inner, margin_top + top + radius_inner, radius_inner, 0, -G_PI_2 );
283  cairo_line_to ( d, widget->w - margin_right - radius_tr - ceil ( right / 2.0 ), margin_top + top );
284  cairo_line_to ( d, widget->w - margin_right - radius_tr - ceil ( right / 2.0 ), margin_top );
285  cairo_close_path ( d );
286  cairo_fill ( d );
287  }
288  }
289  if ( right > 0 ) {
290  double offset = ( radius_tr > 0 ) ? floor ( top / 2.0 ) : 0;
291  cairo_set_line_width ( d, right );
293  cairo_move_to ( d, widget->w - margin_right - right / 2.0, margin_top + radius_tr + offset );
294  offset = ( radius_br > 0 ) ? floor ( bottom / 2.0 ) : 0;
295  cairo_line_to ( d, widget->w - margin_right - right / 2.0, widget->h - margin_bottom - radius_br - offset );
296  cairo_stroke ( d );
297  }
298  if ( radius_br > 0 ) {
300  if ( bottom == right ) {
301  cairo_set_line_width ( d, right );
302  cairo_arc ( d, widget->w - margin_right - right / 2.0 - radius_br, widget->h - margin_bottom - radius_br - right / 2.0, radius_br, 0.0, G_PI_2 );
303  cairo_stroke ( d );
304  }
305  else {
306  cairo_set_line_width ( d, 0 );
307  double minof = ceil ( MIN ( right / 2.0, bottom / 2.0 ) );
308  double radius_outer = radius_br + minof;
309  double radius_inner = radius_br - minof;
310  cairo_arc ( d, widget->w - margin_right - radius_outer, widget->h - margin_bottom - radius_outer, radius_outer, 0.0, G_PI_2 );
311  cairo_line_to ( d, widget->w - margin_right - radius_br - ceil ( right / 2.0 ), widget->h - margin_bottom );
312  cairo_line_to ( d, widget->w - margin_right - radius_br - ceil ( right / 2.0 ), widget->h - margin_bottom - bottom );
313  cairo_arc_negative ( d, widget->w - margin_right - right - radius_inner, widget->h - margin_bottom - bottom - radius_inner, radius_inner, G_PI_2, 0.0 );
314  cairo_line_to ( d, widget->w - margin_right - right, widget->h - margin_bottom - radius_br - ceil ( bottom / 2.0 ) );
315  cairo_line_to ( d, widget->w - margin_right, widget->h - margin_bottom - radius_br - ceil ( bottom / 2.0 ) );
316  cairo_close_path ( d );
317  cairo_fill ( d );
318  }
319  }
320  if ( bottom > 0 ) {
321  double offset = ( radius_bl > 0 ) ? floor ( left / 2.0 ) : 0;
322  cairo_set_line_width ( d, bottom );
324  cairo_move_to ( d, margin_left + radius_bl + offset, widget->h - bottom / 2.0 - margin_bottom );
325  offset = ( radius_br > 0 ) ? floor ( right / 2.0 ) : 0;
326  cairo_line_to ( d, widget->w - margin_right - radius_br - offset, widget->h - bottom / 2.0 - margin_bottom );
327  cairo_stroke ( d );
328  }
329  if ( radius_bl > 0 ) {
331  if ( bottom == left ) {
332  cairo_set_line_width ( d, left );
333  cairo_arc ( d, margin_left + left / 2.0 + radius_bl, widget->h - margin_bottom - radius_bl - left / 2.0, radius_bl, G_PI_2, G_PI );
334  cairo_stroke ( d );
335  }
336  else {
337  cairo_set_line_width ( d, 0 );
338  double minof = ceil ( MIN ( left / 2.0, bottom / 2.0 ) );
339  double radius_outer = radius_bl + minof;
340  double radius_inner = radius_bl - minof;
341  cairo_arc ( d, margin_left + radius_outer, widget->h - margin_bottom - radius_outer, radius_outer, G_PI_2, G_PI );
342  cairo_line_to ( d, margin_left, widget->h - margin_bottom - radius_bl - ceil ( bottom / 2.0 ) );
343  cairo_line_to ( d, margin_left + left, widget->h - margin_bottom - radius_bl - ceil ( bottom / 2.0 ) );
344  cairo_arc_negative ( d, margin_left + left + radius_inner, widget->h - margin_bottom - bottom - radius_inner, radius_inner, G_PI, G_PI_2 );
345  cairo_line_to ( d, margin_left + radius_bl + ceil ( left / 2.0 ), widget->h - margin_bottom - bottom );
346  cairo_line_to ( d, margin_left + radius_bl + ceil ( left / 2.0 ), widget->h - margin_bottom );
347  cairo_close_path ( d );
348  cairo_fill ( d );
349  }
350  }
351  cairo_restore ( d );
352  }
353  }
354 }
355 void widget_free ( widget *wid )
356 {
357  if ( wid ) {
358  if ( wid->name ) {
359  g_free ( wid->name );
360  }
361  if ( wid->free ) {
362  wid->free ( wid );
363  }
364  }
365 }
366 
368 {
369  if ( widget ) {
370  if ( widget->get_height ) {
371  return widget->get_height ( widget );
372  }
373  return widget->h;
374  }
375  return 0;
376 }
378 {
379  if ( widget ) {
380  if ( widget->get_width ) {
381  return widget->get_width ( widget );
382  }
383  return widget->w;
384  }
385  return 0;
386 }
388 {
389  if ( widget ) {
390  return widget->x;
391  }
392  return 0;
393 }
395 {
396  if ( widget ) {
397  return widget->y;
398  }
399  return 0;
400 }
401 
402 void widget_xy_to_relative ( widget *widget, gint *x, gint *y )
403 {
404  *x -= widget->x;
405  *y -= widget->y;
406  if ( widget->parent != NULL ) {
408  }
409 }
410 
412 {
413  // When (desired )size of widget changes.
414  if ( widget ) {
415  if ( widget->update ) {
416  widget->update ( widget );
417  }
418  }
419 }
420 
422 {
423  if ( wid ) {
424  widget *iter = wid;
425  // Find toplevel widget.
426  while ( iter->parent != NULL ) {
427  iter->need_redraw = TRUE;
428  iter = iter->parent;
429  }
430  iter->need_redraw = TRUE;
431  }
432 }
433 
434 gboolean widget_need_redraw ( widget *wid )
435 {
436  if ( wid && wid->enabled ) {
437  return wid->need_redraw;
438  }
439  return FALSE;
440 }
441 
442 widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y )
443 {
444  if ( !wid ) {
445  return NULL;
446  }
447 
448  if ( wid->find_mouse_target ) {
449  widget *target = wid->find_mouse_target ( wid, type, x, y );
450  if ( target != NULL ) {
451  return target;
452  }
453  }
454  if ( wid->type == type ) {
455  return wid;
456  }
457  return NULL;
458 }
459 
460 WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gint x, gint y )
461 {
462  if ( wid && wid->trigger_action ) {
463  return wid->trigger_action ( wid, action, x, y, wid->trigger_action_cb_data );
464  }
465  return FALSE;
466 }
467 
469 {
470  if ( wid == NULL ) {
471  return;
472  }
473  wid->trigger_action = cb;
474  wid->trigger_action_cb_data = cb_data;
475 }
476 
477 gboolean widget_motion_notify ( widget *wid, gint x, gint y )
478 {
479  if ( wid && wid->motion_notify ) {
480  wid->motion_notify ( wid, x, y );
481  }
482 
483  return FALSE;
484 }
485 
486 int widget_padding_get_left ( const widget *wid )
487 {
488  if ( wid == NULL ) {
489  return 0;
490  }
494  return distance;
495 }
497 {
498  if ( wid == NULL ) {
499  return 0;
500  }
504  return distance;
505 }
506 int widget_padding_get_top ( const widget *wid )
507 {
508  if ( wid == NULL ) {
509  return 0;
510  }
511  int distance = distance_get_pixel ( wid->padding.top, ROFI_ORIENTATION_VERTICAL );
514  return distance;
515 }
517 {
518  if ( wid == NULL ) {
519  return 0;
520  }
524  return distance;
525 }
526 
528 {
529  int width = wid->w;
530  width -= widget_padding_get_left ( wid );
531  width -= widget_padding_get_right ( wid );
532  return width;
533 }
535 {
536  int height = wid->h;
537  height -= widget_padding_get_top ( wid );
538  height -= widget_padding_get_bottom ( wid );
539  return height;
540 }
542 {
543  int height = 0;
544  height += widget_padding_get_top ( wid );
545  height += widget_padding_get_bottom ( wid );
546  return height;
547 }
549 {
550  int width = 0;
551  width += widget_padding_get_left ( wid );
552  width += widget_padding_get_right ( wid );
553  return width;
554 }
555 
557 {
558  if ( wid == NULL ) {
559  return 0;
560  }
561  if ( wid->get_desired_height ) {
562  return wid->get_desired_height ( wid );
563  }
564  return wid->h;
565 }
567 {
568  if ( wid == NULL ) {
569  return 0;
570  }
571  if ( wid->get_desired_width ) {
572  return wid->get_desired_width ( wid );
573  }
574  return wid->w;
575 }
576 
578 {
579  int retv = 0;
580  if ( wid ) {
581  retv += wid->x;
582  if ( wid->parent ) {
583  retv += widget_get_absolute_xpos ( wid->parent );
584  }
585  }
586  return retv;
587 }
589 {
590  int retv = 0;
591  if ( wid ) {
592  retv += wid->y;
593  if ( wid->parent ) {
594  retv += widget_get_absolute_ypos ( wid->parent );
595  }
596  }
597  return retv;
598 }
WidgetType widget_type(widget *widget)
Definition: widget.c:106
WidgetType
Definition: widget.h:56
int widget_padding_get_bottom(const widget *wid)
Definition: widget.c:516
gboolean widget_need_redraw(widget *wid)
Definition: widget.c:434
widget_find_mouse_target_cb find_mouse_target
void * trigger_action_cb_data
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:647
RofiDistance bottom
Definition: rofi-types.h:133
RofiPadding def_margin
int(* get_width)(struct _widget *)
void widget_update(widget *widget)
Definition: widget.c:411
int widget_padding_get_padding_width(const widget *wid)
Definition: widget.c:548
void(* resize)(struct _widget *, short, short)
int widget_padding_get_top(const widget *wid)
Definition: widget.c:506
WidgetTriggerActionResult(* widget_trigger_action_cb)(widget *widget, guint action, gint x, gint y, void *user_data)
Definition: widget.h:112
void widget_set_state(widget *widget, const char *state)
Definition: widget.c:56
struct _widget * parent
int widget_get_width(widget *widget)
Definition: widget.c:377
void widget_free(widget *wid)
Definition: widget.c:355
RofiPadding margin
int(* get_height)(struct _widget *)
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:669
RofiPadding def_border_radius
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:571
void widget_set_trigger_action_handler(widget *wid, widget_trigger_action_cb cb, void *cb_data)
Definition: widget.c:468
void(* draw)(struct _widget *widget, cairo_t *draw)
int(* get_desired_width)(struct _widget *)
void widget_draw(widget *widget, cairo_t *d)
Definition: widget.c:140
void widget_disable(widget *widget)
Definition: widget.c:131
int widget_intersect(const widget *widget, int x, int y)
Definition: widget.c:68
RofiPadding def_border
char * name
gboolean need_redraw
gboolean enabled
void widget_move(widget *widget, short x, short y)
Definition: widget.c:98
void widget_xy_to_relative(widget *widget, gint *x, gint *y)
Definition: widget.c:402
void widget_resize(widget *widget, short w, short h)
Definition: widget.c:82
widget_trigger_action_cb trigger_action
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action, gint x, gint y)
Definition: widget.c:460
void widget_queue_redraw(widget *wid)
Definition: widget.c:421
RofiDistance right
Definition: rofi-types.h:132
gboolean widget_enabled(widget *widget)
Definition: widget.c:114
int widget_padding_get_remaining_height(const widget *wid)
Definition: widget.c:534
void(* free)(struct _widget *widget)
#define WIDGET_DEFAULT_PADDING
Definition: widget.c:35
RofiPadding border_radius
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:735
int widget_get_desired_width(widget *wid)
Definition: widget.c:566
WidgetTriggerActionResult
Definition: widget.h:77
void widget_enable(widget *widget)
Definition: widget.c:122
int widget_padding_get_right(const widget *wid)
Definition: widget.c:496
int widget_get_x_pos(widget *widget)
Definition: widget.c:387
int widget_padding_get_remaining_width(const widget *wid)
Definition: widget.c:527
void widget_init(widget *wid, widget *parent, WidgetType type, const char *name)
Definition: widget.c:37
const char * state
int widget_get_absolute_xpos(widget *wid)
Definition: widget.c:577
gboolean widget_motion_notify(widget *wid, gint x, gint y)
Definition: widget.c:477
int widget_get_absolute_ypos(widget *wid)
Definition: widget.c:588
int(* get_desired_height)(struct _widget *)
int widget_get_desired_height(widget *wid)
Definition: widget.c:556
widget * widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
Definition: widget.c:442
int widget_padding_get_padding_height(const widget *wid)
Definition: widget.c:541
void(* update)(struct _widget *)
WidgetType type
RofiDistance left
Definition: rofi-types.h:134
RofiPadding padding
RofiPadding border
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:758
int widget_get_y_pos(widget *widget)
Definition: widget.c:394
RofiPadding def_padding
int widget_padding_get_left(const widget *wid)
Definition: widget.c:486
RofiDistance top
Definition: rofi-types.h:131
gboolean(* motion_notify)(struct _widget *, gint x, gint y)
int widget_get_height(widget *widget)
Definition: widget.c:367