Commit Graph

4960 Commits

Author SHA1 Message Date
Manolo Gouy
8f59684c0f Mac OS: Fixed bug where an application could be left with only a tooltip window opened.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8599 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-17 19:58:31 +00:00
Ian MacArthur
d77223ea58 A quick hack to prevent the OSX tooltip-crash on
badly formed UTF8 strings.

This probably is not the best solution, but it
does work.
Note that the problem actually seems to be in
setting the window title, and indeed if you try to
label ANY window with a badly formed UTF8 string
(not just a tooltip) you get the same exception
thrown.

NOTE: I'm not even sure why we try to set the 
window title in tooltips, as it is never used 
and the tooltip label itlsef still works fine.

Anyway, we can do something better, but this will
work for now.

Aside: If you close an app on OSX whilst a tooltip
is visible, the app will not exit, as there is still
a window open (the tooltip) but no way to cancel
the tooltip.

Don't know if this is OSX specific or not though
but it is certainly a bug.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8598 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-17 14:39:16 +00:00
Ian MacArthur
e67e628317 I've extended Manolo's excellent tweaks that handle surrogate pairs.
I found some kind of weird interaction with some symbol fonts that
covered the supplementary planes that meant we could not measure
the width correctly (although we did measure the text extents correctly.)

This mod mirrors what we do for non-surrogate-pair glyphs more
closely and appears to do the Righ Thing now, at least for the test fonts that I have, and which were exhibiting the aberrant behaviour before.

I don't think I have broken anything else in the meantime!

 


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8597 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-17 13:18:55 +00:00
Manolo Gouy
f8d1e074ed Made Fl_Quartz_Graphics_Driver::text_extents() resistant to mal-formed UTF-8 text.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8596 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-17 11:19:41 +00:00
Manolo Gouy
ddc4b21b55 Fixed Fl_Paged_Device::print_window() that did not work under Windows seven.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8595 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-17 08:48:40 +00:00
Manolo Gouy
8212e4bfe7 Corrected gl.h instead of gl.H
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8594 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-15 21:41:34 +00:00
Manolo Gouy
9ff9cf1230 Added Fl_Paged_Device::print_window() to print a window with its title bar and frame.
Added Fl_Window::decorated_w() and Fl_Window::decorated_h() that return the size
of a window with its title bar and frame.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8593 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-15 21:38:05 +00:00
Manolo Gouy
c473215f2a Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8592 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:22:13 +00:00
Manolo Gouy
8d2d3c2a7d Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8591 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:21:12 +00:00
Manolo Gouy
2af958422a Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8590 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:16:03 +00:00
Manolo Gouy
8c6aa5edb5 Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8589 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:15:13 +00:00
Manolo Gouy
3f984b0b86 Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8588 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:11:34 +00:00
Manolo Gouy
73a57f8ac8 Corrected typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8587 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-14 13:04:57 +00:00
Manolo Gouy
f7c2061f0c Improved the accuracy of clipping when printing on Mac OS.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8586 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 20:50:41 +00:00
Ian MacArthur
be6df55717 More attempts to clean up WIN32 handling of UTF16 surrogate pairs.
In particular, I have added a new function to src/fl_utf.c called fl_ucs_to_Utf16() which
converts a single 32-bit Unicode value into one (or more) UTF16 cells.

This is needed in the win32 char-by-char text width() logic, and I suspect may also be useful in the OSX code in some places.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8585 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 15:43:22 +00:00
Manolo Gouy
639ee4fbab Now sends FL_HIDE/FL_SHOW events when window is iconized/un-iconized.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8584 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 09:03:19 +00:00
Manolo Gouy
404a7c1bad Restores change made in r.8557 that blocked system menu shortcuts.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 20:15:10 +00:00
Ian MacArthur
1d988db2db Under win32, text_extents() is not handling surrogate pairs either, at least on XP.
The problem seems to be in GetGlyphIndicesW() which is returning invalid indices for the surrogate pairs.
This causes subsequent measurements of the glyphs to fail, of course.

