diff options
author | Kevin Walzer <kw@codebykevin.com> | 2014-12-21 04:11:51 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2014-12-21 04:11:51 (GMT) |
commit | 8faca188c488af10facd0c8470314303f1b02c5b (patch) | |
tree | 8cd84f987e3850fec0e7bf15b7ff5bede667a9e1 /macosx/tkMacOSXMenubutton.c | |
parent | 4f1970b5b3274109e885922378d7da7330a975c4 (diff) | |
download | tk-8faca188c488af10facd0c8470314303f1b02c5b.zip tk-8faca188c488af10facd0c8470314303f1b02c5b.tar.gz tk-8faca188c488af10facd0c8470314303f1b02c5b.tar.bz2 |
Minor optimization of drawing code in OSX
Diffstat (limited to 'macosx/tkMacOSXMenubutton.c')
-rw-r--r-- | macosx/tkMacOSXMenubutton.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index df42763..c79a9c1 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -60,12 +60,23 @@ static const BoundsFix boundsFixes[] = { #endif + + /* * Forward declarations for procedures defined later in this file: */ static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr); +/* + * The structure below defines menubutton class behavior by means of functions + * that can be invoked from generic window code. + */ + +Tk_ClassProcs tkpMenubuttonClass = { + sizeof(Tk_ClassProcs), /* size */ + TkMenuButtonWorldChanged, /* worldChangedProc */ +}; /* *---------------------------------------------------------------------- @@ -87,9 +98,11 @@ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { - MacMenuButton *macButtonPtr = ckalloc(sizeof(MacMenuButton)); + MacMenuButton *macButtonPtr = + (MacMenuButton *) ckalloc(sizeof(MacMenuButton)); macButtonPtr->button = nil; + Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, (ClientData) macButtonPtr); return (TkMenuButton *) macButtonPtr; @@ -160,7 +173,7 @@ TkpDisplayMenuButton( if (!tkwin || !Tk_IsMapped(tkwin) || !view || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) { return; - } + } CGContextConcatCTM(dc.context, t); Tk_Fill3DRectangle(tkwin, (Pixmap) macWin, mbPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); |