1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
|
}
#endif
gboolean button_internal(struct gui_data *inst, guint32 timestamp,
GdkEventType type, guint ebutton, guint state,
gdouble ex, gdouble ey)
{
int shift, ctrl, alt, x, y, button, act;
/* Remember the timestamp. */
inst->input_event_time = timestamp;
show_mouseptr(inst, 1);
if (ebutton == 4 && type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, -5);
return TRUE;
}
if (ebutton == 5 && type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, +5);
return TRUE;
}
shift = state & GDK_SHIFT_MASK;
ctrl = state & GDK_CONTROL_MASK;
alt = state & GDK_MOD1_MASK;
if (ebutton == 3 && ctrl) {
gtk_menu_popup(GTK_MENU(inst->menu), NULL, NULL, NULL, NULL,
ebutton, timestamp);
return TRUE;
}
if (ebutton == 1)
button = MBT_LEFT;
else if (ebutton == 2)
button = MBT_MIDDLE;
else if (ebutton == 3)
button = MBT_RIGHT;
else
return FALSE; /* don't even know what button! */
switch (type) {
case GDK_BUTTON_PRESS: act = MA_CLICK; break;
case GDK_BUTTON_RELEASE: act = MA_RELEASE; break;
case GDK_2BUTTON_PRESS: act = MA_2CLK; break;
case GDK_3BUTTON_PRESS: act = MA_3CLK; break;
default: return FALSE; /* don't know this event type */
}
if (send_raw_mouse && !(shift && conf_get_int(inst->conf,
CONF_mouse_override)) &&
act != MA_CLICK && act != MA_RELEASE)
return TRUE; /* we ignore these in raw mouse mode */
x = (ex - inst->window_border) / inst->font_width;
y = (ey - inst->window_border) / inst->font_height;
term_mouse(inst->term, button, translate_button(button), act,
x, y, shift, ctrl, alt);
|
|
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
<
<
<
>
>
>
>
<
<
|
|
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
|
}
#endif
gboolean button_internal(struct gui_data *inst, guint32 timestamp,
GdkEventType type, guint ebutton, guint state,
gdouble ex, gdouble ey)
{
int shift, ctrl, alt, x, y, button, act, raw_mouse_mode;
/* Remember the timestamp. */
inst->input_event_time = timestamp;
show_mouseptr(inst, 1);
shift = state & GDK_SHIFT_MASK;
ctrl = state & GDK_CONTROL_MASK;
alt = state & GDK_MOD1_MASK;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_int(inst->conf,
CONF_mouse_override));
if (!raw_mouse_mode) {
if (ebutton == 4 && type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, -5);
return TRUE;
}
if (ebutton == 5 && type == GDK_BUTTON_PRESS) {
term_scroll(inst->term, 0, +5);
return TRUE;
}
}
if (ebutton == 3 && ctrl) {
gtk_menu_popup(GTK_MENU(inst->menu), NULL, NULL, NULL, NULL,
ebutton, timestamp);
return TRUE;
}
if (ebutton == 1)
button = MBT_LEFT;
else if (ebutton == 2)
button = MBT_MIDDLE;
else if (ebutton == 3)
button = MBT_RIGHT;
else if (ebutton == 4)
button = MBT_WHEEL_UP;
else if (ebutton == 5)
button = MBT_WHEEL_DOWN;
else
return FALSE; /* don't even know what button! */
switch (type) {
case GDK_BUTTON_PRESS: act = MA_CLICK; break;
case GDK_BUTTON_RELEASE: act = MA_RELEASE; break;
case GDK_2BUTTON_PRESS: act = MA_2CLK; break;
case GDK_3BUTTON_PRESS: act = MA_3CLK; break;
default: return FALSE; /* don't know this event type */
}
if (raw_mouse_mode && act != MA_CLICK && act != MA_RELEASE)
return TRUE; /* we ignore these in raw mouse mode */
x = (ex - inst->window_border) / inst->font_width;
y = (ey - inst->window_border) / inst->font_height;
term_mouse(inst->term, button, translate_button(button), act,
x, y, shift, ctrl, alt);
|