This patch does not fix the problem, it only makes sure it fails cleanly, causing a fallback to the default fl_measure like behaviour.
This is not nice, nor what I want, but at least it is consistent for now...



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8582 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 16:18:42 +00:00
Manolo Gouy
8b026342dd Following STR #2583, the behaviour of fl_draw_image() with d = 4 on Mac OS is here
made consistent with other platforms, that is, the 4th byte of each pixel is ignored
instead of treated as transparency data.
In the future, the fl_draw_image() signature may be extended with another argument
that would describe if and how transparency information is available.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8581 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 11:38:43 +00:00
Ian MacArthur
38a3c21ffd Modify win32 text width(ucs) function to handle surrogate pairs.
This now correctly measures glyphs whose codepoint requires a surrogate pair to represent it in UTF16.

NOTE 1: This code makes any UCS point > 0xFFFF a "special case" and measures it explicitly, rather than using the lookup table. This "explicit measure" may be slow, but actually seems OK in my tests, so far.
The lookup table still covers the basic multilingual plane and is used for any glyph <= 0xFFFF as before, so the behaviour for most existing bodies of text is unchanged.

This code also retains the historical behaviour under Win32 whereby strings are measured char-by-char rather than as a whole string - again this is intended to retain compatability with existing implementations.

It is proposed that we should move towards measuring entire strings in the future as this is conceivably more efficient and certainly more consistent - rendering is now largely done "string as a whole" so we ought to measure in that way too; though to date the differences seem tiny, as evdienced by the text rendering page of the unittest example.

NOTE 2: This does not fix the *rendering* of surrogate pairs under XP, which still seems to be broken. I suspect that TextOutW() may genuinely broken under XP, as it works fine on Vista, and it is not just my code that seems broken, other non-fltk programs exhibit the same aberrant behaviour. Measuring of surrogate pairs appears to work correctly though...
Maybe we are using TextOutW() wrongly?




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 10:08:58 +00:00
Ian MacArthur
d065ca89fe modify the win32 text ::draw() function to do "string at once" rather than "char by char" rendering, as advised by Bill and Manolo.
This seems to be good so far, though does not resolve the XP surrogate pairs issues.
If this fix is bad, we need to revert to r8577, which is good...

And I still haven't fixed the handling of width in win32 code, so it is still inconsistent with draw for high Ubicode points.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8579 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 22:00:19 +00:00
Ian MacArthur
924ed100d6 Minor rework of code to make ::rtl_draw() and ::draw(int angle,...) more consistent in coding terms. Behaviour of output unchanged.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8578 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 21:49:05 +00:00
Manolo Gouy
87b998ed1f Fixed crash on Mac OS when Fl::focus() called before show().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8577 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 20:10:02 +00:00
Manolo Gouy
8d084cb4bc Added missing fl_lock_function() / fl_unlock_function() pairs of calls.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8576 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 19:52:41 +00:00
Ian MacArthur
4710a67670 Remove use of the MS API call MultiByteToWideChar(...) and re-instate use of fl_utf8toUtf16(...) now that I have fixed a slight off-by-one in handling the ends of the input strings.
This makes string handling much more consistent across variants.
Doh!. I am such an idiot...

