mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtappbuilder: ensure the subtypes of widgets are properly initialized.
This commit is contained in:
parent
49b92e63a7
commit
1fcba2048b
1 changed files with 25 additions and 5 deletions
|
@ -76,6 +76,11 @@
|
|||
#include "dtbuilder.h"
|
||||
#include "palette_ui.h"
|
||||
|
||||
#define MAX_SUBTYPES 30
|
||||
|
||||
static int subtypes[MAX_SUBTYPES];
|
||||
static int subtype_item_cnt = 0;
|
||||
|
||||
const int AB_max_item_height = 64;
|
||||
const int AB_max_item_width = 256;
|
||||
|
||||
|
@ -181,15 +186,30 @@ pal_enable_item_drag(
|
|||
int subtype
|
||||
)
|
||||
{
|
||||
static int st_subtype;
|
||||
int i;
|
||||
XtPointer psubtype;
|
||||
|
||||
for (i = 0; i < MAX_SUBTYPES; ++i) if (subtypes[i] == subtype) break;
|
||||
|
||||
if (i == MAX_SUBTYPES) i = subtype_item_cnt++;
|
||||
|
||||
if (i >= MAX_SUBTYPES) {
|
||||
if (util_get_verbosity() > 0)
|
||||
fprintf(stderr, "pal_enable_item_drag: subtype table full\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
subtypes[i] = subtype;
|
||||
|
||||
psubtype = &subtypes[i];
|
||||
|
||||
st_subtype = subtype;
|
||||
XtInsertEventHandler(widget, ButtonPressMask, FALSE,
|
||||
palitem_select_event, (XtPointer)&st_subtype, XtListHead);
|
||||
palitem_select_event, psubtype, XtListHead);
|
||||
XtInsertEventHandler(widget, ButtonReleaseMask, FALSE,
|
||||
palitem_release_event, (XtPointer)&st_subtype, XtListHead);
|
||||
palitem_release_event, psubtype, XtListHead);
|
||||
XtAddEventHandler(widget, EnterWindowMask|LeaveWindowMask, FALSE,
|
||||
palitem_update_type, (XtPointer)&st_subtype);
|
||||
palitem_update_type, psubtype);
|
||||
|
||||
/* We need to keep track of the main palette widget
|
||||
* for drag-behavior purposes
|
||||
|
|
Loading…
Reference in a new issue