gui_current_drag_type now only used for data transfer protocol routing; fix button bar drag handler.
Remove all references to gui_current_drag_type outside of gui.c which are not related to routing DataSaveAck messages. Update button bar drag code so that it uses ro_mouse.
This commit is contained in:
parent
ee8fb6f39f
commit
f3f2c5b481
|
@ -831,7 +831,6 @@ bool ro_gui_download_click(wimp_pointer *pointer)
|
|||
y = (istate.icon.extent.y1 + istate.icon.extent.y0)/2 +
|
||||
wstate.visible.y1 - wstate.yscroll;
|
||||
}
|
||||
gui_current_drag_type = GUI_DRAG_DOWNLOAD_SAVE;
|
||||
ro_mouse_drag_start(ro_gui_download_drag_end, NULL, NULL, NULL);
|
||||
download_window_current = dw;
|
||||
ro_gui_drag_icon(x, y, sprite);
|
||||
|
@ -954,6 +953,8 @@ static void ro_gui_download_drag_end(wimp_dragged *drag, void *data)
|
|||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
}
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_DOWNLOAD_SAVE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1784,6 +1784,8 @@ void ro_msg_datasave_ack(wimp_message *message)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,10 +65,8 @@ extern bool dialog_folder_add, dialog_entry_add, hotlist_insert;
|
|||
extern bool print_active, print_text_black;
|
||||
extern bool no_font_blending;
|
||||
|
||||
typedef enum { GUI_DRAG_NONE, GUI_DRAG_SELECTION, GUI_DRAG_DOWNLOAD_SAVE,
|
||||
GUI_DRAG_SAVE, GUI_DRAG_SCROLL, GUI_DRAG_STATUS_RESIZE,
|
||||
GUI_DRAG_TREEVIEW, GUI_DRAG_BUTTONBAR,
|
||||
GUI_DRAG_FRAME } ro_gui_drag_type;
|
||||
typedef enum { GUI_DRAG_NONE, GUI_DRAG_DOWNLOAD_SAVE, GUI_DRAG_SAVE }
|
||||
ro_gui_drag_type;
|
||||
|
||||
extern ro_gui_drag_type gui_current_drag_type;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "oslib/wimpspriteop.h"
|
||||
#include "riscos/gui/button_bar.h"
|
||||
#include "riscos/gui.h"
|
||||
#include "riscos/mouse.h"
|
||||
#include "riscos/theme.h"
|
||||
#include "riscos/wimp.h"
|
||||
#include "utils/log.h"
|
||||
|
@ -110,6 +111,7 @@ static bool drag_separator = false;
|
|||
static bool ro_gui_button_bar_place_buttons(struct button_bar *button_bar);
|
||||
static bool ro_gui_button_bar_icon_update(struct button_bar *button_bar);
|
||||
static bool ro_gui_button_bar_icon_resize(struct button_bar *button_bar);
|
||||
static void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data);
|
||||
static void ro_gui_button_bar_sync_editors(struct button_bar *target,
|
||||
struct button_bar *source);
|
||||
static struct button_bar_button *ro_gui_button_bar_find_icon(
|
||||
|
@ -749,7 +751,6 @@ bool ro_gui_button_bar_click(struct button_bar *button_bar,
|
|||
|
||||
if (button != NULL && (!button->shaded || drag_separator ||
|
||||
button_bar->edit_source != NULL)) {
|
||||
gui_current_drag_type = GUI_DRAG_BUTTONBAR;
|
||||
|
||||
drag_start = button_bar;
|
||||
drag_opt = button->opt_key;
|
||||
|
@ -779,6 +780,10 @@ bool ro_gui_button_bar_click(struct button_bar *button_bar,
|
|||
LOG(("xdragasprite_start: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
|
||||
ro_mouse_drag_start(ro_gui_button_bar_drag_end,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -847,9 +852,14 @@ bool ro_gui_button_bar_help_suffix(struct button_bar *button_bar, wimp_i i,
|
|||
}
|
||||
|
||||
|
||||
/* This is an exported interface documented in button_bar.h */
|
||||
/**
|
||||
* Terminate a drag event that was initiated by a button bar.
|
||||
*
|
||||
* \param *drag The drag event data.
|
||||
* \param *data NULL data to satisfy callback syntax.
|
||||
*/
|
||||
|
||||
void ro_gui_button_bar_drag_end(wimp_dragged *drag)
|
||||
void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data)
|
||||
{
|
||||
struct button_bar *drag_end = NULL;
|
||||
struct button_bar *source = NULL, *target = NULL;
|
||||
|
@ -861,7 +871,6 @@ void ro_gui_button_bar_drag_end(wimp_dragged *drag)
|
|||
os_error *error;
|
||||
|
||||
xdragasprite_stop();
|
||||
gui_current_drag_type = GUI_DRAG_NONE;
|
||||
|
||||
if (drag_start == NULL)
|
||||
return;
|
||||
|
|
|
@ -290,15 +290,6 @@ bool ro_gui_button_bar_help_suffix(struct button_bar *button_bar, wimp_i i,
|
|||
wimp_mouse_state buttons, const char **suffix);
|
||||
|
||||
|
||||
/**
|
||||
* Terminate a drag event that was initiated by a button bar.
|
||||
*
|
||||
* \param *drag The drag event data.
|
||||
*/
|
||||
|
||||
void ro_gui_button_bar_drag_end(wimp_dragged *drag);
|
||||
|
||||
|
||||
/**
|
||||
* Return a config string reflecting the configured order of buttons
|
||||
* and spacers. The string is allocated with malloc(), and should be
|
||||
|
|
|
@ -526,7 +526,6 @@ bool ro_gui_status_bar_click(wimp_pointer *pointer)
|
|||
|
||||
switch (pointer->i) {
|
||||
case ICON_WIDGET:
|
||||
gui_current_drag_type = GUI_DRAG_STATUS_RESIZE;
|
||||
drag.w = pointer->w;
|
||||
drag.type = wimp_DRAG_SYSTEM_SIZE;
|
||||
drag.initial.x0 = pointer->pos.x;
|
||||
|
|
|
@ -306,7 +306,6 @@ void ro_gui_save_start_drag(wimp_pointer *pointer)
|
|||
y = (istate.icon.extent.y1 + istate.icon.extent.y0)/2 +
|
||||
wstate.visible.y1 - wstate.yscroll;
|
||||
}
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
||||
gui_save_sourcew = pointer->w;
|
||||
saving_from_dialog = true;
|
||||
|
@ -384,7 +383,6 @@ void gui_drag_save_object(gui_save_type save_type, hlcache_handle *c,
|
|||
save_leafname, LEAFNAME_MAX,
|
||||
icon_buf, sizeof(icon_buf));
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
||||
|
||||
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
||||
|
@ -433,7 +431,6 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection)
|
|||
save_leafname, LEAFNAME_MAX,
|
||||
icon_buf, sizeof(icon_buf));
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
||||
|
||||
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
||||
|
@ -478,7 +475,6 @@ void ro_gui_drag_save_link(gui_save_type save_type, const char *url,
|
|||
ro_gui_save_set_state(NULL, save_type, url, save_leafname, LEAFNAME_MAX,
|
||||
icon_buf, sizeof(icon_buf));
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
ro_mouse_drag_start(ro_gui_save_drag_end, NULL, NULL, NULL);
|
||||
|
||||
ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
|
||||
|
@ -646,11 +642,8 @@ static void ro_gui_save_drag_end(wimp_dragged *drag, void *data)
|
|||
dest_ok = browser_window_drop_file_at_point(g->bw,
|
||||
pos.x, pos.y, NULL);
|
||||
}
|
||||
if (!dest_ok) {
|
||||
/* cancel the drag operation */
|
||||
gui_current_drag_type = GUI_DRAG_NONE;
|
||||
if (!dest_ok)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!saving_from_dialog) {
|
||||
|
@ -700,6 +693,8 @@ static void ro_gui_save_drag_end(wimp_dragged *drag, void *data)
|
|||
ro_message_send_message_to_window(wimp_USER_MESSAGE_RECORDED, &message,
|
||||
pointer.w, pointer.i, ro_gui_save_bounced, NULL);
|
||||
|
||||
gui_current_drag_type = GUI_DRAG_SAVE;
|
||||
|
||||
free(local_name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue