mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Implement uniq widget ID for each widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
b9cf650605
commit
5ce511e07e
@ -174,7 +174,6 @@ group_add_widget_autopos (WGroup * g, void *w, widget_pos_flags_t pos_flags, con
|
||||
|
||||
ww->owner = g;
|
||||
ww->pos_flags = pos_flags;
|
||||
ww->id = g->widget_id++;
|
||||
|
||||
if (g->widgets == NULL || before == NULL)
|
||||
{
|
||||
|
@ -30,7 +30,6 @@ struct WGroup
|
||||
GList *widgets; /* widgets list */
|
||||
GList *current; /* Currently active widget */
|
||||
|
||||
unsigned long widget_id; /* maximum id of all widgets */
|
||||
gboolean winch_pending; /* SIGWINCH signal has been got. Resize group after rise */
|
||||
};
|
||||
|
||||
|
@ -53,10 +53,32 @@
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/* maximum value of used widget ID */
|
||||
static unsigned long widget_id = 0;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Calc widget ID,
|
||||
* Widget ID is uniq for each widget created during MC session (like PID in OS).
|
||||
*
|
||||
* @return widget ID.
|
||||
*/
|
||||
static unsigned long
|
||||
widget_set_id (void)
|
||||
{
|
||||
unsigned long id;
|
||||
|
||||
id = widget_id++;
|
||||
/* TODO IF NEEDED: if id is already used, find next free id. */
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
widget_do_focus (Widget * w, gboolean enable)
|
||||
{
|
||||
@ -252,6 +274,7 @@ void
|
||||
widget_init (Widget * w, int y, int x, int lines, int cols,
|
||||
widget_cb_fn callback, widget_mouse_cb_fn mouse_callback)
|
||||
{
|
||||
w->id = widget_set_id ();
|
||||
w->x = x;
|
||||
w->y = y;
|
||||
w->cols = cols;
|
||||
|
@ -131,7 +131,7 @@ struct Widget
|
||||
widget_pos_flags_t pos_flags; /* repositioning flags */
|
||||
widget_options_t options;
|
||||
widget_state_t state;
|
||||
unsigned int id; /* Number of the widget, starting with 0 */
|
||||
unsigned long id; /* uniq widget ID */
|
||||
widget_cb_fn callback;
|
||||
widget_mouse_cb_fn mouse_callback;
|
||||
WGroup *owner;
|
||||
|
Loading…
Reference in New Issue
Block a user