filename | src/cocoaui/cocoa_ctrl.c |
changeset | 849:bbe26d798fc2 |
prev | 787:6717c02ff81f |
author | nkeynes |
date | Wed Oct 29 23:51:58 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Use regparam calling conventions for all functions called from translated code, along with a few other high-use functions. Can probably extend this to all functions, but as it is this is a nice performance boost |
file | annotate | diff | log | raw |
1.1 --- a/src/cocoaui/cocoa_ctrl.c Tue Jul 29 10:55:51 2008 +00001.2 +++ b/src/cocoaui/cocoa_ctrl.c Wed Oct 29 23:51:58 2008 +00001.3 @@ -25,6 +25,8 @@1.5 #define MAX_DEVICES 41.7 +#define KEYBINDING_SIZE 1101.8 +1.9 static void cocoa_config_keysym_hook(void *data, const gchar *keysym);1.11 @interface KeyBindingEditor (Private)1.12 @@ -88,6 +90,14 @@1.13 [self fireBindingChanged];1.14 }1.15 }1.16 +- (void)updateMousesym: (int)button1.17 +{1.18 + gchar *keysym = input_keycode_to_keysym( &system_mouse_driver, (button+1) );1.19 + if( keysym != NULL ) {1.20 + [self updateKeysym: keysym ];1.21 + g_free(keysym);1.22 + }1.23 +}1.24 - (void)keyPressed: (int)keycode1.25 {1.26 gchar *keysym = input_keycode_to_keysym(NULL, keycode);1.27 @@ -102,8 +112,24 @@1.28 }1.29 - (void)mouseDown: (NSEvent *)event1.30 {1.31 - [self setPrimed: YES];1.32 - [super mouseDown: event];1.33 + if( isPrimed ) {1.34 + [self updateMousesym: 0];1.35 + } else {1.36 + [self setPrimed: YES];1.37 + [super mouseDown: event];1.38 + }1.39 +}1.40 +- (void)rightMouseDown: (NSEvent *)event1.41 +{1.42 + if( isPrimed ) {1.43 + [self updateMousesym: 1];1.44 + }1.45 +}1.46 +- (void)otherMouseDown: (NSEvent *)event1.47 +{1.48 + if( isPrimed ) {1.49 + [self updateMousesym: [event buttonNumber]];1.50 + }1.51 }1.52 - (void)keyDown: (NSEvent *) event1.53 {1.54 @@ -218,7 +244,7 @@1.56 for( count=0; config[count].key != NULL; count++ );1.57 x = TEXT_GAP;1.58 - NSSize size = NSMakeSize(85*3+TEXT_GAP*4, count*(TEXT_HEIGHT+TEXT_GAP)+TEXT_GAP);1.59 + NSSize size = NSMakeSize(85+KEYBINDING_SIZE*2+TEXT_GAP*4, count*(TEXT_HEIGHT+TEXT_GAP)+TEXT_GAP);1.60 [self setFrameSize: size];1.61 [self scrollRectToVisible: NSMakeRect(0,0,1,1)];1.62 y = TEXT_GAP;1.63 @@ -227,14 +253,14 @@1.64 NSTextField *label = cocoa_gui_add_label(self, NS_(config[i].label), frame);1.65 [label setAlignment: NSRightTextAlignment];1.67 - frame = NSMakeRect( x + 85 + TEXT_GAP, y, 85, TEXT_HEIGHT);1.68 + frame = NSMakeRect( x + 85 + TEXT_GAP, y, KEYBINDING_SIZE, TEXT_HEIGHT);1.69 field[i][0] = [[KeyBindingField alloc] initWithFrame: frame];1.70 [field[i][0] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];1.71 [field[i][0] setTag: i];1.72 [field[i][0] setDelegate: self];1.73 [self addSubview: field[i][0]];1.75 - frame = NSMakeRect( x + (85*2) + (TEXT_GAP*2), y, 85, TEXT_HEIGHT);1.76 + frame = NSMakeRect( x + 85 + KEYBINDING_SIZE + (TEXT_GAP*2), y, KEYBINDING_SIZE, TEXT_HEIGHT);1.77 field[i][1] = [[KeyBindingField alloc] initWithFrame: frame];1.78 [field[i][1] setAutoresizingMask: (NSViewMinYMargin|NSViewMaxXMargin)];1.79 [field[i][1] setTag: i];
.