mirror of
https://github.com/moparisthebest/hexchat
synced 2024-12-23 08:08:54 -05:00
Make modifier buttons truly abstract
This commit is contained in:
parent
ef18ded827
commit
0c04cfed7f
@ -87,10 +87,6 @@ void key_action_tab_clean (void);
|
||||
|
||||
/* Remember that the *number* of actions is this *plus* 1 --AGL */
|
||||
#define KEY_MAX_ACTIONS 14
|
||||
/* These are cp'ed from history.c --AGL */
|
||||
#define STATE_SHIFT GDK_SHIFT_MASK
|
||||
#define STATE_ALT GDK_MOD1_MASK
|
||||
#define STATE_CTRL GDK_CONTROL_MASK
|
||||
|
||||
struct key_binding
|
||||
{
|
||||
@ -325,7 +321,7 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
||||
/* gtktextview has no 'activate' event, so we trap ENTER here */
|
||||
case GDK_Return:
|
||||
case GDK_KP_Enter:
|
||||
if (!(evt->state & GDK_CONTROL_MASK))
|
||||
if (!(evt->state & STATE_CTRL))
|
||||
{
|
||||
g_signal_stop_emission_by_name (G_OBJECT (wid), "key_press_event");
|
||||
mg_inputbox_cb (wid, sess->gui);
|
||||
@ -1738,11 +1734,6 @@ key_action_put_history (GtkWidget * wid, GdkEventKey * ent, char *d1,
|
||||
|
||||
/* -------- */
|
||||
|
||||
|
||||
#define STATE_SHIFT GDK_SHIFT_MASK
|
||||
#define STATE_ALT GDK_MOD1_MASK
|
||||
#define STATE_CTRL GDK_CONTROL_MASK
|
||||
|
||||
static void
|
||||
replace_handle (GtkWidget *t)
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
/* These are cp'ed from history.c --AGL */
|
||||
#define STATE_SHIFT GDK_SHIFT_MASK
|
||||
#define STATE_ALT GDK_MOD1_MASK
|
||||
#define STATE_CTRL GDK_CONTROL_MASK
|
||||
|
||||
void key_init (void);
|
||||
void key_dialog_show (void);
|
||||
int key_handle_key_press (GtkWidget * wid, GdkEventKey * evt, session *sess);
|
||||
|
@ -1652,7 +1652,7 @@ static gboolean
|
||||
mg_tab_contextmenu_cb (chanview *cv, chan *ch, int tag, gpointer ud, GdkEventButton *event)
|
||||
{
|
||||
/* shift-click to close a tab */
|
||||
if ((event->state & GDK_SHIFT_MASK) && event->type == GDK_BUTTON_PRESS)
|
||||
if ((event->state & STATE_SHIFT) && event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
mg_xbutton_cb (cv, ch, tag, ud);
|
||||
return FALSE;
|
||||
|
@ -2097,8 +2097,8 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
|
||||
GtkWidget *menu_bar;
|
||||
GtkWidget *usermenu = 0;
|
||||
GtkWidget *submenu = 0;
|
||||
int close_mask = GDK_CONTROL_MASK;
|
||||
int away_mask = GDK_MOD1_MASK;
|
||||
int close_mask = STATE_CTRL;
|
||||
int away_mask = STATE_ALT;
|
||||
char *key_theme = NULL;
|
||||
GtkSettings *settings;
|
||||
GSList *group = NULL;
|
||||
@ -2162,7 +2162,7 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
|
||||
{
|
||||
if (!g_ascii_strcasecmp (key_theme, "Emacs"))
|
||||
{
|
||||
close_mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK;
|
||||
close_mask = STATE_SHIFT | STATE_CTRL;
|
||||
mymenu[SEARCH_OFFSET].key = 0;
|
||||
}
|
||||
g_free (key_theme);
|
||||
@ -2174,7 +2174,7 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
|
||||
char *help = _("_Help");
|
||||
char *under = strchr (help, '_');
|
||||
if (under && (under[1] == 'a' || under[1] == 'A'))
|
||||
away_mask = GDK_MOD1_MASK | GDK_CONTROL_MASK;
|
||||
away_mask = STATE_ALT | STATE_CTRL;
|
||||
}
|
||||
|
||||
if (!toplevel)
|
||||
@ -2229,8 +2229,8 @@ normalitem:
|
||||
mymenu[i].key == GDK_F1 ? 0 :
|
||||
mymenu[i].key == GDK_w ? close_mask :
|
||||
(g_ascii_isupper (mymenu[i].key)) ?
|
||||
GDK_SHIFT_MASK | GDK_CONTROL_MASK :
|
||||
GDK_CONTROL_MASK,
|
||||
STATE_SHIFT | STATE_CTRL :
|
||||
STATE_CTRL,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
if (mymenu[i].callback)
|
||||
g_signal_connect (G_OBJECT (item), "activate",
|
||||
@ -2252,7 +2252,7 @@ togitem:
|
||||
if (mymenu[i].key != 0)
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
mymenu[i].key, mymenu[i].id == MENU_ID_AWAY ?
|
||||
away_mask : GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
|
||||
away_mask : STATE_CTRL, GTK_ACCEL_VISIBLE);
|
||||
if (mymenu[i].callback)
|
||||
g_signal_connect (G_OBJECT (item), "toggled",
|
||||
G_CALLBACK (mymenu[i].callback), 0);
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "gtkutil.h"
|
||||
#include "menu.h"
|
||||
#include "pixmaps.h"
|
||||
#include "fkeys.h"
|
||||
|
||||
|
||||
/* servlistgui.c globals */
|
||||
@ -366,7 +367,7 @@ servlist_net_keypress_cb (GtkWidget *wid, GdkEventKey *evt, gpointer tree)
|
||||
if (!selected_net)
|
||||
return FALSE;
|
||||
|
||||
if (evt->state & GDK_SHIFT_MASK)
|
||||
if (evt->state & STATE_SHIFT)
|
||||
{
|
||||
if (evt->keyval == GDK_Up)
|
||||
{
|
||||
@ -387,7 +388,7 @@ servlist_serv_keypress_cb (GtkWidget *wid, GdkEventKey *evt, gpointer userdata)
|
||||
if (!selected_net || !selected_serv)
|
||||
return FALSE;
|
||||
|
||||
if (evt->state & GDK_SHIFT_MASK)
|
||||
if (evt->state & STATE_SHIFT)
|
||||
{
|
||||
if (evt->keyval == GDK_Up)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "menu.h"
|
||||
#include "pixmaps.h"
|
||||
#include "userlistgui.h"
|
||||
#include "fkeys.h"
|
||||
|
||||
#ifdef USE_GTKSPELL
|
||||
#include <gtk/gtktextview.h>
|
||||
@ -518,7 +519,7 @@ userlist_click_cb (GtkWidget *widget, GdkEventButton *event, gpointer userdata)
|
||||
if (!event)
|
||||
return FALSE;
|
||||
|
||||
if (!(event->state & GDK_CONTROL_MASK) &&
|
||||
if (!(event->state & STATE_CTRL) &&
|
||||
event->type == GDK_2BUTTON_PRESS && prefs.doubleclickuser[0])
|
||||
{
|
||||
nicks = userlist_selection_list (widget, &i);
|
||||
|
@ -71,6 +71,7 @@
|
||||
#include "../common/xchatc.h"
|
||||
#include "fe-gtk.h"
|
||||
#include "xtext.h"
|
||||
#include "fkeys.h"
|
||||
|
||||
#define charlen(str) g_utf8_skip[*(guchar *)(str)]
|
||||
|
||||
@ -2005,7 +2006,7 @@ gtk_xtext_check_mark_stamp (GtkXText *xtext, GdkModifierType mask)
|
||||
{
|
||||
gboolean redraw = FALSE;
|
||||
|
||||
if (mask & GDK_SHIFT_MASK || prefs.autocopy_stamp)
|
||||
if (mask & STATE_SHIFT || prefs.autocopy_stamp)
|
||||
{
|
||||
if (!xtext->mark_stamp)
|
||||
{
|
||||
@ -2255,7 +2256,7 @@ gtk_xtext_button_release (GtkWidget * widget, GdkEventButton * event)
|
||||
if (xtext->buffer->last_ent_start)
|
||||
{
|
||||
xtext->color_paste = FALSE;
|
||||
if (event->state & GDK_CONTROL_MASK || prefs.autocopy_color)
|
||||
if (event->state & STATE_CTRL || prefs.autocopy_color)
|
||||
xtext->color_paste = TRUE;
|
||||
if (prefs.autocopy_text)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user