Tk Source Code

Check-in [ec81d802]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clean up, remove commented-out code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mac-keyrelease-test
Files: files | file ages | folders
SHA3-256:ec81d802e18ee3dc2b9e088b739b59ef727fe234c69fa0f272d425c76a1af16e
User & Date: kevin_walzer 2018-08-13 02:20:03
Context
2018-08-14
01:46
Merge mac-keyrelease-branch to fix 1ba71a86bb check-in: 7e113279 user: kevin_walzer tags: trunk
01:46
Merge mac-keyrelease-branch to fix 1ba71a86bb check-in: 2431d3bd user: kevin_walzer tags: core-8-6-branch
2018-08-13
02:20
Clean up, remove commented-out code Closed-Leaf check-in: ec81d802 user: kevin_walzer tags: mac-keyrelease-test
02:06
Test fix for 1ba71a86bb, so key release events fire at the correct point check-in: 466c3287 user: kevin_walzer tags: mac-keyrelease-test
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXKeyEvent.c.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287

static int caret_x = 0, caret_y = 0, caret_height = 0;

static void setupXEvent(XEvent *xEvent, NSWindow *w, unsigned int state);
static unsigned isFunctionKey(unsigned int code);

unsigned short releaseCode;
NSString *releaseChar;


#pragma mark TKApplication(TKKeyEvent)

@implementation TKApplication(TKKeyEvent)

- (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent
................................................................................
        nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1];
        processingCompose = NO;
      }

    switch (type) {
    case NSKeyUp:
	
	//fix for 1ba71a86bb: key release firing on key press
	w = [theEvent window];       
	XEvent xEvent;
	setupXEvent(&xEvent, w, 0);
	TkWindow *winPtr = TkMacOSXGetTkWindow(w);
	Tk_Window tkwin = (Tk_Window) winPtr;
	xEvent.xany.type = KeyRelease;
	xEvent.xkey.keycode = releaseCode;
................................................................................
    [self deleteWorkingText];

  /* now insert the string as keystrokes */
  setupXEvent(&xEvent, [self window], 0);
  xEvent.xany.type = KeyPress;

  for (i =0; i<len; i++)
    {
      xEvent.xkey.keycode = (UInt16) [aString characterAtIndex: i];
      [[aString substringWithRange: NSMakeRange(i,1)]
        getCString: xEvent.xkey.trans_chars
         maxLength: XMaxTransChars encoding: NSUTF8StringEncoding];
      xEvent.xkey.nbytes = strlen(xEvent.xkey.trans_chars);
      xEvent.xany.type = KeyPress;
        releaseCode =  (UInt16) [aString characterAtIndex: 0];
      Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);

      // xEvent.xany.type = KeyRelease;
      // xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
      // Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
      // xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
    }
    releaseCode =  (UInt16) [aString characterAtIndex: 0];
}


/* <NSTextInput>: inserts display of composing characters */
- (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange
{
  NSString *str = [aString respondsToSelector: @selector (string)] ?







<







 







|







 







|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
|







38
39
40
41
42
43
44

45
46
47
48
49
50
51
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273





274
275
276
277
278
279
280
281

static int caret_x = 0, caret_y = 0, caret_height = 0;

static void setupXEvent(XEvent *xEvent, NSWindow *w, unsigned int state);
static unsigned isFunctionKey(unsigned int code);

unsigned short releaseCode;



#pragma mark TKApplication(TKKeyEvent)

@implementation TKApplication(TKKeyEvent)

- (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent
................................................................................
        nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1];
        processingCompose = NO;
      }

    switch (type) {
    case NSKeyUp:
	
	/*Fix for bug #1ba71a86bb: key release firing on key press.*/
	w = [theEvent window];       
	XEvent xEvent;
	setupXEvent(&xEvent, w, 0);
	TkWindow *winPtr = TkMacOSXGetTkWindow(w);
	Tk_Window tkwin = (Tk_Window) winPtr;
	xEvent.xany.type = KeyRelease;
	xEvent.xkey.keycode = releaseCode;
................................................................................
    [self deleteWorkingText];

  /* now insert the string as keystrokes */
  setupXEvent(&xEvent, [self window], 0);
  xEvent.xany.type = KeyPress;

  for (i =0; i<len; i++)
      {
	  xEvent.xkey.keycode = (UInt16) [aString characterAtIndex: i];
	  [[aString substringWithRange: NSMakeRange(i,1)]
	      getCString: xEvent.xkey.trans_chars
	       maxLength: XMaxTransChars encoding: NSUTF8StringEncoding];
	  xEvent.xkey.nbytes = strlen(xEvent.xkey.trans_chars);
	  xEvent.xany.type = KeyPress;
	  releaseCode =  (UInt16) [aString characterAtIndex: 0];
	  Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
      }





  releaseCode =  (UInt16) [aString characterAtIndex: 0];
}


/* <NSTextInput>: inserts display of composing characters */
- (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange
{
  NSString *str = [aString respondsToSelector: @selector (string)] ?