rofi  1.7.3
widget.c
Go to the documentation of this file.
1 /*
2  * rofi
3  *
4  * MIT/X11 License
5  * Copyright © 2013-2021 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 "widgets/widget.h"
29 #include "theme.h"
31 #include <glib.h>
32 #include <math.h>
33 
34 void widget_init(widget *wid, widget *parent, WidgetType type,
35  const char *name) {
36  wid->type = type;
37  wid->parent = parent;
38  wid->name = g_strdup(name);
43 
44  wid->padding = rofi_theme_get_padding(wid, "padding", wid->def_padding);
45  wid->border = rofi_theme_get_padding(wid, "border", wid->def_border);
46  wid->border_radius =
47  rofi_theme_get_padding(wid, "border-radius", wid->def_border_radius);
48  wid->margin = rofi_theme_get_padding(wid, "margin", wid->def_margin);
49 
50  wid->cursor_type =
52 
53  // enabled by default
54  wid->enabled = rofi_theme_get_boolean(wid, "enabled", TRUE);
55 }
56 
57 void widget_set_state(widget *widget, const char *state) {
58  if (widget == NULL) {
59  return;
60  }
61  if (g_strcmp0(widget->state, state)) {
62  widget->state = state;
63  // Update border.
64  widget->border =
68  if (widget->set_state != NULL) {
69  widget->set_state(widget, state);
70  }
72  }
73 }
74 
75 int widget_intersect(const widget *widget, int x, int y) {
76  if (widget == NULL) {
77  return FALSE;
78  }
79 
80  if (x >= (widget->x) && x < (widget->x + widget->w) && y >= (widget->y) &&
81  y < (widget->y + widget->h)) {
82  return TRUE;
83  }
84  return FALSE;
85 }
86 
87 void widget_resize(widget *widget, short w, short h) {
88  if (widget == NULL) {
89  return;
90  }
91  if (widget->resize != NULL) {
92  if (widget->w != w || widget->h != h) {
93  widget->resize(widget, w, h);
94  }
95  } else {
96  widget->w = w;
97  widget->h = h;
98  }
99  // On a resize we always want to update.
101 }
102 void widget_move(widget *widget, short x, short y) {
103  if (widget == NULL) {
104  return;
105  }
106  widget->x = x;
107  widget->y = y;
108 }
110  if (widget == NULL) {
111  return;
112  }
113  widget->type = type;
114 }
115 
117  if (widget == NULL) {
118  return FALSE;
119  }
120  return widget->enabled;
121 }
122 
123 void widget_set_enabled(widget *widget, gboolean enabled) {
124  if (widget == NULL) {
125  return;
126  }
127  if (widget->enabled != enabled) {
128  widget->enabled = enabled;
132  }
133 }
134 
135 void widget_draw(widget *widget, cairo_t *d) {
136  if (widget == NULL) {
137  return;
138  }
139  // Check if enabled and if draw is implemented.
140  if (widget->enabled && widget->draw) {
141  // Don't draw if there is no space.
142  if (widget->h < 1 || widget->w < 1) {
143  widget->need_redraw = FALSE;
144  return;
145  }
146  // Store current state.
147  cairo_save(d);
148  const int margin_left =
150  const int margin_top =
152  const int margin_right =
154  const int margin_bottom =
156  const int left =
158  const int right =
160  const int top =
162  const int bottom =
164  int radius_bl = distance_get_pixel(widget->border_radius.left,
166  int radius_tr = distance_get_pixel(widget->border_radius.right,
168  int radius_tl = distance_get_pixel(widget->border_radius.top,
172 
173  double vspace =
174  widget->h - margin_top - margin_bottom - top / 2.0 - bottom / 2.0;
175  double hspace =
176  widget->w - margin_left - margin_right - left / 2.0 - right / 2.0;
177  if ((radius_bl + radius_tl) > (vspace)) {
178  int j = ((vspace) / 2.0);
179  radius_bl = MIN(radius_bl, j);
180  radius_tl = MIN(radius_tl, j);
181  }
182  if ((radius_br + radius_tr) > (vspace)) {
183  int j = ((vspace) / 2.0);
184  radius_br = MIN(radius_br, j);
185  radius_tr = MIN(radius_tr, j);
186  }
187  if ((radius_tl + radius_tr) > (hspace)) {
188  int j = ((hspace) / 2.0);
189  radius_tr = MIN(radius_tr, j);
190  radius_tl = MIN(radius_tl, j);
191  }
192  if ((radius_bl + radius_br) > (hspace)) {
193  int j = ((hspace) / 2.0);
194  radius_br = MIN(radius_br, j);
195  radius_bl = MIN(radius_bl, j);
196  }
197 
198  // Background painting.
199  // Set new x/y position.
200  cairo_translate(d, widget->x, widget->y);
201  cairo_set_line_width(d, 0);
202 
203  // Outer outline outlines
204  double x1, y1, x2, y2;
205  x1 = margin_left + left / 2.0, y1 = margin_top + top / 2.0,
206  x2 = widget->w - margin_right - right / 2.0,
207  y2 = widget->h - margin_bottom - bottom / 2.0;
208 
209  if (radius_tl > 0) {
210  cairo_move_to(d, x1, y1 + radius_tl);
211  cairo_arc(d, x1 + radius_tl, y1 + radius_tl, radius_tl, -1.0 * G_PI,
212  -G_PI_2);
213  } else {
214  cairo_move_to(d, x1, y1);
215  }
216  if (radius_tr > 0) {
217  cairo_line_to(d, x2 - radius_tr, y1);
218  cairo_arc(d, x2 - radius_tr, y1 + radius_tr, radius_tr, -G_PI_2,
219  0 * G_PI);
220  } else {
221  cairo_line_to(d, x2, y1);
222  }
223  if (radius_br > 0) {
224  cairo_line_to(d, x2, y2 - radius_br);
225  cairo_arc(d, x2 - radius_br, y2 - radius_br, radius_br, 0.0 * G_PI,
226  G_PI_2);
227  } else {
228  cairo_line_to(d, x2, y2);
229  }
230  if (radius_bl > 0) {
231  cairo_line_to(d, x1 + radius_bl, y2);
232  cairo_arc(d, x1 + radius_bl, y2 - radius_bl, radius_bl, G_PI_2,
233  1.0 * G_PI);
234  } else {
235  cairo_line_to(d, x1, y2);
236  }
237  cairo_close_path(d);
238 
239  cairo_set_source_rgba(d, 1.0, 1.0, 1.0, 1.0);
240  rofi_theme_get_color(widget, "background-color", d);
241  cairo_fill_preserve(d);
242  if (rofi_theme_get_image(widget, "background-image", d)) {
243  cairo_fill_preserve(d);
244  }
245  cairo_clip(d);
246 
247  widget->draw(widget, d);
248  widget->need_redraw = FALSE;
249 
250  cairo_restore(d);
251 
252  if (left != 0 || top != 0 || right != 0 || bottom != 0) {
253  cairo_save(d);
254  cairo_translate(d, widget->x, widget->y);
255  cairo_new_path(d);
256  rofi_theme_get_color(widget, "border-color", d);
257 
258  // Calculate the different offsets for the corners.
259  double minof_tr = MIN(right / 2.0, top / 2.0);
260  double minof_tl = MIN(left / 2.0, top / 2.0);
261  double minof_br = MIN(right / 2.0, bottom / 2.0);
262  double minof_bl = MIN(left / 2.0, bottom / 2.0);
263  // Inner radius
264  double radius_inner_tl = radius_tl - minof_tl;
265  double radius_inner_tr = radius_tr - minof_tr;
266  double radius_inner_bl = radius_bl - minof_bl;
267  double radius_inner_br = radius_br - minof_br;
268 
269  // Offsets of the different lines in each corner.
270  //
271  // | |
272  // ttl ttr
273  // | |
274  // -ltl-###############-rtr-
275  // $ $
276  // $ $
277  // -lbl-###############-rbr-
278  // | |
279  // bbl bbr
280  // | |
281  //
282  // The left and right part ($) start at thinkness top bottom when no
283  // radius
284  double offset_ltl =
285  (radius_inner_tl > 0) ? (left) + radius_inner_tl : left;
286  double offset_rtr =
287  (radius_inner_tr > 0) ? (right) + radius_inner_tr : right;
288  double offset_lbl =
289  (radius_inner_bl > 0) ? (left) + radius_inner_bl : left;
290  double offset_rbr =
291  (radius_inner_br > 0) ? (right) + radius_inner_br : right;
292  // The top and bottom part (#) go into the corner when no radius
293  double offset_ttl = (radius_inner_tl > 0) ? (top) + radius_inner_tl
294  : (radius_tl > 0) ? top
295  : 0;
296  double offset_ttr = (radius_inner_tr > 0) ? (top) + radius_inner_tr
297  : (radius_tr > 0) ? top
298  : 0;
299  double offset_bbl = (radius_inner_bl > 0) ? (bottom) + radius_inner_bl
300  : (radius_bl > 0) ? bottom
301  : 0;
302  double offset_bbr = (radius_inner_br > 0) ? (bottom) + radius_inner_br
303  : (radius_br > 0) ? bottom
304  : 0;
305 
306  if (left > 0) {
307  cairo_set_line_width(d, left);
309  cairo_move_to(d, x1, margin_top + offset_ttl);
310  cairo_line_to(d, x1, widget->h - margin_bottom - offset_bbl);
311  cairo_stroke(d);
312  }
313  if (right > 0) {
314  cairo_set_line_width(d, right);
316  cairo_move_to(d, x2, margin_top + offset_ttr);
317  cairo_line_to(d, x2, widget->h - margin_bottom - offset_bbr);
318  cairo_stroke(d);
319  }
320  if (top > 0) {
321  cairo_set_line_width(d, top);
323  cairo_move_to(d, margin_left + offset_ltl, y1);
324  cairo_line_to(d, widget->w - margin_right - offset_rtr, y1);
325  cairo_stroke(d);
326  }
327  if (bottom > 0) {
328  cairo_set_line_width(d, bottom);
330  cairo_move_to(d, margin_left + offset_lbl, y2);
331  cairo_line_to(d, widget->w - margin_right - offset_rbr, y2);
332  cairo_stroke(d);
333  }
334  if (radius_tl > 0) {
336  cairo_set_line_width(d, 0);
337  double radius_outer = radius_tl + minof_tl;
338  cairo_arc(d, margin_left + radius_outer, margin_top + radius_outer,
339  radius_outer, -G_PI, -G_PI_2);
340  cairo_line_to(d, margin_left + offset_ltl, margin_top);
341  cairo_line_to(d, margin_left + offset_ltl, margin_top + top);
342  if (radius_inner_tl > 0) {
343  cairo_arc_negative(d, margin_left + left + radius_inner_tl,
344  margin_top + top + radius_inner_tl,
345  radius_inner_tl, -G_PI_2, G_PI);
346  cairo_line_to(d, margin_left + left, margin_top + offset_ttl);
347  }
348  cairo_line_to(d, margin_left, margin_top + offset_ttl);
349  cairo_close_path(d);
350  cairo_fill(d);
351  }
352  if (radius_tr > 0) {
354  cairo_set_line_width(d, 0);
355  double radius_outer = radius_tr + minof_tr;
356  cairo_arc(d, widget->w - margin_right - radius_outer,
357  margin_top + radius_outer, radius_outer, -G_PI_2, 0);
358  cairo_line_to(d, widget->w - margin_right, margin_top + offset_ttr);
359  cairo_line_to(d, widget->w - margin_right - right,
360  margin_top + offset_ttr);
361  if (radius_inner_tr > 0) {
362  cairo_arc_negative(
363  d, widget->w - margin_right - right - radius_inner_tr,
364  margin_top + top + radius_inner_tr, radius_inner_tr, 0, -G_PI_2);
365  cairo_line_to(d, widget->w - margin_right - offset_rtr,
366  margin_top + top);
367  }
368  cairo_line_to(d, widget->w - margin_right - offset_rtr, margin_top);
369  cairo_close_path(d);
370  cairo_fill(d);
371  }
372  if (radius_br > 0) {
374  cairo_set_line_width(d, 1);
375  double radius_outer = radius_br + minof_br;
376  cairo_arc(d, widget->w - margin_right - radius_outer,
377  widget->h - margin_bottom - radius_outer, radius_outer, 0.0,
378  G_PI_2);
379  cairo_line_to(d, widget->w - margin_right - offset_rbr,
380  widget->h - margin_bottom);
381  cairo_line_to(d, widget->w - margin_right - offset_rbr,
382  widget->h - margin_bottom - bottom);
383  if (radius_inner_br > 0) {
384  cairo_arc_negative(
385  d, widget->w - margin_right - right - radius_inner_br,
386  widget->h - margin_bottom - bottom - radius_inner_br,
387  radius_inner_br, G_PI_2, 0.0);
388  cairo_line_to(d, widget->w - margin_right - right,
389  widget->h - margin_bottom - offset_bbr);
390  }
391  cairo_line_to(d, widget->w - margin_right,
392  widget->h - margin_bottom - offset_bbr);
393  cairo_close_path(d);
394  cairo_fill(d);
395  }
396  if (radius_bl > 0) {
398  cairo_set_line_width(d, 1.0);
399  double radius_outer = radius_bl + minof_bl;
400  cairo_arc(d, margin_left + radius_outer,
401  widget->h - margin_bottom - radius_outer, radius_outer,
402  G_PI_2, G_PI);
403  cairo_line_to(d, margin_left, widget->h - margin_bottom - offset_bbl);
404  cairo_line_to(d, margin_left + left,
405  widget->h - margin_bottom - offset_bbl);
406  if (radius_inner_bl > 0) {
407  cairo_arc_negative(d, margin_left + left + radius_inner_bl,
408  widget->h - margin_bottom - bottom -
409  radius_inner_bl,
410  radius_inner_bl, G_PI, G_PI_2);
411  cairo_line_to(d, margin_left + offset_lbl,
412  widget->h - margin_bottom - bottom);
413  }
414  cairo_line_to(d, margin_left + offset_lbl, widget->h - margin_bottom);
415  cairo_close_path(d);
416 
417  cairo_fill(d);
418  }
419 
420  cairo_restore(d);
421  }
422  }
423 }
424 
425 void widget_free(widget *wid) {
426  if (wid == NULL) {
427  return;
428  }
429  if (wid->name != NULL) {
430  g_free(wid->name);
431  }
432  if (wid->free != NULL) {
433  wid->free(wid);
434  }
435 }
436 
438  if (widget == NULL) {
439  return 0;
440  }
441  if (widget->get_height == NULL) {
442  return widget->h;
443  }
444  return widget->get_height(widget);
445 }
447  if (widget == NULL) {
448  return 0;
449  }
450  if (widget->get_width == NULL) {
451  return widget->w;
452  }
453  return widget->get_width(widget);
454 }
456  if (widget == NULL) {
457  return 0;
458  }
459  return widget->x;
460 }
462  if (widget == NULL) {
463  return 0;
464  }
465  return widget->y;
466 }
467 
468 void widget_xy_to_relative(widget *widget, gint *x, gint *y) {
469  *x -= widget->x;
470  *y -= widget->y;
471  if (widget->parent == NULL) {
472  return;
473  }
475 }
476 
478  if (widget == NULL) {
479  return;
480  }
481  // When (desired )size of widget changes.
482  if (widget->update != NULL) {
483  widget->update(widget);
484  }
485 }
486 
488  if (wid == NULL) {
489  return;
490  }
491  widget *iter = wid;
492  // Find toplevel widget.
493  while (iter->parent != NULL) {
494  iter->need_redraw = TRUE;
495  iter = iter->parent;
496  }
497  iter->need_redraw = TRUE;
498 }
499 
500 gboolean widget_need_redraw(widget *wid) {
501  if (wid == NULL) {
502  return FALSE;
503  }
504  if (!wid->enabled) {
505  return FALSE;
506  }
507  return wid->need_redraw;
508 }
509 
510 widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y) {
511  if (wid == NULL) {
512  return NULL;
513  }
514 
515  if (wid->find_mouse_target != NULL) {
516  widget *target = wid->find_mouse_target(wid, type, x, y);
517  if (target != NULL) {
518  return target;
519  }
520  }
521 
522  if (wid->type == type || type == WIDGET_TYPE_UNKNOWN) {
523  return wid;
524  }
525 
526  return NULL;
527 }
528 
530  gint y) {
531  if (wid == NULL) {
532  return FALSE;
533  }
534  if (wid->trigger_action == NULL) {
535  return FALSE;
536  }
537  /*
538  * TODO: We should probably add a check_action callback to the widgets
539  * to do extra checks
540  */
542 }
543 
545  gint x, gint y) {
546  if (wid == NULL) {
547  return FALSE;
548  }
549  if (wid->trigger_action == NULL) {
550  return FALSE;
551  }
552  return wid->trigger_action(wid, action, x, y, wid->trigger_action_cb_data);
553 }
554 
556  void *cb_data) {
557  if (wid == NULL) {
558  return;
559  }
560  wid->trigger_action = cb;
561  wid->trigger_action_cb_data = cb_data;
562 }
563 
564 gboolean widget_motion_notify(widget *wid, gint x, gint y) {
565  if (wid == NULL) {
566  return FALSE;
567  }
568  if (wid->motion_notify == NULL) {
569  return FALSE;
570  }
571  return wid->motion_notify(wid, x, y);
572 }
573 
575  if (wid == NULL) {
576  return 0;
577  }
578  int distance =
582  return distance;
583 }
585  if (wid == NULL) {
586  return 0;
587  }
588  int distance =
590  distance +=
592  distance +=
594  return distance;
595 }
597  if (wid == NULL) {
598  return 0;
599  }
600  int distance =
604  return distance;
605 }
607  if (wid == NULL) {
608  return 0;
609  }
610  int distance =
614  return distance;
615 }
616 
618  int width = wid->w;
619  width -= widget_padding_get_left(wid);
620  width -= widget_padding_get_right(wid);
621  return width;
622 }
624  int height = wid->h;
625  height -= widget_padding_get_top(wid);
626  height -= widget_padding_get_bottom(wid);
627  return height;
628 }
630  int height = 0;
631  height += widget_padding_get_top(wid);
632  height += widget_padding_get_bottom(wid);
633  return height;
634 }
636  int width = 0;
637  width += widget_padding_get_left(wid);
638  width += widget_padding_get_right(wid);
639  return width;
640 }
641 
642 int widget_get_desired_height(widget *wid, const int width) {
643  if (wid == NULL) {
644  return 0;
645  }
646  if (wid->get_desired_height == NULL) {
647  return wid->h;
648  }
649  return wid->get_desired_height(wid, width);
650 }
651 int widget_get_desired_width(widget *wid, const int height) {
652  if (wid == NULL) {
653  return 0;
654  }
655  if (wid->get_desired_width == NULL) {
656  return wid->w;
657  }
658  return wid->get_desired_width(wid, height);
659 }
660 
662  if (wid == NULL) {
663  return 0;
664  }
665  int retv = wid->x;
666  if (wid->parent != NULL) {
667  retv += widget_get_absolute_xpos(wid->parent);
668  }
669  return retv;
670 }
672  if (wid == NULL) {
673  return 0;
674  }
675  int retv = wid->y;
676  if (wid->parent != NULL) {
677  retv += widget_get_absolute_ypos(wid->parent);
678  }
679  return retv;
680 }
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action, gint x, gint y)
Definition: widget.c:544
void widget_queue_redraw(widget *wid)
Definition: widget.c:487
gboolean widget_enabled(widget *widget)
Definition: widget.c:116
int widget_get_width(widget *widget)
Definition: widget.c:446
void widget_free(widget *wid)
Definition: widget.c:425
int widget_intersect(const widget *widget, int x, int y)
Definition: widget.c:75
int widget_get_height(widget *widget)
Definition: widget.c:437
void widget_resize(widget *widget, short w, short h)
Definition: widget.c:87
WidgetType
Definition: widget.h:56
void widget_set_enabled(widget *widget, gboolean enabled)
Definition: widget.c:123
WidgetTriggerActionResult widget_check_action(widget *wid, guint action, gint x, gint y)
Definition: widget.c:529
void widget_update(widget *widget)
Definition: widget.c:477
int widget_get_desired_width(widget *wid, const int height)
Definition: widget.c:651
int widget_get_absolute_ypos(widget *wid)
Definition: widget.c:671
void widget_move(widget *widget, short x, short y)
Definition: widget.c:102
int widget_get_y_pos(widget *widget)
Definition: widget.c:461
int widget_get_absolute_xpos(widget *wid)
Definition: widget.c:661
void widget_draw(widget *widget, cairo_t *d)
Definition: widget.c:135
void widget_xy_to_relative(widget *widget, gint *x, gint *y)
Definition: widget.c:468
WidgetTriggerActionResult
Definition: widget.h:76
widget * widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
Definition: widget.c:510
void widget_set_type(widget *widget, WidgetType type)
Definition: widget.c:109
void widget_set_trigger_action_handler(widget *wid, widget_trigger_action_cb cb, void *cb_data)
Definition: widget.c:555
int widget_get_desired_height(widget *wid, const int width)
Definition: widget.c:642
gboolean widget_motion_notify(widget *wid, gint x, gint y)
Definition: widget.c:564
WidgetTriggerActionResult(* widget_trigger_action_cb)(widget *widget, guint action, gint x, gint y, void *user_data)
Definition: widget.h:113
gboolean widget_need_redraw(widget *wid)
Definition: widget.c:500
int widget_get_x_pos(widget *widget)
Definition: widget.c:455
@ WIDGET_TYPE_UNKNOWN
Definition: widget.h:58
@ WIDGET_TRIGGER_ACTION_RESULT_HANDLED
Definition: widget.h:80
@ ROFI_ORIENTATION_HORIZONTAL
Definition: rofi-types.h:139
@ ROFI_ORIENTATION_VERTICAL
Definition: rofi-types.h:138
@ ROFI_CURSOR_DEFAULT
Definition: rofi-types.h:146
RofiDistance bottom
Definition: rofi-types.h:208
RofiDistance top
Definition: rofi-types.h:206
RofiDistance right
Definition: rofi-types.h:207
RofiDistance left
Definition: rofi-types.h:209
void(* free)(struct _widget *widget)
void(* set_state)(struct _widget *, const char *)
const char * state
RofiPadding border
widget_find_mouse_target_cb find_mouse_target
gboolean enabled
gboolean need_redraw
widget_trigger_action_cb trigger_action
void * trigger_action_cb_data
RofiPadding padding
int(* get_desired_width)(struct _widget *, const int height)
int(* get_width)(struct _widget *)
RofiPadding margin
RofiPadding border_radius
RofiPadding def_border_radius
int(* get_height)(struct _widget *)
char * name
int(* get_desired_height)(struct _widget *, const int width)
RofiPadding def_margin
RofiCursorType cursor_type
RofiPadding def_border
struct _widget * parent
void(* update)(struct _widget *)
RofiPadding def_padding
void(* draw)(struct _widget *widget, cairo_t *draw)
gboolean(* motion_notify)(struct _widget *, gint x, gint y)
void(* resize)(struct _widget *, short, short)
WidgetType type
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:1201
gboolean rofi_theme_get_image(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1166
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:891
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:1403
RofiCursorType rofi_theme_get_cursor_type(const widget *widget, const char *property, RofiCursorType def)
Definition: theme.c:950
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:1055
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:1407
#define WIDGET_PADDING_INIT
int widget_padding_get_remaining_width(const widget *wid)
Definition: widget.c:617
void widget_init(widget *wid, widget *parent, WidgetType type, const char *name)
Definition: widget.c:34
void widget_set_state(widget *widget, const char *state)
Definition: widget.c:57
int widget_padding_get_padding_width(const widget *wid)
Definition: widget.c:635
int widget_padding_get_left(const widget *wid)
Definition: widget.c:574
int widget_padding_get_right(const widget *wid)
Definition: widget.c:584
int widget_padding_get_padding_height(const widget *wid)
Definition: widget.c:629
int widget_padding_get_top(const widget *wid)
Definition: widget.c:596
int widget_padding_get_bottom(const widget *wid)
Definition: widget.c:606
int widget_padding_get_remaining_height(const widget *wid)
Definition: widget.c:623