mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-30 00:04:49 -05:00
Patch from John Sullivan: process double-clicks in the session list
box on button-up rather than button-down. The effect of this is that if a saved session is already selected in the list box and then you double-click it, it will open rather than beeping annoyingly. [originally from svn r7414]
This commit is contained in:
parent
d1df3e226a
commit
7e4eb1f404
@ -57,6 +57,7 @@ struct uctrl {
|
|||||||
GtkWidget *label; /* for dlg_label_change */
|
GtkWidget *label; /* for dlg_label_change */
|
||||||
GtkAdjustment *adj; /* for the scrollbar in a list box */
|
GtkAdjustment *adj; /* for the scrollbar in a list box */
|
||||||
guint textsig;
|
guint textsig;
|
||||||
|
int nclicks;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dlgparam {
|
struct dlgparam {
|
||||||
@ -95,8 +96,10 @@ static int listitem_single_key(GtkWidget *item, GdkEventKey *event,
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
static int listitem_multi_key(GtkWidget *item, GdkEventKey *event,
|
static int listitem_multi_key(GtkWidget *item, GdkEventKey *event,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static int listitem_button(GtkWidget *item, GdkEventButton *event,
|
static int listitem_button_press(GtkWidget *item, GdkEventButton *event,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
static int listitem_button_release(GtkWidget *item, GdkEventButton *event,
|
||||||
|
gpointer data);
|
||||||
static void menuitem_activate(GtkMenuItem *item, gpointer data);
|
static void menuitem_activate(GtkMenuItem *item, gpointer data);
|
||||||
static void coloursel_ok(GtkButton *button, gpointer data);
|
static void coloursel_ok(GtkButton *button, gpointer data);
|
||||||
static void coloursel_cancel(GtkButton *button, gpointer data);
|
static void coloursel_cancel(GtkButton *button, gpointer data);
|
||||||
@ -439,7 +442,9 @@ void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
|||||||
gtk_signal_connect(GTK_OBJECT(listitem), "focus_in_event",
|
gtk_signal_connect(GTK_OBJECT(listitem), "focus_in_event",
|
||||||
GTK_SIGNAL_FUNC(widget_focus), dp);
|
GTK_SIGNAL_FUNC(widget_focus), dp);
|
||||||
gtk_signal_connect(GTK_OBJECT(listitem), "button_press_event",
|
gtk_signal_connect(GTK_OBJECT(listitem), "button_press_event",
|
||||||
GTK_SIGNAL_FUNC(listitem_button), dp);
|
GTK_SIGNAL_FUNC(listitem_button_press), dp);
|
||||||
|
gtk_signal_connect(GTK_OBJECT(listitem), "button_release_event",
|
||||||
|
GTK_SIGNAL_FUNC(listitem_button_release), dp);
|
||||||
gtk_object_set_data(GTK_OBJECT(listitem), "user-data",
|
gtk_object_set_data(GTK_OBJECT(listitem), "user-data",
|
||||||
GINT_TO_POINTER(id));
|
GINT_TO_POINTER(id));
|
||||||
} else {
|
} else {
|
||||||
@ -1083,13 +1088,26 @@ static int listitem_multi_key(GtkWidget *item, GdkEventKey *event,
|
|||||||
return listitem_key(item, event, data, TRUE);
|
return listitem_key(item, event, data, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int listitem_button(GtkWidget *item, GdkEventButton *event,
|
static int listitem_button_press(GtkWidget *item, GdkEventButton *event,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
if (event->type == GDK_2BUTTON_PRESS ||
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
|
||||||
event->type == GDK_3BUTTON_PRESS) {
|
switch (event->type) {
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
|
default:
|
||||||
|
case GDK_BUTTON_PRESS: uc->nclicks = 1; break;
|
||||||
|
case GDK_2BUTTON_PRESS: uc->nclicks = 2; break;
|
||||||
|
case GDK_3BUTTON_PRESS: uc->nclicks = 3; break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int listitem_button_release(GtkWidget *item, GdkEventButton *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
|
||||||
|
if (uc->nclicks>1) {
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1367,6 +1385,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
|
|||||||
uc->entry = uc->list = uc->menu = NULL;
|
uc->entry = uc->list = uc->menu = NULL;
|
||||||
uc->button = uc->optmenu = uc->text = NULL;
|
uc->button = uc->optmenu = uc->text = NULL;
|
||||||
uc->label = NULL;
|
uc->label = NULL;
|
||||||
|
uc->nclicks = 0;
|
||||||
|
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->generic.type) {
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user