1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-03 04:14:20 +01:00
Files
wmaker/WINGs
Carlos R. Mafra ee28b0257a WINGs/wfont.c: Avoid returning font=NULL in WMCreateFont()
WPrefs tries to use the fonts listed in the WMCreateFont() call (from WPrefs.c),

font = WMCreateFont(scr, "Lucida Sans,URW Gothic L,Times New Roman,serif"
                         ":bold:pixelsize=26:antialias=true");

and 'font' is later used without accounting the possibility of it being NULL in

WMSetLabelFont(WPrefs.nameL, font);
WMReleaseFont(font);

In particular, WMReleaseFont(font) will kill WPrefs ungracefully with the
following message if font=NULL

WPrefs: wfont.c:193: WMReleaseFont: Assertion `font!=((void *)0)' failed.
Aborted

That happens because the return value of WMCreateFont() can be NULL, so this
patch makes WMCreateFont() never return NULL. If the font creation fails for
some reason (see below), we try to use the emergency DEFAULT_FONT and print
debugging information telling what's going on. If the use of DEFAULT_FONT
also fails, then we terminate WPrefs with exit(1) and let the user know
why exactly if failed.

This bug happened because the font "Lucida Sans" (the first possibility
in the initial call to WMCreateFont()) "exists" in my system as a stale
symbolic link to a location which no longer exists after an upgrade from
java from 1.5.0.14 to 1.5.0.15

    /etc/alternatives/LucidaSansDemiBold.ttf ->
    /usr/lib/jvm/java-1.5.0-sun-1.5.0.14/jre/lib/fonts/LucidaSansDemiBold.ttf

So the call to XftFontOpenName(display, scrPtr->screen, fname) with
"Lucida Sans" being the first possibility for Xft to try out ended up in 'font'
being NULL because, as far as the Xft library was concerned, "Lucida Sans"
produced a positive match (due to it existing as a symbolic link) but in the end
a NULL result was produced due to the missing symbolic link destination. This later
exposed the bug of WMCreateFont() returning font=NULL and WPrefs.c not checking
whether font=NULL before using it. Bang!

If "Lucida Sans" was the _second_ entry to try and the first one had suceeded,
this bug would not have surfaced.

This solves https://qa.mandriva.com/show_bug.cgi?id=39677

Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
2008-05-02 20:23:00 -03:00
..
2005-07-05 19:41:06 +00:00
2003-04-18 01:16:50 +00:00
1999-06-04 20:22:31 +00:00
2004-10-12 21:28:27 +00:00
2004-10-26 03:03:02 +00:00
2003-01-16 23:30:45 +00:00
2001-04-19 21:12:08 +00:00
2004-10-23 02:26:13 +00:00
2000-09-25 19:21:45 +00:00
2008-05-02 20:01:50 -03:00
2004-10-12 21:28:27 +00:00
2005-08-22 23:58:19 +00:00
2004-10-13 23:39:29 +00:00

                      WINGs - WINGs Is Not GNUstep

                                   by

                          Alfredo Kengi Kojima 
                  
                          kojima@windowmaker.info


   WINGs is a small widget set with the N*XTSTEP look and feel. It's API
is inspired in OpenStep and it's implementation borrows some ideas
from Tk. It has a reasonable set of widgets, sufficient for building
small applications (like a CDPlayer or hacking something like rxvt). It
also has other functions that are usefull for applications, like a
User Defaults alike configuration manager and a notification system.

   The library is limited and it's design is a little sloppy, 
so it's not intended to build large or complex applications, like 
anything more complex than a CDPlayer. GNUstep should be used for such
applications.

   Since WINGs is written in C and is sort of low-level it is small
and faster than say, Motif or even Athena. Knowing Xlib will help you to 
workaround some of it's limitations, although you'll probably be able to 
write something like a trivial tic-tac-toe game without knowing much Xlib.

   Some of it's functions are designed to support the Window Maker window
manager (see http://windowmaker.info) In fact, it's primary role is to
support Window Maker. All other uses of it are just an added bonus.

   It will help you to understand the API if you read the ApplicationKit
reference manual, distributed as a PDF by Apple. The function names,
structs and most of the intrinsics are very close to OpenStep classes. 


Internationalization:
---------------------

    Change ~/GNUstep/Defaults/WMGLOBAL to set the desired font set and
set MultiByteText = YES; to enable support for multibyte text.


Widgets provided by WINGs:
--------------------------

- button (command button, radio, switch etc. - all buttons defined in OpenStep)
- label
- textfield
- frame
- window
- popup menu button
- scroller
- selection list
- browser
- slider
- scrollable view
- color well
- split view
- tabbed view
- progress indicator

- selection (make pasteboard like?)
- drag&drop

- input box
- file panel
- color panel
- alert panel 
- font panel

If you think you can code the following, please do. They are needed by
WPrefs.app, but the number of other things I have to do is huge.

- input method support (XIM). I have no idea of how to code it. People who use
different characters than ASCII will have trouble editing menus without it...


Wish list: (I don't have the know-how or time to do them)
---------------------------------------------------------

- text (with support for RTF)
- matrix (like NSMatrix)
- font manager (like NSFontManager)
- finish other wigets
- optimize list scrolling (XCopyArea() the area that's already drawn)
- InterfaceMaker?
- use XSetWMName and XSetWMIconName for the window/icon title setting.
  This requires transforming the received text to a text property with
  the proper encoding.

Copyright
---------

WINGs is copyright (c) Alfredo K. Kojima and is licensed through the GNU
Library General Public License (LGPL).