Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | add selected tk upstream changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c5163a1eea8542c52af7b05b0341fc2e |
User & Date: | chw 2021-10-14 16:11:02 |
Context
2021-10-14
| ||
16:11 | tweak tkpath demos for newer macosx check-in: 80bce6f049 user: chw tags: trunk | |
16:11 | add selected tk upstream changes check-in: c5163a1eea user: chw tags: trunk | |
06:02 | add tcl-opencv upstream changes check-in: 4fbb085cbe user: chw tags: trunk | |
Changes
Changes to jni/sdl2tk/macosx/tkMacOSXMouseEvent.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | typedef struct { unsigned int state; long delta; Window window; Point global; Point local; } MouseEventData; static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ static int GenerateButtonEvent(MouseEventData *medPtr); static unsigned int ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers); #pragma mark TKApplication(TKMouseEvent) enum { NSWindowWillMoveEventType = 20 }; /* * In OS X 10.6 an NSEvent of type NSMouseMoved would always have a non-Nil * window attribute pointing to the active window. As of 10.8 this behavior * had changed. The new behavior was that if the mouse were ever moved outside * of a window, all subsequent NSMouseMoved NSEvents would have a Nil window | > | < | > > > | | > | > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > | > > > > > > > < > > | | > > > > > | < | | | > | < > | | < | > | > > | | > | | < > | < < < < < | | | < < < | < < | < | | | > > | | < > > | > | > > > > > | | > | < | | | | < < < | | | | | < < < < | < | < | > | | | > < | > > > < < < < < < | < | < | < < < < < < < < | < < | < | | | | > < | | > > > > | > > > > > > > > > > > > > > > > > > > | < < < < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 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 282 283 284 285 286 287 288 289 290 291 292 | typedef struct { unsigned int state; long delta; Window window; Point global; Point local; } MouseEventData; static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ static int GenerateButtonEvent(MouseEventData *medPtr); static unsigned int ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers); #pragma mark TKApplication(TKMouseEvent) enum { NSWindowWillMoveEventType = 20 }; /* * In OS X 10.6 an NSEvent of type NSMouseMoved would always have a non-Nil * window attribute pointing to the active window. As of 10.8 this behavior * had changed. The new behavior was that if the mouse were ever moved outside * of a window, all subsequent NSMouseMoved NSEvents would have a Nil window * attribute until the mouse returned to the window. In 11.1 it changed again. * The window attribute can be non-nil, but referencing a window which does not * belong to the application. */ @implementation TKApplication(TKMouseEvent) - (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent { NSWindow *eventWindow = [theEvent window]; NSEventType eventType = [theEvent type]; NSRect viewFrame = [[eventWindow contentView] frame]; NSPoint location = [theEvent locationInWindow]; TkWindow *winPtr = NULL, *grabWinPtr; Tk_Window tkwin = None, capture, target; NSPoint local, global; NSInteger button; Bool inTitleBar = NO; int win_x, win_y; unsigned int buttonState = 0; static int validPresses = 0, ignoredPresses = 0; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif /* * If this event is not for a Tk toplevel, it should just be passed up the * responder chain. However, there is an exception for synthesized events, * which are used in testing. Those events are recognized by having their * both the windowNumber and the eventNumber set to -1. */ if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) { if ([theEvent windowNumber] != -1 || [theEvent eventNumber] != -1) return theEvent; } /* * Check if the event is located in the titlebar. */ if (eventWindow) { inTitleBar = viewFrame.size.height < location.y; } button = [theEvent buttonNumber] + Button1; switch (eventType) { case NSRightMouseUp: case NSOtherMouseUp: buttonState &= ~TkGetButtonMask(button); break; case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: case NSRightMouseDown: case NSOtherMouseDown: buttonState |= TkGetButtonMask(button); break; #if 0 case NSMouseEntered: if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] && !inTitleBar) { [(TKWindow *)eventWindow setMouseInResizeArea:YES]; } break; case NSMouseExited: if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) { [(TKWindow *)eventWindow setMouseInResizeArea:NO]; break; } #else case NSMouseEntered: case NSMouseExited: break; #endif case NSLeftMouseUp: case NSLeftMouseDown: /* * Ignore mouse button events which arrive while the app is inactive. * These events will be resent after activation, causing duplicate * actions when an app is activated by a bound mouse event. See ticket * [7bda9882cb]. */ if (![NSApp isActive]) { return theEvent; } case NSMouseMoved: case NSScrollWheel: #if 0 case NSCursorUpdate: case NSTabletPoint: case NSTabletProximity: #endif break; default: /* This type of event is ignored. */ return theEvent; } /* * Update the button state. We ignore left button presses that start a * resize or occur in the title bar. See tickets [d72abe6b54] and * [39cbacb9e8]. */ if (eventType == NSLeftMouseDown) { #if 0 if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] && [(TKWindow *) eventWindow mouseInResizeArea]) { /* * When the left button is pressed in the resize area, we receive * NSMouseDown, but when it is released we do not receive * NSMouseUp. So ignore the event and do not change the * ignoredPresses count. */ return theEvent; } #endif if (inTitleBar) { ignoredPresses++; return theEvent; } validPresses++; buttonState |= TkGetButtonMask(Button1); } if (eventType == NSLeftMouseUp) { if (ignoredPresses > 0) { ignoredPresses--; } else if (validPresses > 0) { validPresses--; } if (validPresses == 0) { buttonState &= ~TkGetButtonMask(Button1); } } /* * Find an appropriate NSWindow to attach to this event, and its * associated Tk window. */ capture = TkMacOSXGetCapture(); if (capture) { winPtr = (TkWindow *) capture; eventWindow = TkMacOSXDrawableWindow(winPtr->window); if (!eventWindow) { return theEvent; } } else { if (eventWindow) { winPtr = TkMacOSXGetTkWindow(eventWindow); } if (!winPtr) { eventWindow = [NSApp mainWindow]; winPtr = TkMacOSXGetTkWindow(eventWindow); } } if (!winPtr) { /* * We couldn't find a Tk window for this event. We have to ignore it. */ #ifdef TK_MAC_DEBUG_EVENTS TkMacOSXDbgMsg("Event received with no Tk window."); #endif return theEvent; } tkwin = (Tk_Window) winPtr; /* * Compute the mouse position in local (window) and global (screen) * coordinates. These are Tk coordinates, meaning that the local origin is * at the top left corner of the containing toplevel and the global origin * is at top left corner of the primary screen. */ global = [NSEvent mouseLocation]; local = [eventWindow tkConvertPointFromScreen: global]; global.x = floor(global.x); global.y = floor(TkMacOSXZeroScreenHeight() - global.y); local.x = floor(local.x); local.y = floor([eventWindow frame].size.height - local.y); if (Tk_IsEmbedded(winPtr)) { TkWindow *contPtr = TkpGetOtherWindow(winPtr); if (Tk_IsTopLevel(contPtr)) { local.x -= contPtr->wmInfoPtr->xInParent; local.y -= contPtr->wmInfoPtr->yInParent; } else { TkWindow *topPtr = TkMacOSXGetHostToplevel(winPtr)->winPtr; local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x); local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y); } } else { local.x -= winPtr->wmInfoPtr->xInParent; local.y -= winPtr->wmInfoPtr->yInParent; } /* * Use the local coordinates to find the Tk window which should receive * this event. Also convert local into the coordinates of that window. * (The converted local coordinates are only needed for scrollwheel * events.) */ target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); /* * Ignore the event if a local grab is in effect and the Tk window is * not in the grabber's subtree. */ grabWinPtr = winPtr->dispPtr->grabWinPtr; if (grabWinPtr && /* There is a grab in effect ... */ !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */ Tk_Window tkwin2; if (!target) { return theEvent; } for (tkwin2 = target; !Tk_IsTopLevel(tkwin2); tkwin2 = Tk_Parent(tkwin2)) { if (tkwin2 == (Tk_Window)grabWinPtr) { break; } } if (tkwin2 != (Tk_Window)grabWinPtr) { return theEvent; } } /* * Generate an XEvent for this mouse event. */ unsigned int state = buttonState; NSUInteger modifiers = [theEvent modifierFlags]; if (modifiers & NSAlphaShiftKeyMask) { state |= LockMask; } if (modifiers & NSShiftKeyMask) { state |= ShiftMask; |
︙ | ︙ | |||
265 266 267 268 269 270 271 | if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } if (eventType != NSScrollWheel) { /* | | > > | | > | > > > < < < < | | | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } if (eventType != NSScrollWheel) { /* * For normal mouse events, Tk_UpdatePointer will send the appropriate * XEvents using its cached state information. Unfortunately, it will * also recompute the local coordinates. */ #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"UpdatePointer %p x %.1f y %.1f %d", target, global.x, global.y, state); #endif Tk_UpdatePointer(target, global.x, global.y, state); } else { CGFloat delta; int coarseDelta; XEvent xEvent; /* * For scroll wheel events we need to send the XEvent here. */ xEvent.type = MouseWheelEvent; xEvent.xbutton.x = win_x; xEvent.xbutton.y = win_y; xEvent.xbutton.x_root = global.x; xEvent.xbutton.y_root = global.y; xEvent.xany.send_event = false; xEvent.xany.display = Tk_Display(target); xEvent.xany.window = Tk_WindowId(target); delta = [theEvent deltaY]; if (delta != 0.0) { coarseDelta = (delta > -1.0 && delta < 1.0) ? (signbit(delta) ? -1 : 1) : lround(delta); xEvent.xbutton.state = state; xEvent.xkey.keycode = coarseDelta; |
︙ | ︙ |
Changes to jni/sdl2tk/unix/tkUnixRFont.c.
︙ | ︙ | |||
109 110 111 112 113 114 115 | " <family>Noto Emoji</family>\n" " <family>DejaVu Sans Mono</family>\n" " </prefer>\n" " </alias>\n" "</fontconfig>\n"; static const Tcl_Config cfg_0[] = { { "fontsystem", "xft" }, | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | " <family>Noto Emoji</family>\n" " <family>DejaVu Sans Mono</family>\n" " </prefer>\n" " </alias>\n" "</fontconfig>\n"; static const Tcl_Config cfg_0[] = { { "fontsystem", "xft" }, { "emojihack", "0" }, { 0,0 } }; static const Tcl_Config cfg_1[] = { { "fontsystem", "xft" }, { "emojihack", "1" }, { 0,0 } }; |
︙ | ︙ |