case GDI_INFO_TEXT:
{
- int max_textsize = MAX_INFO_TEXTSIZE;
+ int max_textsize = MAX_INFO_TEXTSIZE - 1;
strncpy(gi->info_text, va_arg(ap, char *), max_textsize);
gi->info_text[max_textsize] = '\0';
MultiMapGadgets(MULTIMAP_ALL | MULTIMAP_REMAP);
}
-void ClickOnGadget(struct GadgetInfo *gi)
+boolean anyTextGadgetActive()
+{
+ return (last_gi && last_gi->type & GD_TYPE_TEXTINPUT && last_gi->mapped);
+}
+
+void ClickOnGadget(struct GadgetInfo *gi, int button)
{
/* simulate releasing mouse button over last gadget, if still pressed */
if (button_status)
HandleGadgets(-1, -1, 0);
/* simulate pressing mouse button over specified gadget */
- HandleGadgets(gi->x, gi->y, 1);
+ HandleGadgets(gi->x, gi->y, button);
/* simulate releasing mouse button over specified gadget */
HandleGadgets(gi->x, gi->y, 0);
static unsigned long pressed_delay = 0;
static int last_button = 0;
static int last_mx = 0, last_my = 0;
- int scrollbar_mouse_pos;
+ int scrollbar_mouse_pos = 0;
struct GadgetInfo *new_gi, *gi;
boolean press_event;
boolean release_event;
last_my = my;
/* special treatment for text and number input gadgets */
- if (last_gi && last_gi->type & GD_TYPE_TEXTINPUT && last_gi->mapped &&
- button != 0 && !motion_status)
+ if (anyTextGadgetActive() && button != 0 && !motion_status)
{
struct GadgetInfo *gi = last_gi;