rofi  1.5.4
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 );
42  wid->def_padding =
48 
49  wid->padding = rofi_theme_get_padding ( wid, "padding", wid->def_padding );
50  wid->border = rofi_theme_get_padding ( wid, "border", wid->def_border );
51  wid->border_radius = rofi_theme_get_padding ( wid, "border-radius", wid->def_border_radius );
52  wid->margin = rofi_theme_get_padding ( wid, "margin", wid->def_margin );
53 
54  // bled by default
55  wid->enabled = rofi_theme_get_boolean ( wid, "enabled", TRUE );
56 }
57 
58 void widget_set_state ( widget *widget, const char *state )
59 {
60  if ( g_strcmp0 ( widget->state, state ) ) {
61  widget->state = state;
62  // Update border.
65 
67  }
68 }
69 
70 int widget_intersect ( const widget *widget, int x, int y )
71 {
72  if ( widget == NULL ) {
73  return FALSE;
74  }
75 
76  if ( x >= ( widget->x ) && x < ( widget->x + widget->w ) ) {
77  if ( y >= ( widget->y ) && y < ( widget->y + widget->h ) ) {
78  return TRUE;
79  }
80  }
81  return FALSE;
82 }
83 
84 void widget_resize ( widget *widget, short w, short h )
85 {
86  if ( widget != NULL ) {
87  if ( widget->resize != NULL ) {
88  if ( widget->w != w || widget->h != h ) {
89  widget->resize ( widget, w, h );
90  }
91  }
92  else {
93  widget->w = w;
94  widget->h = h;
95  }
96  // On a resize we always want to udpate.
98  }
99 }
100 void widget_move ( widget *widget, short x, short y )
101 {
102  if ( widget != NULL ) {
103  widget->x = x;
104  widget->y = y;
105  }
106 }
107 
109 {
110  if ( widget != NULL ) {
111  return widget->type;
112  }
113  return WIDGET_TYPE_UNKNOWN;
114 }
115 
117 {
118  if ( widget != NULL ) {
119  return widget->enabled;
120  }
121  return FALSE;
122 }
123 
125 {
126  if ( widget && !widget->enabled ) {
127  widget->enabled = TRUE;
128  widget_update ( widget );
131  }
132 }
134 {
135  if ( widget && widget->enabled ) {
136  widget->enabled = FALSE;
137  widget_update ( widget );
140  }
141 }
142 void widget_draw ( widget *widget, cairo_t *d )
143 {
144  // Check if enabled and if draw is implemented.
145  if ( widget && widget->enabled && widget->draw ) {
146  // Don't draw if there is no space.
147  if ( widget->h < 1 || widget->w < 1 ) {
148  widget->need_redraw = FALSE;
149  return;
150  }
151  // Store current state.
152  cairo_save ( d );
153  const int margin_left = distance_get_pixel ( widget->margin.left, ROFI_ORIENTATION_HORIZONTAL );
154  const int margin_top = distance_get_pixel ( widget->margin.top, ROFI_ORIENTATION_VERTICAL );
155  const int margin_right = distance_get_pixel ( widget->margin.right, ROFI_ORIENTATION_HORIZONTAL );
156  const int margin_bottom = distance_get_pixel ( widget->margin.bottom, ROFI_ORIENTATION_VERTICAL );
165 
166  double vspace = widget->h - margin_top - margin_bottom - top / 2.0 - bottom / 2.0;
167  double hspace = widget->w - margin_left - margin_right - left / 2.0 - right / 2.0;
168  if ( ( radius_bl + radius_tl ) > ( vspace ) ) {
169  int j = ( ( vspace ) / 2.0 );
170  radius_bl = MIN ( radius_bl, j );
171  radius_tl = MIN ( radius_tl, j );
172  }
173  if ( ( radius_br + radius_tr ) > ( vspace ) ) {
174  int j = ( ( vspace ) / 2.0 );
175  radius_br = MIN ( radius_br, j );
176  radius_tr = MIN ( radius_tr, j );
177  }
178  if ( ( radius_tl + radius_tr ) > ( hspace ) ) {
179  int j = ( ( hspace ) / 2.0 );
180  radius_tr = MIN ( radius_tr, j );
181  radius_tl = MIN ( radius_tl, j );
182  }
183  if ( ( radius_bl + radius_br ) > ( hspace ) ) {
184  int j = ( ( hspace ) / 2.0 );
185  radius_br = MIN ( radius_br, j );
186  radius_bl = MIN ( radius_bl, j );
187  }
188 
189  // Background painting.
190  // Set new x/y position.
191  cairo_translate ( d, widget->x, widget->y );
192  cairo_set_line_width ( d, 0 );
193  // Set outlines.
194  cairo_move_to ( d, margin_left + radius_tl + left / 2.0, margin_top + radius_tl + top / 2.0 );
195  if ( radius_tl ) {
196  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 );
197  }
198  cairo_line_to ( d, widget->w - margin_right - radius_tr - right / 2.0, margin_top + top / 2.0 );
199  if ( radius_tr ) {
200  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 );
201  }
202  cairo_line_to ( d, widget->w - margin_right - right / 2.0, widget->h - margin_bottom - radius_br - bottom / 2.0 );
203  if ( radius_br ) {
204  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 );
205  }
206  cairo_line_to ( d, margin_left + radius_bl + left / 2.0, widget->h - margin_bottom - bottom / 2.0 );
207  if ( radius_bl ) {
208  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 );
209  }
210  cairo_line_to ( d, margin_left + left / 2.0, margin_top + radius_tl + top / 2.0 );
211  cairo_close_path ( d );
212 
213  cairo_set_source_rgba ( d, 1.0, 1.0, 1.0, 1.0 );
214  rofi_theme_get_color ( widget, "background-color", d );
215  cairo_fill_preserve ( d );
216  cairo_clip ( d );
217 
218  widget->draw ( widget, d );
219  widget->need_redraw = FALSE;
220 
221  cairo_restore ( d );
222 
223  if ( left || top || right || bottom ) {
224  cairo_save ( d );
225  cairo_translate ( d, widget->x, widget->y );
226  cairo_new_path ( d );
227  rofi_theme_get_color ( widget, "border-color", d );
228  // Calculate the different offsets for the corners.
229  double minof_tr = MIN ( right / 2.0, top / 2.0 );
230  double minof_tl = MIN ( left / 2.0, top / 2.0 );
231  double minof_br = MIN ( right / 2.0, bottom / 2.0 );
232  double minof_bl = MIN ( left / 2.0, bottom / 2.0 );
233  // Inner radius
234  double radius_inner_tl = radius_tl - minof_tl;
235  double radius_inner_tr = radius_tr - minof_tr;
236  double radius_inner_bl = radius_bl - minof_bl;
237  double radius_inner_br = radius_br - minof_br;
238 
239  // Offsets of the different lines in each corner.
240  //
241  // | |
242  // ttl ttr
243  // | |
244  // -ltl-###############-rtr-
245  // $ $
246  // $ $
247  // -lbl-###############-rbr-
248  // | |
249  // bbl bbr
250  // | |
251  //
252  // The left and right part ($) start at thinkness top bottom when no radius
253  double offset_ltl = ( radius_inner_tl > 0 ) ? ( left ) + radius_inner_tl : left;
254  double offset_rtr = ( radius_inner_tr > 0 ) ? ( right ) + radius_inner_tr : right;
255  double offset_lbl = ( radius_inner_bl > 0 ) ? ( left ) + radius_inner_bl : left;
256  double offset_rbr = ( radius_inner_br > 0 ) ? ( right ) + radius_inner_br : right;
257  // The top and bottom part (#) go into the corner when no radius
258  double offset_ttl = ( radius_inner_tl > 0 ) ? ( top ) + radius_inner_tl : ( radius_tl > 0 ) ? top : 0;
259  double offset_ttr = ( radius_inner_tr > 0 ) ? ( top ) + radius_inner_tr : ( radius_tr > 0 ) ? top : 0;
260  double offset_bbl = ( radius_inner_bl > 0 ) ? ( bottom ) + radius_inner_bl : ( radius_bl > 0 ) ? bottom : 0;
261  double offset_bbr = ( radius_inner_br > 0 ) ? ( bottom ) + radius_inner_br : ( radius_br > 0 ) ? bottom : 0;
262 
263  if ( left > 0 ) {
264  cairo_set_line_width ( d, left );
266  cairo_move_to ( d, margin_left + ( left / 2.0 ), margin_top + offset_ttl );
267  cairo_line_to ( d, margin_left + left / 2.0, widget->h - margin_bottom - offset_bbl );
268  cairo_stroke ( d );
269  }
270  if ( right > 0 ) {
271  cairo_set_line_width ( d, right );
273  cairo_move_to ( d, widget->w - margin_right - right / 2.0, margin_top + offset_ttr );
274  cairo_line_to ( d, widget->w - margin_right - right / 2.0, widget->h - margin_bottom - offset_bbr );
275  cairo_stroke ( d );
276  }
277  if ( top > 0 ) {
278  cairo_set_line_width ( d, top );
280  cairo_move_to ( d, margin_left + offset_ltl, margin_top + top / 2.0 );
281  cairo_line_to ( d, widget->w - margin_right - offset_rtr, margin_top + top / 2.0 );
282  cairo_stroke ( d );
283  }
284  if ( bottom > 0 ) {
285  cairo_set_line_width ( d, bottom );
287  cairo_move_to ( d, margin_left + offset_lbl, widget->h - ( bottom / 2.0 ) - margin_bottom );
288  cairo_line_to ( d, widget->w - margin_right - offset_rbr, widget->h - bottom / 2.0 - margin_bottom );
289  cairo_stroke ( d );
290  }
291  if ( radius_tl > 0 ) {
293  cairo_set_line_width ( d, 0 );
294  double radius_outer = radius_tl + minof_tl;
295  cairo_arc ( d, margin_left + radius_outer, margin_top + radius_outer, radius_outer, -G_PI, -G_PI_2 );
296  cairo_line_to ( d, margin_left + offset_ltl, margin_top );
297  cairo_line_to ( d, margin_left + offset_ltl, margin_top + top );
298  if ( radius_inner_tl > 0 ) {
299  cairo_arc_negative ( d,
300  margin_left + left + radius_inner_tl,
301  margin_top + top + radius_inner_tl,
302  radius_inner_tl, -G_PI_2, G_PI );
303  cairo_line_to ( d, margin_left + left, margin_top + offset_ttl );
304  }
305  cairo_line_to ( d, margin_left, margin_top + offset_ttl );
306  cairo_close_path ( d );
307  cairo_fill ( d );
308  }
309  if ( radius_tr > 0 ) {
311  cairo_set_line_width ( d, 0 );
312  double radius_outer = radius_tr + minof_tr;
313  cairo_arc ( d, widget->w - margin_right - radius_outer, margin_top + radius_outer, radius_outer, -G_PI_2, 0 );
314  cairo_line_to ( d, widget->w - margin_right, margin_top + offset_ttr );
315  cairo_line_to ( d, widget->w - margin_right - right, margin_top + offset_ttr );
316  if ( radius_inner_tr > 0 ) {
317  cairo_arc_negative ( d, widget->w - margin_right - right - radius_inner_tr,
318  margin_top + top + radius_inner_tr,
319  radius_inner_tr, 0, -G_PI_2 );
320  cairo_line_to ( d, widget->w - margin_right - offset_rtr, margin_top + top );
321  }
322  cairo_line_to ( d, widget->w - margin_right - offset_rtr, margin_top );
323  cairo_close_path ( d );
324  cairo_fill ( d );
325  }
326  if ( radius_br > 0 ) {
328  cairo_set_line_width ( d, 1 );
329  double radius_outer = radius_br + minof_br;
330  cairo_arc ( d, widget->w - margin_right - radius_outer, widget->h - margin_bottom - radius_outer, radius_outer, 0.0, G_PI_2 );
331  cairo_line_to ( d, widget->w - margin_right - offset_rbr, widget->h - margin_bottom );
332  cairo_line_to ( d, widget->w - margin_right - offset_rbr, widget->h - margin_bottom - bottom );
333  if ( radius_inner_br > 0 ) {
334  cairo_arc_negative ( d, widget->w - margin_right - right - radius_inner_br,
335  widget->h - margin_bottom - bottom - radius_inner_br,
336  radius_inner_br, G_PI_2, 0.0 );
337  cairo_line_to ( d, widget->w - margin_right - right, widget->h - margin_bottom - offset_bbr );
338  }
339  cairo_line_to ( d, widget->w - margin_right, widget->h - margin_bottom - offset_bbr );
340  cairo_close_path ( d );
341  cairo_fill ( d );
342  }
343  if ( radius_bl > 0 ) {
345  cairo_set_line_width ( d, 1.0 );
346  double radius_outer = radius_bl + minof_bl;
347  cairo_arc ( d, margin_left + radius_outer, widget->h - margin_bottom - radius_outer, radius_outer, G_PI_2, G_PI );
348  cairo_line_to ( d, margin_left, widget->h - margin_bottom - offset_bbl );
349  cairo_line_to ( d, margin_left + left, widget->h - margin_bottom - offset_bbl );
350  if ( radius_inner_bl > 0 ) {
351  cairo_arc_negative ( d, margin_left + left + radius_inner_bl,
352  widget->h - margin_bottom - bottom - radius_inner_bl,
353  radius_inner_bl, G_PI, G_PI_2 );
354  cairo_line_to ( d, margin_left + offset_lbl, widget->h - margin_bottom - bottom );
355  }
356  cairo_line_to ( d, margin_left + offset_lbl, widget->h - margin_bottom );
357  cairo_close_path ( d );
358  cairo_fill ( d );
359  }
360  cairo_restore ( d );
361  }
362  }
363 }
364 
365 void widget_free ( widget *wid )
366 {
367  if ( wid ) {
368  if ( wid->name ) {
369  g_free ( wid->name );
370  }
371  if ( wid->free ) {
372  wid->free ( wid );
373  }
374  return;
375  }
376 }
377 
379 {
380  if ( widget ) {
381  if ( widget->get_height ) {
382  return widget->get_height ( widget );
383  }
384  return widget->h;
385  }
386  return 0;
387 }
389 {
390  if ( widget ) {
391  if ( widget->get_width ) {
392  return widget->get_width ( widget );
393  }
394  return widget->w;
395  }
396  return 0;
397 }
399 {
400  if ( widget ) {
401  return widget->x;
402  }
403  return 0;
404 }
406 {
407  if ( widget ) {
408  return widget->y;
409  }
410  return 0;
411 }
412 
413 void widget_xy_to_relative ( widget *widget, gint *x, gint *y )
414 {
415  *x -= widget->x;
416  *y -= widget->y;
417  if ( widget->parent != NULL ) {
419  }
420 }
421 
423 {
424  // When (desired )size of widget changes.
425  if ( widget ) {
426  if ( widget->update ) {
427  widget->update ( widget );
428  }
429  }
430 }
431 
433 {
434  if ( wid ) {
435  widget *iter = wid;
436  // Find toplevel widget.
437  while ( iter->parent != NULL ) {
438  iter->need_redraw = TRUE;
439  iter = iter->parent;
440  }
441  iter->need_redraw = TRUE;
442  }
443 }
444 
445 gboolean widget_need_redraw ( widget *wid )
446 {
447  if ( wid && wid->enabled ) {
448  return wid->need_redraw;
449  }
450  return FALSE;
451 }
452 
453 widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y )
454 {
455  if ( !wid ) {
456  return NULL;
457  }
458 
459  if ( wid->find_mouse_target ) {
460  widget *target = wid->find_mouse_target ( wid, type, x, y );
461  if ( target != NULL ) {
462  return target;
463  }
464  }
465  if ( wid->type == type ) {
466  return wid;
467  }
468  return NULL;
469 }
470 
471 WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gint x, gint y )
472 {
473  if ( wid && wid->trigger_action ) {
474  return wid->trigger_action ( wid, action, x, y, wid->trigger_action_cb_data );
475  }
476  return FALSE;
477 }
478 
480 {
481  if ( wid == NULL ) {
482  return;
483  }
484  wid->trigger_action = cb;
485  wid->trigger_action_cb_data = cb_data;
486 }
487 
488 gboolean widget_motion_notify ( widget *wid, gint x, gint y )
489 {
490  if ( wid && wid->motion_notify ) {
491  wid->motion_notify ( wid, x, y );
492  }
493 
494  return FALSE;
495 }
496 
497 int widget_padding_get_left ( const widget *wid )
498 {
499  if ( wid == NULL ) {
500  return 0;
501  }
505  return distance;
506 }
508 {
509  if ( wid == NULL ) {
510  return 0;
511  }
515  return distance;
516 }
517 int widget_padding_get_top ( const widget *wid )
518 {
519  if ( wid == NULL ) {
520  return 0;
521  }
522  int distance = distance_get_pixel ( wid->padding.top, ROFI_ORIENTATION_VERTICAL );
525  return distance;
526 }
528 {
529  if ( wid == NULL ) {
530  return 0;
531  }
535  return distance;
536 }
537 
539 {
540  int width = wid->w;
541  width -= widget_padding_get_left ( wid );
542  width -= widget_padding_get_right ( wid );
543  return width;
544 }
546 {
547  int height = wid->h;
548  height -= widget_padding_get_top ( wid );
549  height -= widget_padding_get_bottom ( wid );
550  return height;
551 }
553 {
554  int height = 0;
555  height += widget_padding_get_top ( wid );
556  height += widget_padding_get_bottom ( wid );
557  return height;
558 }
560 {
561  int width = 0;
562  width += widget_padding_get_left ( wid );
563  width += widget_padding_get_right ( wid );
564  return width;
565 }
566 
568 {
569  if ( wid == NULL ) {
570  return 0;
571  }
572  if ( wid->get_desired_height ) {
573  return wid->get_desired_height ( wid );
574  }
575  return wid->h;
576 }
578 {
579  if ( wid == NULL ) {
580  return 0;
581  }
582  if ( wid->get_desired_width ) {
583  return wid->get_desired_width ( wid );
584  }
585  return wid->w;
586 }
587 
589 {
590  int retv = 0;
591  if ( wid ) {
592  retv += wid->x;
593  if ( wid->parent ) {
594  retv += widget_get_absolute_xpos ( wid->parent );
595  }
596  }
597  return retv;
598 }
600 {
601  int retv = 0;
602  if ( wid ) {
603  retv += wid->y;
604  if ( wid->parent ) {
605  retv += widget_get_absolute_ypos ( wid->parent );
606  }
607  }
608  return retv;
609 }
widget_xy_to_relative
void widget_xy_to_relative(widget *widget, gint *x, gint *y)
Definition: widget.c:413
rofi_theme_get_color
void rofi_theme_get_color(const widget *widget, const char *property, cairo_t *d)
Definition: theme.c:677
WidgetType
WidgetType
Definition: widget.h:57
widget_set_trigger_action_handler
void widget_set_trigger_action_handler(widget *wid, widget_trigger_action_cb cb, void *cb_data)
Definition: widget.c:479
WIDGET_TYPE_UNKNOWN
@ WIDGET_TYPE_UNKNOWN
Definition: widget.h:59
_widget::enabled
gboolean enabled
Definition: widget-internal.h:58
_widget::trigger_action_cb_data
void * trigger_action_cb_data
Definition: widget-internal.h:89
_widget::get_height
int(* get_height)(struct _widget *)
Definition: widget-internal.h:70
ROFI_ORIENTATION_VERTICAL
@ ROFI_ORIENTATION_VERTICAL
Definition: rofi-types.h:107
_widget::margin
RofiPadding margin
Definition: widget-internal.h:52
widget_get_height
int widget_get_height(widget *widget)
Definition: widget.c:378
_widget::get_desired_width
int(* get_desired_width)(struct _widget *)
Definition: widget-internal.h:82
distance_get_pixel
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
Definition: theme.c:765
_widget::get_desired_height
int(* get_desired_height)(struct _widget *)
Definition: widget-internal.h:81
_widget::get_width
int(* get_width)(struct _widget *)
Definition: widget-internal.h:68
rofi_theme_get_boolean
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
Definition: theme.c:601
_widget::def_border_radius
RofiPadding def_border_radius
Definition: widget-internal.h:51
_widget::def_margin
RofiPadding def_margin
Definition: widget-internal.h:48
widget_get_width
int widget_get_width(widget *widget)
Definition: widget.c:388
_widget::state
const char * state
Definition: widget-internal.h:96
widget_padding_get_bottom
int widget_padding_get_bottom(const widget *wid)
Definition: widget.c:527
widget_find_mouse_target
widget * widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
Definition: widget.c:453
widget_set_state
void widget_set_state(widget *widget, const char *state)
Definition: widget.c:58
widget_padding_get_right
int widget_padding_get_right(const widget *wid)
Definition: widget.c:507
widget_padding_get_remaining_height
int widget_padding_get_remaining_height(const widget *wid)
Definition: widget.c:545
widget_update
void widget_update(widget *widget)
Definition: widget.c:422
widget_padding_get_remaining_width
int widget_padding_get_remaining_width(const widget *wid)
Definition: widget.c:538
_widget::draw
void(* draw)(struct _widget *widget, cairo_t *draw)
Definition: widget-internal.h:72
_widget::name
char * name
Definition: widget-internal.h:95
_widget::def_border
RofiPadding def_border
Definition: widget-internal.h:50
theme.h
widget_free
void widget_free(widget *wid)
Definition: widget.c:365
_widget::free
void(* free)(struct _widget *widget)
Definition: widget-internal.h:92
_widget::trigger_action
widget_trigger_action_cb trigger_action
Definition: widget-internal.h:87
widget_get_desired_width
int widget_get_desired_width(widget *wid)
Definition: widget.c:577
_widget::y
short y
Definition: widget-internal.h:42
widget_queue_redraw
void widget_queue_redraw(widget *wid)
Definition: widget.c:432
widget.h
_widget::x
short x
Definition: widget-internal.h:40
RofiPadding
Definition: rofi-types.h:130
widget_padding_get_top
int widget_padding_get_top(const widget *wid)
Definition: widget.c:517
_widget::parent
struct _widget * parent
Definition: widget-internal.h:64
rofi_theme_get_padding
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property, RofiPadding pad)
Definition: theme.c:699
widget_get_absolute_xpos
int widget_get_absolute_xpos(widget *wid)
Definition: widget.c:588
widget_motion_notify
gboolean widget_motion_notify(widget *wid, gint x, gint y)
Definition: widget.c:488
widget_get_absolute_ypos
int widget_get_absolute_ypos(widget *wid)
Definition: widget.c:599
widget_disable
void widget_disable(widget *widget)
Definition: widget.c:133
widget_intersect
int widget_intersect(const widget *widget, int x, int y)
Definition: widget.c:70
widget_get_x_pos
int widget_get_x_pos(widget *widget)
Definition: widget.c:398
WIDGET_DEFAULT_PADDING
#define WIDGET_DEFAULT_PADDING
Definition: widget.c:35
distance_get_linestyle
void distance_get_linestyle(RofiDistance d, cairo_t *draw)
Definition: theme.c:788
ROFI_HL_SOLID
@ ROFI_HL_SOLID
Definition: rofi-types.h:69
widget_move
void widget_move(widget *widget, short x, short y)
Definition: widget.c:100
RofiPadding::right
RofiDistance right
Definition: rofi-types.h:132
_widget::h
short h
Definition: widget-internal.h:46
widget_get_y_pos
int widget_get_y_pos(widget *widget)
Definition: widget.c:405
_widget::motion_notify
gboolean(* motion_notify)(struct _widget *, gint x, gint y)
Definition: widget-internal.h:79
RofiPadding::left
RofiDistance left
Definition: rofi-types.h:134
widget_init
void widget_init(widget *wid, widget *parent, WidgetType type, const char *name)
Definition: widget.c:37
_widget::w
short w
Definition: widget-internal.h:44
_widget::border
RofiPadding border
Definition: widget-internal.h:54
_widget::def_padding
RofiPadding def_padding
Definition: widget-internal.h:49
widget_trigger_action
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action, gint x, gint y)
Definition: widget.c:471
widget_enable
void widget_enable(widget *widget)
Definition: widget.c:124
widget-internal.h
RofiPadding::top
RofiDistance top
Definition: rofi-types.h:131
widget_trigger_action_cb
WidgetTriggerActionResult(* widget_trigger_action_cb)(widget *widget, guint action, gint x, gint y, void *user_data)
Definition: widget.h:112
widget_draw
void widget_draw(widget *widget, cairo_t *d)
Definition: widget.c:142
_widget::border_radius
RofiPadding border_radius
Definition: widget-internal.h:55
_widget::find_mouse_target
widget_find_mouse_target_cb find_mouse_target
Definition: widget-internal.h:85
widget_padding_get_left
int widget_padding_get_left(const widget *wid)
Definition: widget.c:497
_widget::resize
void(* resize)(struct _widget *, short, short)
Definition: widget-internal.h:74
widget_get_desired_height
int widget_get_desired_height(widget *wid)
Definition: widget.c:567
_widget::padding
RofiPadding padding
Definition: widget-internal.h:53
RofiPadding::bottom
RofiDistance bottom
Definition: rofi-types.h:133
widget_resize
void widget_resize(widget *widget, short w, short h)
Definition: widget.c:84
_widget::need_redraw
gboolean need_redraw
Definition: widget-internal.h:66
widget_need_redraw
gboolean widget_need_redraw(widget *wid)
Definition: widget.c:445
ROFI_PU_PX
@ ROFI_PU_PX
Definition: rofi-types.h:80
_widget::update
void(* update)(struct _widget *)
Definition: widget-internal.h:76
ROFI_ORIENTATION_HORIZONTAL
@ ROFI_ORIENTATION_HORIZONTAL
Definition: rofi-types.h:108
widget_enabled
gboolean widget_enabled(widget *widget)
Definition: widget.c:116
widget_padding_get_padding_width
int widget_padding_get_padding_width(const widget *wid)
Definition: widget.c:559
widget_padding_get_padding_height
int widget_padding_get_padding_height(const widget *wid)
Definition: widget.c:552
_widget
Definition: widget-internal.h:36
WidgetTriggerActionResult
WidgetTriggerActionResult
Definition: widget.h:78
_widget::type
WidgetType type
Definition: widget-internal.h:38
widget_type
WidgetType widget_type(widget *widget)
Definition: widget.c:108