Fixed calculation of character widths for OS X Quartz rendering. Fixed OS X mouse click handling (STR #1504).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5651 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
bda374b386
commit
eef6353369
3
CHANGES
3
CHANGES
@ -2,6 +2,9 @@ CHANGES IN FLTK 1.1.8
|
||||
|
||||
- Documentation fixes (STR #1454, STR #1455, STR #1456,
|
||||
STR #1457, STR #1458, STR #1460, STR #1481, STR #1578)
|
||||
- Fixed calculation of character widths for OS X
|
||||
Quartz rendering (no STR)
|
||||
- Fixed OS X mouse click handling (STR #1504)
|
||||
- Added missing GLUT functions so that FLTK can be used
|
||||
as a fairly complete C++ replacement for the original
|
||||
GLUT library (STR #1522)
|
||||
|
@ -966,13 +966,20 @@ static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, Even
|
||||
{
|
||||
case kEventMouseDown:
|
||||
part = FindWindow( pos, &tempXid );
|
||||
if ( part == inGrow && !Fl::grab()) {
|
||||
fl_unlock_function();
|
||||
suppressed = 1;
|
||||
Fl_Tooltip::current(0L);
|
||||
// if (grab() && grab()!=thisWindow) handle grab first (popping down menu bars)
|
||||
// if (modal() && modal()!=thisWindow) handle modal first (popping down menu bars)
|
||||
return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
|
||||
if (!(Fl::grab() && window!=Fl::grab())) {
|
||||
if ( part == inGrow ) {
|
||||
fl_unlock_function();
|
||||
suppressed = 1;
|
||||
Fl_Tooltip::current(0L);
|
||||
return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
|
||||
}
|
||||
if ( part != inContent ) {
|
||||
fl_unlock_function();
|
||||
suppressed = 1;
|
||||
Fl_Tooltip::current(0L);
|
||||
// anything else to here?
|
||||
return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
|
||||
}
|
||||
}
|
||||
suppressed = 0;
|
||||
if (part==inContent && !IsWindowActive( xid ) ) {
|
||||
@ -1023,8 +1030,10 @@ static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, Even
|
||||
Fl::e_y = pos.v;
|
||||
SetPort( oldPort );
|
||||
if (GetEventKind(event)==kEventMouseDown && part!=inContent) {
|
||||
Fl::handle( sendEvent, window );
|
||||
int used = Fl::handle( sendEvent, window );
|
||||
CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
|
||||
if (!used)
|
||||
suppressed = 1;
|
||||
} else {
|
||||
Fl::handle( sendEvent, window );
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ UniChar *fl_macToUtf16(const char *txt, int len)
|
||||
UniChar *dst = utf16buf;
|
||||
for (i=0; i<len; i++) {
|
||||
c = *src++;
|
||||
*dst++ = (c<128) ? c : utf16lut[c-128];
|
||||
*dst++ =(c<128) ? c : utf16lut[c-128];
|
||||
}
|
||||
*dst = 0;
|
||||
return utf16buf;
|
||||
@ -312,13 +312,13 @@ double fl_width(const char* txt, int n) {
|
||||
UniChar *uniStr = fl_macToUtf16(buf, 1);
|
||||
// now collect our ATSU resources
|
||||
ATSUTextLayout layout = fl_fontsize->layout;
|
||||
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, 1, 1);
|
||||
// activate the current GC
|
||||
ByteCount iSize = sizeof(CGContextRef);
|
||||
ATSUAttributeTag iTag = kATSUCGContextTag;
|
||||
ATSUAttributeValuePtr iValuePtr=&fl_gc;
|
||||
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
|
||||
// now measure the bounding box
|
||||
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, 1, 1);
|
||||
Fixed bBefore, bAfter, bAscent, bDescent;
|
||||
err = ATSUGetUnjustifiedBounds(layout, kATSUFromTextBeginning, 1, &bBefore, &bAfter, &bAscent, &bDescent);
|
||||
fl_fontsize->width[i] = FixedToInt(bAfter);
|
||||
@ -328,7 +328,7 @@ double fl_width(const char* txt, int n) {
|
||||
int len = 0;
|
||||
const char *src = txt;
|
||||
for (int j=0; j<n; j++) {
|
||||
unsigned int c = *src++;
|
||||
unsigned char c = *src++;
|
||||
len += fl_fontsize->width[c];
|
||||
}
|
||||
return len;
|
||||
|
Loading…
Reference in New Issue
Block a user