- if (gi->textarea.cursor_position != old_cursor_position)
- DrawGadget(gi, DG_PRESSED, gi->direct_draw);
- }
- else
- {
- /* if mouse button pressed outside text input gadget, deactivate it */
- DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
-
- gi->event.type = GD_EVENT_TEXT_LEAVING;
-
- if (gi->event_mask & GD_EVENT_TEXT_LEAVING)
- gi->callback_action(gi);
-
- last_gi = NULL;
- }
- }
-
- /* special treatment for selectbox gadgets */
- if (anySelectboxGadgetActive() && button != 0 && !motion_status)
- {
- struct GadgetInfo *gi = last_gi;
-
- if (new_gi == last_gi)
- {
- int old_index = gi->selectbox.current_index;
-
- /* if mouse button pressed inside activated selectbox, select value */
- if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
- gi->selectbox.current_index =
- (my - gi->selectbox.y - gi->border.ysize) / getFontHeight(gi->font);
-
- if (gi->selectbox.current_index < 0)
- gi->selectbox.current_index = 0;
- else if (gi->selectbox.current_index > gi->selectbox.num_values - 1)
- gi->selectbox.current_index = gi->selectbox.num_values - 1;
-
- if (gi->selectbox.current_index != old_index)
- DrawGadget(gi, DG_PRESSED, gi->direct_draw);
- }
- else
- {
- /* if mouse button pressed outside selectbox gadget, deactivate it */
- DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
-
- gi->event.type = GD_EVENT_TEXT_LEAVING;
-
- if (gi->event_mask & GD_EVENT_TEXT_LEAVING)
- gi->callback_action(gi);