NOTE: This still does not fix aberrant handling of surrogate pairs under WinXP, and I still haven't resolved the issues with the win32 ::width() functions not handling surrogate pairs at all...




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8575 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 13:13:08 +00:00
Manolo Gouy
3d9eeb2d44 r. 8537 had by error introduced a compilation error with ppc architecture.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8573 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-10 09:10:40 +00:00
Manolo Gouy
7ce87f5102 Mac OS: fl_rect(), fl_rectf(), and fl_point() now have exact same output to display and printer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8572 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-10 09:01:13 +00:00
Manolo Gouy
0937913a7c Added missing test of necessity of fl_open_display() call.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8571 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-08 16:14:05 +00:00
Ian MacArthur
016219f4a2 Replace a few instances of fl_utf8toUtf16() with the near-equivalent MS API call MultiByteToWideChar() as this seems to fix the regression I introduced in the rendering of rotated text on WinXP.
However... It does not cause the "high" Unicode code points to render correctly on XP, even though they do work on Vista (and I assume later variants like Win7...)
So there's still something I am missing here. Maybe XP is just broken? That'll be a problem...



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8570 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-07 09:28:45 +00:00
Manolo Gouy
fc3ef2b0ea Modified Fl_Quartz_Graphics_Driver::width(unsigned int wc) so it handles properly
cases with wc > 0xFFFF.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8569 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-07 07:51:26 +00:00
Ian MacArthur
8a830853bc Further work to fix win32 handling of surrogate pairs for "high" Unicode points... Now fixed handling of rotated text version of win32 draw method.
Fixes to the various ::width() methods for win32 and OSX still TBD.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8568 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 21:37:13 +00:00
Ian MacArthur
f7e251e69b Initial work to fix handling of surrogate pairs on win32 - draw() was not handling any Unicode char above U+FFFF as we did not handle the case where more than one UTF16 cell was required to hold the full glyph.
This change works, but is incomplete, other sections of the win32 code (and possibly OSX code) are making the same invalid assumptions about UTF16 chars.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8567 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 21:02:35 +00:00
Greg Ercolano
f76a1522e8 Fixed problem with void function trying to return a value.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8566 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 18:32:45 +00:00
Manolo Gouy
0c02f2dabd Added Fl_Printer::driver(void) function that can be useful.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8565 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 13:43:09 +00:00
Manolo Gouy
80d6099c45 Window title bars are now printed with their rounded angles.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8564 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 12:33:34 +00:00
Manolo Gouy
265f213d23 Added function Fl_Printer::set_current() that may be useful.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8563 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 12:11:26 +00:00
Manolo Gouy
b149f786d7 Mac OS: Fl_Window::resize() shd not modify the maximum window size if it is 0.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8562 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 17:16:35 +00:00
Manolo Gouy
7931fe1047 Removed an NSAutoreleasePool allocation/release.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8561 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 16:41:31 +00:00
Manolo Gouy
b197f40781 Mac OS: the "Print Front Window" item of the application menu now prints also the title bar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8560 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 16:20:02 +00:00
Manolo Gouy
b5ab77d07d Removed usage of NSMainMenuWindowLevel to use only 3 window levels.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8559 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 12:41:32 +00:00
Manolo Gouy
cd2b8ed399 Fix error that can happen with some 3rd party fonts lacking certain size information.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8558 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-04 12:28:20 +00:00
Manolo Gouy
a86df5ede6 Mac OS: removed duplicate FL_KEYBOARDS events with function and modifier keys.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8557 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-03 17:31:07 +00:00
Manolo Gouy
32df4755c4 about STR #2599: - fix the synchro between key presses and key events
- implement character palette input by FL_PASTE events

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 17:19:34 +00:00
Albrecht Schlosser
cc3606b097 Updated dependencies.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8554 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 13:43:07 +00:00
Albrecht Schlosser
75294d3e24 Fixed dependencies of bundled libs, corrected a typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8553 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 13:40:41 +00:00
Manolo Gouy
8cd8a67b04 Fix STR #2598 with OP patch.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8552 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 09:00:07 +00:00
Manolo Gouy
f4c12d46d6 Mac OS: fixes in STR #2588 the warning message "_createMenuRef called with existing
principal MenuRef already associated with menu".

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8551 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 08:32:57 +00:00
Albrecht Schlosser
885c5fe16d Fixed documentation typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8550 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-31 16:06:59 +00:00
Manolo Gouy
bd36f0dd31 Mac OS: Make the Fl::event_key() function distinguish between left and right modifier keys.
Also, don't rebuild the application menu if one is already there.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8549 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-30 22:15:17 +00:00
Albrecht Schlosser
281489f849 Documentation updates and typos.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8548 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-30 12:07:52 +00:00