1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-03-11 12:05:48 +01:00

593 Commits

Author SHA1 Message Date
Carlos R. Mafra
87ce0de15f Window Maker 0.95.2 2012-02-14 19:25:07 +00:00
Carlos R. Mafra
51a54ba2e2 dock: Make some functions static 2012-02-12 21:35:09 +00:00
Carlos R. Mafra
119507d541 wmgenmenu: Update mrxvt options
The old mrxvt I had in my previous distro is gone. The options
need to be updated.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-12 20:08:33 +00:00
Rodolfo García Peñas (kix)
b08b182147 menu: remove OpenWorkspaceMenu()
The function OpenWorkspaceMenu() is not used, remove it.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-12 20:06:40 +00:00
Rodolfo García Peñas (kix)
6368bde7e5 WindowMaker: Add Balloon to the clip
Display a standard Window Maker balloon with the workspace name when the
mouse enters the clip area.

This complements commit 4954d4df23 ("clip: Do not display balloon with
workspace name") because now the balloon which appears on the clip is the
same as in other parts of wmaker.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-12 20:06:20 +00:00
Carlos R. Mafra
4954d4df23 clip: Do not display balloon with workspace name
When the mouse passes over the clip, wmaker would display a "odd" balloon
text with the workspace name, but the balloon itself was covered by the
clip icon!

So if the workspace name was short enough ("Internet" is, by my testing here)
the user wouldn't see anything, the balloon is completely under the clip icon.

I found this issue because one of my workspaces is called "Beyonder" and I
noticed a small "r" under the clip one day.

Instead of trying to fix this, I just removed the whole thing about displaying
the balloon because it is superfluous and I haven't seen any bug reports about
this yet, so it probably means most people are not even aware of it.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-12 20:04:13 +00:00
Carlos R. Mafra
558fc5f0d3 dock: Trivial code style cleanups
Just random things I noticed while reading the code...

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-12 20:04:13 +00:00
Carlos R. Mafra
393a917a4f Remove dead code ifdef'ed by GRADIENT_CLIP_ARROW
GRADIENT_CLIP_ARROW was never defined anywhere and having fancier clip
arrows is not something particularly interesting, so let's simply remove
the code.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-02-11 19:08:28 +00:00
Iain Patterson
8d7c725b7b Made ARROWLESS_KBD a preference.
Replace the ARROWLESS_KBD #define with the ViKeyMenus preference.

When ViKeyMenus is TRUE, users can type h/j/k/l to scroll around menus.

Since ARROWLESS_KBD was previously undefined by default, ViKeyMenus is
FALSE by default.
2012-02-10 12:39:24 +00:00
Martin Dietze
8f724f65aa debian: Don't include files created under debian/ from previous builds in the tarball. 2012-02-08 10:19:42 +00:00
Carlos R. Mafra
3bc2535968 Fix getstyle, again
As reported by Paul Seelig, it used to be the case that

getstyle -t ~/GNUstep/Library/WindowMaker/Themes/somefile

would save the current theme, and all old menus (WMRootMenu) were
relying on this.

The problem was that the following piece (from commit 6bf79945)

	if (style_file && !make_pack)
		print_help(0, 1);

would allow a style_file to be specified and saved to only with the
option -p (which implies make_pack), therefore saving a theme with
-t like the root menu used to do no longer worked.

Now things work fine:

[mafra@Pilar:~]$ ls GNUstep/
Applications/  Apps/  Defaults/  Library/
[mafra@Pilar:~]$ getstyle -t ~/GNUstep/theme
[mafra@Pilar:~]$ ls GNUstep/
Applications/  Apps/  Defaults/  Library/  theme

But also note that trying to save a theme outside of GNUstep/
is not allowed and it prints no error message - perhaps it should...
2012-02-03 01:42:17 +00:00
Carlos R. Mafra
85b4dba721 Revert "getstyle: Remove dead code"
This reverts commit e06b3005e8.
2012-02-02 23:47:54 +00:00
Rodolfo García Peñas (kix)
f6b7cb39b9 debian: Symbols update for libWutil2
In commit e1453087f57... the function copy_file() was renamed to
wcopy_file(), then the symbols file needs to be updated.

The changelog includes a new debian bug closed.
2012-02-01 18:24:18 +00:00
Carlos R. Mafra
37466f4927 Remove forgotten src/text.h
It should have been removed together with src/text.c in
commit 215a57077c ("wtext killing spree").

Thanks to John Robinson for pointing it out.
2012-01-31 19:34:52 +00:00
Carlos R. Mafra
e1453087f5 WINGs: Rename copy_file() to wcopy_file()
...in order to avoid clashes that happen during compilation of
wmakerconf.

This is a new function in WINGs, so renaming it at this point is
not a big deal.

Thanks to Rodolfo García for the heads up.
2012-01-31 12:23:54 +00:00
Rodolfo García Peñas (kix)
e9d4930657 debian: New debian version 0.95.1-1
This upload includes the debian changes of 0.95.0 and 0.95.1
  - Debian stuff (themes, menus,...) is moved to different folder.
  - Many changes in debian/rules file
    - New files to avoid lines in debian/rules (new menu files)
  - This is a little extract form the debian/changelog file:

  * New upstream version 0.95.1
  * The WINGs's file proplist-compat.h is removed in upstream.
    - Removed the line in debian/libwings-dev.install
  * Updated debian/libwutil2.symbols with new symbol.
  * libpng12-dev dependencies changed to libpng-dev. [Closes: #648123]
  * wterm package suggestion removed.
  * Menu shows "Run..." option. [Closes: #165075]
    Thanks to Andreas Tscharner for their patch.
  * Menu shows the background files [Closes: #655122]
    * Added patch 54_Debian_wmmacros.diff.
      Based on changelog: Marcelo E. Magallon Tue, 17 Nov 1998
  * Xterm and WMPrefs are now Debian specific.
    * Added patch 53_Debian_WMState.diff.
      Based on changelog: Marcelo E. Magallon Sun, 26 Nov 2000
  * Fix wmaker-common dependencies. [Closes: #654668]
    * Manpages moved from wmaker-common to wmaker (Lintian problem).
  * Removed old stuff in wmaker.post* and wmaker-common.post* about
    update-alternatives.
  * Fix to the FTBFS. [Closes: #654524]
  * New debian/watch file
  * New upstream version 0.95.0, now from git. [Closes: #401900]
    [Closes: #514438, #607550, #218110, #583734, #105351, #549157]
    [Closes: #283610, #311563, #310285, #329783, #280819, #284048]
    [Closes: #292391, #361241, #364290, #148370, #287459, #122076]
    [Closes: #175503, #79598, #78088, #68381, #38184, #41434, #41434]
    [Closes: #94960, #39543, #63265, #69499, #94446, #77488, #329783]
    Thanks to Andreas Tscharner for their bug revision.
    * This new version is based in wmaker-crm a wmaker fork, because
      wmaker (original) is not updated.
  * New debian/rules file. [Closes: #590244]
    * Many many changes
    * /usr/lib/WindowMaker/WindowMaker is now /usr/lib/WindowMaker/wmaker
      * wmaker script launch now /usr/lib/WindowMaker/wmaker
  * New maintainer. [Closes: #632875]
  * New package wmaker-common (arch independent files).
  * Removed the asclock diversions from the wmaker install scripts
    wmaker.postrm and wmaker.preinst because asclock binary is not
    included in wmaker package (see asclock package).
  * New package wmaker-common with the arch independent files.
  * debian/patches are now DEP-3.
  * debian/copyright is now DEP-5.
  * Bumped Standars-Version 3.9.2.
  * Manpages moved to upstream.
  * Solved problems with .la files (lintian clean).
  * libwmaker0-dev isn't included, because was removed in upstream.
2012-01-29 17:39:53 +00:00
Carlos R. Mafra
b618febb2c Window Maker 0.95.1 2012-01-29 11:12:04 +00:00
Rodolfo García Peñas (kix)
73eaddfa3a Make ProgName a local variable
ProgName in WindowMaker.h is not needed because this variable is used only
in main.c
2012-01-28 14:55:49 +00:00
Rodolfo García Peñas (kix)
a2c297e6a7 Remove unused variables 2012-01-28 14:54:07 +00:00
Carlos R. Mafra
31b5ee1a5f event.c: Make two functions static
Saves 120 bytes:

[mafra@Pilar:wmaker.git]$ size src/event.o*
   text    data     bss     dec     hex filename
  12568       0    1068   13636    3544 src/event.o.new
  12688       0    1068   13756    35bc src/event.o.old
2012-01-28 14:48:29 +00:00
Carlos R. Mafra
3bc48f0893 Info panel: Shorten memory line and simplify code a bit
With the fonts I use here, the memory information line in the "Info panel"
did not fit inside the window. So make that line a bit shorter by displaying

	Total memory allocated: 2600 kB (in use: 2182 kB)

instead of

	Total allocated memory: 2600 kB. Total memory in use: 2182 kB.

Furthermore, the surrounding code was a bit convoluted to display either

"Additional support for: WMSPEC"

or

"Additional support for: WMSPEC and MW"

As WMSPEC is always present and it doesn't seem we are adding more stuff
to support, one can do the same with a shorter code which reads a little
bit better.
2012-01-25 17:40:18 +00:00
Carlos R. Mafra
cbe2f4e61a Inotify: Reload keyboard shortcut definitions when configuration changes
Despite having the inotify mechanism compiled in my WM, everytime I
changed a keyboard shortcut definition in the WMRootMenu via WPrefs
I was required to open the WMRootMenu (eg with the F12 key) for the
change to take effect...annoying.

So explicitly reload the key bindings when a modification inside
~/GNUstep/Defaults/ is detected. As the inotify mechanism calls the
function wDefaultsCheckDomains() when that happens, let's add a call
to rebind_key_grabs() in there.

Now it works fine and changes are automatically in effect once WPrefs
writes the menu.

PS: rebindKeygrabs() renamed to rebind_key_grabs()...
2012-01-22 16:42:31 +00:00
Carlos R. Mafra
c33455fdb4 Inotify: Use wwarning() instead of fprintf() 2012-01-22 10:20:31 +00:00
Rodolfo García Peñas (kix)
edeca34be9 WPrefs: Remove extra include of src/wconfig.h
The file ../src/wconfig.h is included twice, remove one entry.
2012-01-22 10:19:05 +00:00
Rodolfo García Peñas (kix)
3ae34b958c WPrefs: Remove duplicated function captureShortcut()
The function captureShortcut() is implemented in both files KeyboardShortcuts.c
and Menu.c, with just a minor difference regarding the conversion to upper case.

To unify them, define a new function which includes a new boolean paramenter to
dictate whether the upper case conversion should be done or not.
2012-01-20 21:50:12 +00:00
Rodolfo García Peñas (kix)
809c536879 WINGs: Remove proplist-compat.h
It is not needed to compile Window Maker and it is not used by other
applications (tested in Debian). Therefore the file should be removed.
2012-01-20 21:49:53 +00:00
Carlos R. Mafra
69d2e51876 WPrefs: Remove trimstr() and use wtrimspace() from WINGs
There's no need to have a private function while there's one in WINGs.

Besides that, it does not remove trailing whitespaces appropriately as I
just tested by adding trailing space in the shortcut captured by WPrefs.
It is not trimmed before saving it:

[mafra@Pilar:Defaults]$ grep CloseKey WindowMaker
  CloseKey = "Mod1+C    ";

Using wtrimspace() fixes that and even saves 208 bytes of code:

[mafra@Pilar:WPrefs.app]$ size KeyboardShortcuts.o.*
   text    data     bss     dec     hex filename
   7703       0       0    7703    1e17 KeyboardShortcuts.o.new
   7911       0       0    7911    1ee7 KeyboardShortcuts.o.old

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-01-20 21:43:13 +00:00
Carlos R. Mafra
171eca8b64 Get rid of cropline(), use wtrimspace() instead
There is code duplication with the cropline() function, so get rid
of it and use WINGs wtrimspace() instead.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-01-20 21:42:17 +00:00
GhostlyDeath
3c2b3792a6 Remove endian swap for icon image data.
On my PowerPC Debian Squeeze System, the icons are colored
incorrectly. This patch removes the swapping of the data on Big Endian
systems, thus causing the icons to be colored correctly.

The data appears to already be in the native endian format.
2012-01-18 12:04:57 +00:00
Carlos R. Mafra
215a57077c wtext killing spree
After using WINGs wInputDialog() to handle renaming the workspace
upon Ctrl+left click on the workspace menu, all functions in src/text.c
become unused.
2012-01-18 12:04:57 +00:00
Carlos R. Mafra
fd07e032df Fix non-ascii workspace rename via menu
As pointed out in the comments in

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=304480

it's not possible to rename workspaces with non-ascii characters -- more
precisely characters which require deadkeys with your particular keyboard.

According to the investigation made by Rodolfo Peñas:

http://lists.windowmaker.org/dev/msg02529.html

the fundamental issue behind this bug is the fact that XLookupString can't
handle deadkeys.

So either we do something radical or live with the bug.

However -- as Rodolfo also pointed out -- renaming the workspaces via the
Clip works with non-ascii chars. The reason is that the Clip uses a input dialog
function from WINGs to handle the renaming.

So instead of doing the low-level handling of text inside the menu in order
to rename workspaces, just fire up the same WINGs input dialog to handle it.
It works and the old function editEntry() can be removed.

Furthermore, it makes the whole set of functions in src/wtext.c useless, and
they are removed in the next patch.

Overall, 600 lines of code are gone now.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2012-01-18 12:04:57 +00:00
Carlos R. Mafra
918d0b5af1 configure: Also display the library dir in the summary
The summary now looks like:

Window Maker was configured as follows:

Installation path prefix            : /usr/local
Installation path for binaries      : /usr/local/bin
Installation path for libraries     : /usr/lib64
Installation path for WPrefs.app    : /usr/local
Supported graphic format libraries  : XPM PNG JPEG TIFF builtin-PPM
Antialiased text support in WINGs   : yes
Xinerama extension support          : yes
XRandR extension support            : yes
Translated message files to install : None

I want to see the library line in order to avoid forgetting that
I should put them in /usr/lib64 (and not in the defaul /usr/local/lib)
2012-01-18 12:04:57 +00:00
Christophe CURIS
3ed409cbd0 wrlib: Improvement in the alpha channel support.
There are some problems in the alpha channel support, as is
reported at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=72917

This patch add a new RCombineAlpha function, based on Gimp. This
function is called when needed in the raster.c functions.

This patch is based on the Brad Jorsch <anomie@users.sourceforge.net>
patch for the 0.62.1-0.1 version.

[crmafra: v1 was sent by Rodolfo kix Garcia <kix@kix.es>]
2012-01-18 12:04:57 +00:00
Carlos R. Mafra
e06b3005e8 getstyle: Remove dead code
The statement under "if (style_file)" in the else branch of
"if (make_pack)" will never be executed because getstyle already
prints out a help message and exits before that.

So remove that code.
2012-01-16 00:09:14 +00:00
Carlos R. Mafra
e4d0ea5373 getstyle: Get rid of abortar()
Instead of using a temporary buffer to store a "reason" string
which is later printf()'ed by abortar(), use wwarning() directly
and do the small cleanup done by abortar() on the spot.

As this was the only call site for abortar() it can now be removed.
The resulting object code gets smaller as a side effect.

Thanks to Christophe <christophe.curis@free.fr> for finding a mistake
in the first version of this patch.
2012-01-16 00:09:14 +00:00
Carlos R. Mafra
7e4a3ae57f getstyle: Use new copy_file() from libWUtil and delete copyFile()
Now both getstyle.c and wcolorpanel.c use the same copy_file() function
from libWUtil, and their similar private copies are gone.
2012-01-15 14:33:11 +00:00
Carlos R. Mafra
89bf263410 WINGs: Replace fetchFile() by copy_file() in wcolorpanel.c
Now that copy_file() is in libWUtil, use it instead of fetchFile(),
which can be removed from wcolorpanel.c.
2012-01-15 14:31:52 +00:00
Carlos R. Mafra
7a180b0ef8 WINGs: Add copy_file() to libWUtil
This is essentially the fetchFile() from wcolorpanel.c from the last
commit, but renamed to a better name.

This patch just adds the function to the lib. Nobody uses it yet.
2012-01-15 14:25:07 +00:00
Carlos R. Mafra
14643408e8 WINGs: Make fetchFile() more similar to copyFile() from getstyle.c
The idea is to use the fetchFile() in getstyle.c and in wcolorpanel.c
instead of using two very similar functions.

In order to do that, let's move the most generic one (fetchFile()) to
libWUtils, and this is the first step.
2012-01-15 14:23:12 +00:00
Carlos R. Mafra
6bf5f947a9 wmgenmenu: Fix "Save Theme"
Dario Niedermann reported on 27.11.2011:

       Selecting "Save Theme" from WMaker's root menu results in dialog box
       asking for theme name, but then nothing is saved.

       This feature used to work in 0.92.0.

and the reason for it (if he uses a WMRootMenu generated by wmgenmenu) is
the incorrect use of the option "-t" instead of "-p" to getstyle.

Furthermore, let the invocation of getstyle reflect the new default location
for the themes.
2012-01-15 04:12:14 +00:00
Carlos R. Mafra
ac8a493ed9 getstyle: Save theme pack in Themes dir
When invoked as

getstyle -p NewTheme

Instead of saving the theme inside the topdir ~/GNUstep let's save it
insinde their proper directory ~/GNUstep/Library/WindowMaker/Themes.
2012-01-15 04:12:14 +00:00
Carlos R. Mafra
5ef03b2a3a getstyle: Fix output to stdout
There is a problem with getstyle invoked with no arguments:

[mafra@Pilar:util]$ ./getstyle
Usage: getstyle [-t] [-p] [-h] [-v] [file]

or with -t:

[mafra@Pilar:util]$ ./getstyle -t
Usage: getstyle [-t] [-p] [-h] [-v] [file]

In both cases it is supposed to write to the standard output:

[mafra@Pilar:wmaker.git]$ getstyle -h
Usage: getstyle [-t] [-p] [-h] [-v] [file]
Retrieves style/theme configuration and output to FILE or to stdout

This regression was caused by commit 6bf7994520 ("style Stuff up").
When that commit did

       argc -= optind;

       if (argc != 1)
               print_help(0,1);

it excluded the output to stdout as valid, because in this case
argc - optind is zero (see the manpage of getopt(3)).

The correct handling is to set the style_file only when there is
one non-option ARGV-element (argc - optind == 1) and print the
help message when there are more than one non-option element.
2012-01-15 02:45:00 +00:00
Carlos R. Mafra
385dbdb3d6 Steal documentation with tips on email clients
Applying patches without needing to fix them first helps me save time,
and this file (stolen from the linux kernel documentation) contains some
valuable tips to configure email clients to not mangle the patches you send.

The goal is that patches are sent in the body of the email (to ease review)
and be applied directly with 'git am'.

I personally use mutt as mail client and xjed as an editor. I insert the patch
in the body of the email using xjed's "Insert file" menu operation. That
works fine, but this documentation file helps you with more choices.
2012-01-14 15:34:44 +00:00
Carlos R. Mafra
8b049dec73 Expand the documentation about writing patches
Try to convince other people why having non-trivial patches with empty
commit messages are frowned upon.
2012-01-14 15:11:21 +00:00
David Couzelis
0f26c43371 Prevent removal of dock icons due to resolution changes
I use xrandr to decrease the resolution of my display when I connect
it to my TV. When I change the resolution back to my monitor, a few
of the icons at the bottom of my dock are deleted.

This happens because wmaker computes the maximum number of dockapps
which the dock can hold based on the screen resolution:

        icon_count = scr->scr_height / wPreferences.icon_size;

and drops the dockapps above that number (in wDockRestoreState()).

But now the resolution can change via xrandr, so the above computation
can lead to dockapps being dropped when the new resolution is smaller
than it used to be.

To fix this it's enough to have a resolution-invariant number of allowed
dockapps.
2012-01-13 09:54:14 +00:00
Rodolfo Garc??a Pe??as (kix)
6ae01b9d90 WPrefs: Fetch default menu from system path
If you delete the file ~GNUStep/Defaults/WMRootMenu and run WMPrefs
and go to the Menu Edit tab, it will show a dialog about keeping the menu or
discarding it. If you discard it then WPrefs shows an error:

"Could not open default menu from
'/home/user/GNUStep/Library/WindowMaker/plmenu"

The problem is at WPrefs.app/Menu.c:1424, and it happens because it tries
to load the default menu from the user's GNUstep home, but plmenu is not
copied there during the installation.

Of course, the file doesn't need to be copied to the users home, so
WPrefs should try to read it from /usr/share/WindowMaker/plmenu (Debian)
or /usr/local/share/WindowMaker/plmenu (upstream).
2012-01-12 22:07:01 +00:00
Rodolfo García Peñas (kix)
7013467da4 configure: New architectures kfreebsd* and Hurd 2012-01-05 23:44:34 +00:00
Rodolfo kix Garcia
01907f9983 Add WMRootMenu to the clean list 2011-12-31 18:09:34 +00:00
Rodolfo García Peñas (kix)
a9e136ec41 util: po files reports warning with fuzzy 2011-10-28 15:57:07 +01:00
Rodolfo García Peñas (kix)
ace761c690 debian: symbols updated to 0.95.0 2011-10-28 15:57:07 +01:00
Rodolfo García Peñas (kix)
484bb08316 WindowMaker: icon DefaultAppIcon.tiff removed
It is the same file as defaultAppIcon.tiff
2011-10-28 15:56:44 +01:00
Rodolfo García Peñas (kix)
9a67c55fa0 WINGs: removed prev_y variable not used 2011-10-28 15:55:58 +01:00
Rodolfo García Peñas (kix)
744490c0b2 Debian: New version 0.95.0-1 2011-10-28 15:55:58 +01:00
Xose Vazquez Perez
0e80a23c51 Update email address 2011-10-18 14:05:50 +01:00
Carlos R. Mafra
d0a48d9914 WindowMaker 0.95.0-crm 2011-10-11 14:32:55 +01:00
Rodolfo García Peñas (kix)
625e762f9a debian: problem with spaces and forget autogenerated files 2011-10-09 17:59:24 +01:00
Martin Dietze
8bc9a1dd19 debian: Version bump in nightly build script. 2011-10-07 19:54:11 +01:00
Rodolfo García Peñas (kix)
93687024ce debian: add back wmlib folder 2011-10-07 10:01:57 +01:00
Rodolfo García Peñas (kix)
9fa427bc7f Debian full patch migration
* New maintainer [Closes: #632875]
  * New upstream version, now from git. [Closes: #556677]
  * New package wmaker-common (arch independent files)
  * removed the asclock diversions from the wmaker scripts
  * new package wmaker-common with the arch independent files
  * debian/patches are now DEP-3
  * debian/copyright is now DEP-5
  * Standard-Version is now 3.9.2
  * manpages moved to upstream
  * solved some problems with .la files (lintian clean)
2011-10-05 19:24:01 +01:00
Carlos R. Mafra
d435ea7468 WINGs: Add back wprogressindicator.c
The examples inside WINGs/Tests fail to compile otherwise.
2011-08-25 00:06:58 +02:00
Carlos R. Mafra
f43aa47d68 Revert "WINGs: Remove wruler and wtext"
This reverts commit f4890b17e6.

It turns out that I needed some functions from wtext.c to develop
a WINGs front-end to my comic book collection MySQL database.

Conflicts:

	WINGs/Makefile.am
	WINGs/WINGs/WINGs.h
2011-08-24 19:18:06 +02:00
Rodolfo García Peñas (kix)
b949a1c464 debian: lots of updates 2011-08-24 18:27:32 +02:00
Rodolfo García Peñas (kix)
c2975ab510 doc: Fix error in Russian wmaker.1x manpage (lintian error) 2011-08-16 13:46:43 +02:00
Carlos R. Mafra
9777b14fb7 Increase height of 'Attributes' window
With the addition of an extra button to the 'Advanced Options' window,
the vertical space of the widget no longer suffices. Increase it from
350 to 360 and adjust other parameters accordingly.

And let's write the button positions as 'PHEIGHT - 40' instead of using
a hardcoded value, avoiding the need to change it everytime PHEIGHT is
changed.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-08-13 15:03:27 +02:00
Carlos R. Mafra
8ba6118c2e Make 'no miniaturizable' window property user-configurable
The flag to not let windows be minimized was already defined in
WM (it's called 'no_miniaturizable') and the minimize functions
respect it. However this flag can not currently be set manually.

As can be read in the NEWS file

  "NotMiniaturizable option changed to NoMiniaturizeButton"

it seems that the "non miniaturizable" property was a first-class citizen
in ancient times and probably configurable (those changes do not appear in
the old CVS history).

Let's make this property be user-configurable through the "Advanced Options"
panel.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-08-11 13:30:44 +02:00
Carlos R. Mafra
25c67fc7cc Increase width of 'Attributes' window
Before this change some lines in the "Advanced Options" window would not
fit into one line and would screw up the others. This depends on the fonts
used, but increasing the width of the panel a bit does not hurt.
2011-08-11 12:26:49 +02:00
Brad Jorsch
a06b0673d8 Fix some "'var' may be used uninitialized" warnings
The one in WPrefs.app/Appearance.c is indirect: the function might
be inlined and might return an uninitialized value, which causes gcc to
complain that the caller might use that uninitialized return value.
2011-08-09 23:45:34 +02:00
Brad Jorsch
d9296ff9a4 Remove warning in wmagnify.c (correctly)
The problem with f65b99e615 was that it removed the call to
newWindow() along with the unused variable, without considering that
newWindow() has side effects that need to happen even if the return
value is ignored. So as long as we keep the newWindow() call, we can
safely remove the (unused) variable.
2011-08-09 23:45:34 +02:00
Christophe CURIS
e01d14abe4 Fix possible missing NUL at end of string
There are were a few uses of 'strncpy' that could lead to a missing NUL,
resulting in possible garbage being displayed. As suggested by Tamas,
use 'wstrlcpy' instead
2011-08-08 19:11:22 +02:00
Carlos R. Mafra
e499f31a4e Remove Netscape icon 2011-08-08 19:11:22 +02:00
Carlos R. Mafra
8fe18de926 Use wmgenmenu to create WMRootMenu during installation
Instead of using _old_ and hard-coded predefined menus as the
source for the user's WMRootMenu during installation, generate
the menu automatically using wmgenmenu.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-08-08 19:11:22 +02:00
Carlos R. Mafra
e95f886e06 util: Fix wmagnify
wmagnify stopped working after f65b99e615 ("Remove warnings").
So revert that change in util/wmagnify.c, as it turns out that the
gcc warning was bogus there.
2011-08-01 22:40:55 +02:00
Christophe CURIS
6c2a5f19f1 Added mailing list address in the parfect-patch file
This may ease Carlos' work slightly when dealing with people like me that could not find it and thus submitting the patch directly to him, the only address found
2011-07-20 10:42:19 +02:00
Carlos R. Mafra
c126f1d08f Fix make-gzip 2011-06-29 18:35:40 +02:00
Tamas TEVESZ
dce16306bc Plug some (possible) memleaks
PropGetWMClass()

- XAllocClassHint()s a struct for class hint data
- This is filled by XGetClassHint(), which in turn uses Xlib to allocate
  some more space for XClassHint members
- Upon XGetClassHint() failure, "default" is libc malloc'd (via strdup),
  and is returned to the caller
- Upon XGetClassHint() success, XClassHint members are returned raw --
  these members must be freed with XFree() (see XAllocClassHint(3))
- Thus it's up to PropGetWMClass() callers to decide (based upon the return
  value) which method (libc free() or XFree()) to use to free res_name
  and res_class. This was done nowhere, thus leaking some memory
  on every failed PropGetWMClass() call.
- So just strdup the successful res_name/res_class members, XFree() them
  while still in PropGetWMClass(), and allow callers to unconditionally
  libc free() whatever PropGetWMClass() returns.
2011-04-18 13:25:44 -07:00
Tamas TEVESZ
f6fefbd9b6 Partial fix for focus stealing
By turning M'bert's d6c134 around a bit and adapting the surroundings,
allow _NET_ACTIVE_WINDOW only if fulfilling it doesn't cause annoying
unwanted changes in the workspace. This is now the default behaviour;
unconditional focus stealing can be enabled on a per-client basis in the
Advanced Options window menu ("Focus across workspaces").
2011-04-18 13:23:22 -07:00
Tamas TEVESZ
5fa8b979b9 Amend recent wmgenmenu changes
Raise MAX_NR_APPS to account for the more menu entries
2011-04-10 22:13:29 -07:00
Tamas TEVESZ
af857e8b95 Fix app behaviour on Xinerama displays
With Xinerama, on heads other than the primary, certain parts (menus,
scrollbars) of certain types of clients (Qt) are incorrectly or not at
all drawn.

The fix follows other window managers in completely ignoring the
_NET_WORKAREA property.

Problem originally poked at by Ambrus Szabo, correct keyword and the
eventually implemented solution suggested by Lucius Windschuh, typed
up by me.
2011-04-10 22:10:13 -07:00
Christoph Soehngen
cbbc1fc9ac wmgenmenu: Update German translation 2011-04-09 14:47:58 -07:00
Christoph Soehngen
18de6b8c96 wmgenmenu: Add more apps 2011-04-09 14:40:03 -07:00
Ambrus Szabo
7490b14bf0 Bugfix: java menu problem after resize, maximize
From the original report by Tamas Teves:

   "i'm having (and have, for a long time) problems with openoffice and
   java-based (perhaps only netbeans-based?) apps.

   for openoffice, any menu opens in the far right edge (with xinerama,
   on the far right edge of the rightmost display) of the display. it
   then can be clicked and operated corretly where it appears.

   as for netbeans (and jswat, which also uses netbeans platform as a
   base), it's a bit more complicated, but let me try to describe. start
   netbeans so that it is not maximized and not in the upper left of the
   display. it works fine. move it around, still works fine, resize,
   still works fine. now if i maximize it (not by moving to the upper
   left corner and resizing, but by the maximize shortcut), then the
   menus start acting weird. it seems that the actual position of the
   mouse pointer and the hot spot of the mouse pointer get "out of sync"
   so to speak, as if the hot spot stayed where the window was before
   maximization.

   i've made a capture which hopefully better shows what i'm trying to
   say. this is a netbeans window maximized, while i'm trying to click
   tools->options. the left mouse button must always be held down, or
   else it instantly loses any interaction with the menus (in the capture
   i released it once when i completely lost track of where i might be).

   the capture is available at http://dawn.dev.hu/~ice/tmp/wmjava.avi

   i'm not sure whether java stuff other than those based on netbeans
   platform exhibit this behaviour. i've seen this with at least one
   other nb platform stuff as well."

The fix is to call wWindowSynthConfigureNotify() after wWindowConfigure()
2011-04-09 10:32:12 -07:00
Ambrus Szabo
a750fe03f4 opaque resize
WPrefs:
 WindowHandling page: Mouse opaque resize
 Expert page: Opaque move and resize with keyboard
2011-03-30 23:32:37 +02:00
Ambrus Szabo
8fd4821155 Fix makefiles bug.
FreeBSD make vs gmake
in FreeBSD: $(dir $<@) => ''
in gmake: $(dir $<@) => './'
2011-03-27 10:47:40 +02:00
Tamas TEVESZ
f65b99e615 Remove warnings
* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
2011-03-24 16:19:52 +01:00
Tamas TEVESZ
43c7abe79f Adapt for libpng changes 2011-03-24 16:19:37 +01:00
Szabó Ambrus
7feb59251e Fix compilation in FreeBSD
In FreeBSD make doesn`t work, only gmake.
2011-03-15 00:27:01 +01:00
Haroldo Santos
c82138eab9 switchpanel: Add skip_switchpanel advanced option
Some applications running in my machine are only background
windows, e.g.: screenlets showing CPU usage.

In current wmaker version all these applications pollute my
switchpanel, so I wrote this patch (thanks Carlos for the helping me).

It includes an additional advanced option for windows "Do not
include in switchpanel" which, if set, allows applications to
not appear in the switchpanel.

Signed-off-by: Haroldo Santos <haroldo.santos@gmail.com>
2011-02-17 19:29:15 +01:00
Camille d'Alméras
077a2eaa71 wmgenmenu: Add French and Spanish translations
[crm: edits in configure.ac and Makefile.am]
Signed-off-by: Camille d'Alméras <camilledalmeras@yahoo.com>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-02-13 18:08:46 +01:00
Carlos R. Mafra
751b6e7938 WPrefs: Update ballon text for "Window Focus Preferences"
Thanks to Camille d'Alméras for pointing it out.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-01-31 12:25:20 +01:00
Carlos R. Mafra
bbaa42240f WPrefs: Update po/Makefile.am to reflect file deletion
Otherwise 'make WPrefs.pot' inside WPrefs.app/po fails.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-01-31 12:10:24 +01:00
Carlos R. Mafra
7036890288 wmgenmenu: Add more apps
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2011-01-31 10:52:07 +01:00
Andrea Gelmini
7c14c0b14a Remove duplicated #includes 2010-11-29 11:59:22 +01:00
Brad Jorsch
85f31104cd Display modifiers in window menu
The window menu displays the shortcut key for operations with a
shortcut, but does not display the modifiers. This reduces the utility
of the display as it's hard to know whether "h" means "Mod4+h" or
"Ctrl+Mod4+h" or something else.

This patch prefixes those shortcut displays with the modifier names,
e.g. Ctrl+Mod4+h, and adds a preference ModifierKeyLabels to allow
overriding this, e.g. to "⌃◇h". It doesn't add this preference to
WPrefs, if someone else wants to do that feel free.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-11-17 02:53:04 +01:00
Andreas Metzler
1b2745fad8 Update documentation of ABI/API changes again.
Update documentation of ABI/API changes in NEWS files (up to date GIT
next as of 2010-10-30).
2010-11-01 09:35:29 +01:00
Brad Jorsch
5ff0272508 Fix pkgdatadir
The previous patch "Fix path substitutions" accidentally caused autoconf
to overwrite automake's pkgdatadir. Since configure.ac does absolutely
nothing interesting with pkgdatadir anyway, just remove it completely.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-18 10:26:16 +02:00
Andreas Metzler
1060f49366 pkgconfig - minimize direct linking
Use Libs.private to avoid unnecesary direct linking.

Signed-off-by: Andreas Metzler <ametzler@downhill.at.eu.org>
2010-10-18 10:25:49 +02:00
Andreas Metzler
614eb4c9e8 Simplify/fix pkgconfig installation
Patch "Fix path substitutions" moved generation of pkgconfig files from
./configure to Makefiles. However the generation is not triggered since
the pkgconfig files are not listed as dependency. Fix by conversion to a
straightforward automake rule.

Acked-by: Brad Jorsch <anomie@users.sourceforge.net>
Signed-off-by: Andreas Metzler <ametzler@downhill.at.eu.org>
2010-10-18 10:24:45 +02:00
Brad Jorsch
76eab97209 Don't save app settings proplist when nothing changed
Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-12 23:34:28 +02:00
Tamas TEVESZ
b5ed9841bc WINGs: Add wshellquote()
Transforms its argument so that the result is safe to pass to the shell
as an argument.

With very heavy inspirations from NetBSD's shquote(3),
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/gen/shquote.c?annotate
http://man.netbsd.org/cgi-bin/man-cgi?shquote

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-12 23:24:45 +02:00
Brad Jorsch
3f8bba8064 Reset bouncing app icon position when bounce ends
If the app is destroyed before the bounce finishes, the icon may be left
out of position. Fix that by explicitly resetting the position when the
bounce is complete for whatever reason, not just when the bounce ends
normally.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-12 15:46:42 +02:00
Tamas TEVESZ
4f853ce3b6 wmmenugen: Finish the XDG parser
Recognize the freedesktop.org-mandated Main Categories in .desktop files
and put menu entries in the appropriate categories.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-10 19:38:14 +02:00
Tamas TEVESZ
a23b72c32a wmmenugen: Add file name validator function
Add optional interface parsers may choose to implement that, when
a directory is being scanned for files to parse, may, based on
the file name, decide whether or not said file should be parsed.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-10 19:36:34 +02:00
Tamas TEVESZ
5377ec8fba wmmenugen: Add executable detection, make Wmconfig use it
Add fileInPath, which determines whether or not a given file exists
in $PATH (some heuristics apply).

Make the Wconfig parser use it.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-10 19:34:45 +02:00
Tamas TEVESZ
0451160f7d wmmenugen: Finish Wmconfig parser, touch up PropList writer
As far as i can tell this finishes the Wmconfig parser (all bits we are
interested in/can use are parsed and converted).

The PropList writer gained ability to properly react to and handle various
flags passed by parsers.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-10 10:04:32 +02:00
Brad Jorsch
a396f3bd66 Only cache pixmaps for docked icons
There is little point caching a pixmap for an app that isn't in the
dock. This patch creates a function wAppIconSave that saves only if the
app icon is docked, and adds calls to that function in all the places
where an appicon can transition from undocked to docked.

It also "adds" a function wApplicationSaveIconPathFor that saves an icon
path to the configuration plist; the function already existed, it was
just static before.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:03:31 +02:00
Brad Jorsch
125cba8f82 Paint app icons when updated
Add calls to wAppIconPaint when wIconUpdate is called on the app icon.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:03:31 +02:00
Brad Jorsch
ee1f13da45 Fix wIconUpdate logic
This patch changes the logic for choosing the icon, and gets rid of
wIconChangeImage in favor of wIconChangeImageFile.

Old logic:
* On create, load either NET_WM_ICON or the file from disk.
* On update, choose (in order):
  1. WM_HINTS icon_window
  2. WM_HINTS icon_pixmap
  3. Whatever was loaded on creation, unless wIconChangeImage or
	 wIconChangeImageFile was called.
  4. Default icon.

New logic:
* On update, choose (in order):
  1. WM_HINTS icon_window
  2. NET_WM_ICON
  3. WM_HINTS icon_pixmap
  4. Icon file from disk.
  5. Default icon.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:00:24 +02:00
Brad Jorsch
7aff3b6e44 Fix handling of NET_WM_ICON
NET_WM_ICON is a property change, not a message.

updateIconImage doesn't use scr, remove it.

updateIconImage should clear out the net_icon_image if there isn't one
anymore (i.e. XGetWindowProperty fails or the icon cannot be extracted).

When the icon is changed, we need to call wIconUpdate.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:00:23 +02:00
Brad Jorsch
5eebb8bc3c Fix some warnings
Non-obvious fixes:

WINGs/wfilepanel.c: Cast to void to avoid an unused calculated value
warning.

WINGs/wtabview.c: Test tab<0 to avoid a warning from the next condition
about signed overflow in an inlined invocation of the function.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-08 22:00:23 +02:00
Alexey I. Froloff
51134d2438 wmaker.inst: quote shell variables
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-10-08 18:13:56 +02:00
Alexey I. Froloff
ba5fceb21c wmaker.inst: better locale check
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
3c408fa179 Update local copy of GPLv2 and FSF address in copyrights
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
8b68042b30 Add wmmenugen, an extensible PropList-format menu generator
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 18:13:56 +02:00
Tamas TEVESZ
210bcec4de WINGs: tree enhancements
- add WMFindInTreeWithDepthLimit, which is like WMFindInTree, but
  does not descend down more than a set limit.

- add WMTreeWalk, which will walk a WMTreeNode, running a callback
  function on each node.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 00:11:44 +02:00
Tamas TEVESZ
9a2732a4c3 Add back WINGs/tree.c that was removed in c9d0c7c
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-08 00:11:36 +02:00
Brad Jorsch
668cac00f6 Cleanup .gitignore
Remove some obsolete entries, add some needed new ones, and sort the
thing.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Adam Hoka
7cc64627cc WINGs: fts() -> nftw() in wrmdirhier()
Plus reorganize headers a bit.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Brad Jorsch
b16181143c Fix stuck appicon from embedded apps
When applications are embedded in firefox via mozplugger, e.g. ooffice
for viewing .doc files or xpdf for viewing pdfs, and the embedded
application opens a popup window, we end up with a shared appicon for
the embedded app that remains until Window Maker is restarted.

The underlying cause is that mozplugger winds up reparenting the
embedded app's original leader window to a subwindow of itself, so
wmaker's SubstructureNotifyMask on the root window no longer picks up
the DestroyNotify when that original leader is destroyed.

It seems easy to fix once you track down the problem: when fixing
several other properties in fixLeaderProperties(), add
StructureNotifyMask so we get DestroyNotify no matter where the leader
gets reparented to. A more targeted fix would only add
StructureNotifyMask when the fake group's origLeader is set, but I don't
think a few extra structure notifications are going to cause us any real
problems.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
4b894021d9 Missed a piece in tree.c removal
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Andreas Metzler
cdf457d2d5 Document ABI/API changes
Document ABI/API changes in NEWS files (up to date GIT next as of
2010-10-02)
2010-10-07 12:04:31 +02:00
Brad Jorsch
3490c8bd30 Minor fixes to appicon highlighting
When an app hides its window but doesn't exit (e.g. apps that "minimize"
to the system tray), the highlighting was not being removed.

When alt-tabbing, the tabbed-to app's icon was not getting highlighted.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
70abda81d0 Make OPEN_MENU be able to include PropList menus
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Brad Jorsch
c37046e6a9 Fix wusleep
struct timespec's tm_nsec is in nanoseconds, not microseconds.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Carlos R. Mafra
09e6fd1526 Remove translations of INSTALL-WMAKER, README and FAQ.I18N
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:31 +02:00
Brad Jorsch
060ba6a9cd Fix path substitutions
Autoconf uses multiple levels of variables when defining paths. For
example, ${datadir} by default is ${datarootdir}, which by default is
${prefix}/share, which by default is /usr/local. Substituting from
./configure, as is done by AC_DEFINE or AC_DEFINE_UNQUOTED, does not
expand all these variables. This was causing some of our defines to have
garbage like "${prefix}/share/pixmaps" rather than the intended
"/usr/local/share/pixmaps".

The solution is to generate the files needing these paths from the
Makefile rather than from ./configure, because make does fully expand
all those levels.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Brad Jorsch
f6080ffd56 Fix "make dist"
Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
ffda48bd61 Add LCOV support to generate coverage information
How to use:

- Install LCOV (http://ltp.sourceforge.net/coverage/lcov.php)
- AFAICT, compiler must be GCC.
- ./configure --prefix=/some/path --enable-lcov=/var/www

  This will configure the sources so that generated coverage information
  (HTML pages) will end up in /var/www/coverage-report. Choose a directory
  you have write access to.

- make

  No installation necessary (although it probably doesn't hurt to have
  WM installed in ${prefix} so it can find resources and stuff, but the
  build tree must be kept intact anyway).

- Put ${srcroot}/src, ${srcroot}/WPrefs.app and ${srcroot}/util first in
  your path.
- Arrange for your .xinitrc or DM to start ${srcroot}/src/wmaker as your
  window manager.
- Use it as you normally would, possibly for an extended period of time.
- make coverage.

  This will create a tree of web pages under /var/www/coverage-report

- Further `make coverage's (after some more use) will re-generate the
  report (deleting the directory first).

- `make coverage-reset' will reset execution counts to zero (see lcov(1)).

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
7859e2d59f Silence a few warnings
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
14863cd3b1 WINGs: Bounded string ops
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
300d02bf54 WINGs: Remove #ifdef OLD_CODE
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
1420e44bb1 WINGs: Modernize wusleep()
- Change the wusleep abomination to be a simple wrapper around
  nanosleep (man says it's been POSIX for almost a decade)
- Remove autoconf tests that became unnecessary along the way

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:31 +02:00
Tamas TEVESZ
de9fcef214 WPrefs: Remove dead code
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
843dc889f4 WINGs: Reorg headers to mark items' locations in source files
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
b4cb488241 WINGs: Remove wprogressindicator and tree
Neither of them used (not by wdm either)

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
d8eea6a155 WINGs: Dead code removal
- on_exit is nowhere to be found in recent written history
- so there haven't for long been a system with !HAVE_ATEXIT
- so there is no need for either #ifdef HAVE_ATEXITs or configure
  checks for atexit

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Brad Jorsch
b305eb84fb Ignore shared_appicon if an appicon already exists
An appicon is created for each group of windows, as specified by the
WM_HINTS window_group or the WM_CLIENT_LEADER. The "shared_appicon"
feature ignores the group leader specified by the application, replacing
it with a dummy leader matching the window's WM_CLASS. This causes
issues for dockapps, since each instance of a dockapp needs its own
appicon to display the different icon_windows, so shared_appicon is
automatically disabled for dockapp windows.

If the application creates some dockapp windows (no shared_appicon) and
some regular windows (with shared_appicon) with the same leader, it can
unexpectedly end up with two different appicons: one for the real group
leader it set and one for the fake leader created for shared_appicons.
Both of these appicons will try to use the same icon_window, which may
cause the dockapp window to suddenly lose its contents as they are moved
to the fake leader's appicon.

There is a simple fix: if a WApplication already exists (and has an
appicon) for the app-specified group leader window, disable
shared_appicon.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:30 +02:00
Andreas Metzler
88c6a51547 Rename libwutil1 to libwutil2
Rename debian packages following libwutil soname bump.
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
d59dacbccd Repair wgethomedir(), broken a little while back
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
f4890b17e6 WINGs: Remove wruler and wtext
Apparently not used (not by wdm either).

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
660b61a182 WINGs: Do not look static information up every time
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
752d084609 WINGs: Plug potential segfault
...following up on d65cb5a ("Preparing to do exactly as FIXME says").

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
94a0c7b42f Fix some double newlines
Just a couple that woud now print double (or several more) newlines.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
8594c39a0b WINGs: Make w*() print message origins
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
34293e072a Preparing to do exactly as FIXME says
However, knowing about those functions is quite a prerequisite.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
1f21919809 Remove wsyserrorwithcode, rename wsyserror to werror
wsyserrorwithcode - Not used, no point either.
wsyserror->werror - qualifying "error" with a "type" hardly makes
sense if there are not at least two "type"s. There are not. Safe trip.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Tamas TEVESZ
c5f5e0b9c0 More precise information on unknown systems
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:30 +02:00
Andreas Metzler
24d7457ec6 Document ABI and API changes
List ABI and API changes in the respective NEWS files.
2010-10-07 12:04:30 +02:00
Andreas Metzler
4de3d69934 Fix typo enviroment
s/enviroment/environment/ both in the .c file and in all .po files that
already contain a translation for the string. The latter prevents
wrongly marking the translation as fuzzy.
2010-10-07 12:04:30 +02:00
Andreas Metzler
be8a5d4a45 Do not mark product names as translatable
There is no point in trying to translate trademarks/product names like
Window Maker or OpenSUSE, stop marking these strings as translatable.
2010-10-07 12:04:29 +02:00
Andreas Metzler
ff6a6ebbaa Build-Depend on automake 1.11 or later.
Reflect versioned automake build requirement in Debian's Build-Depends.
2010-10-07 12:04:29 +02:00
Andreas Metzler
219e7fcafa Add function declaration for wIconSetHighlited
The expansion of the macro wApplication{Dea,A}ctivate triggers an
implicit declaration warning for wIconSetHighlited. Add function
declararion to fix this.
2010-10-07 12:04:29 +02:00
Brad Jorsch
f38aa69e40 Clean up library linking
On the one hand, libWINGs wasn't linking against -lX11 when it should
have been. And on the other, only libWINGs needs Xft, only wmaker needs
Xrandr, only wmaker and wmsetbg need Xinerama, only libwraster needs
Xmu, and -lpng may not need -lz.

Cleaning this up can help distributions get their dependencies correct,
and might even avoid loading the unused libraries at runtime, so we may
as well do it.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:29 +02:00
Brad Jorsch
8ca05fd4be Use -lbsd for strlcat/strlcpy, if needed and available
On BSD systems, strlcat and strlcpy are included in the C library and
nothing special is needed. On Linux systems they are not, but libbsd may
be available to provide them. Use it if so.

This also adds wstrlcat and wstrlcpy instead of trying to maybe-provide
strlcat and strlcpy themselves, as that way there is no risk of symbol
conflicts. Not bumping the library version at this time, that should be
done (if necessary) before release.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
f206c15fea Repair defaults for new titlebar button style
Originally missed in 17cc7c3c

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
4478f21b7f WINGs: Less ad-hoc approach for __wmessage()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
d2853c8584 WINGs: Add detection and local copy for strlcat()/strlcpy()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
51236308d2 WINGs: Small assorted formatting changes
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
02de600ecd WINGs: Simplify and rationalize createDir() and deleteFile()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
a8813b2eae WINGs: Add normalizePath()
Removes multiple consecutive and any trailing slashes from
a path-looking string

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
0d32a6d3b7 WINGs: Simplify WMPathForResourceOfType()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
553464d965 WINGs: Return NULL on NULL input in checkFile()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
a71a604ab1 WINGs: Make wmalloc() intialize allocated memory to 0
- Accordingly remove individual memsets, for now from WINGs only.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Carlos R. Mafra
cf2301a048 Remove assembly/optimized code
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:29 +02:00
Carlos R. Mafra
ce9b375b8d configure: Do not warn about unused parameters
Now my 'make V=0' compilation can be used to spot
new/relevant warnings.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
b8f118e9a5 Remove obsolete --with-xft from debian/rules
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
ae8937e152 Fix some off-by-ones
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
091c9c366d Reduce noise in WUtil
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
3c847aa52b Kill wstrerror
As far as i can tell, all current targets have strerror().

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:29 +02:00
Tamas TEVESZ
758f4c80d1 Ungeneralize wrlib DEBUG
Plus debug messages belong on stderr.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
b4b07c2cac Kill BENCH
Nice idea, x86 assembly is so 1980s.

tests/testgrad.c could probably have been saved, but seriously, who's
going to miss it?

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
4a9d561ce4 Repair TEST_WITH_GC
The comment in WINGs/memory.c:wfree() pretty much explains the current
situation. There's an incredible amount of mixing the wmalloc/wfree
wrappers with native mallocs/frees on the other side, and a good several
cases of misusing external libraries' APIs. Until this is thoroughly
cleaned, WM with --enable-boehm-gc will hardly even start.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
2bc0c1124a Pretty-print for string2index
Turns unhelpful
wmaker: warning: wrong option value for key "NewStyle". Should be one of new, old, next
into helpful
wmaker: warning: wrong option value for key "NewStyle". Got "YES", should be one of "new", "old", "next"

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Brad Jorsch
6483b198d3 Documentation cleanups for --with-gnustepdir
Quite a bit of documentation still mentioned --with-appspath. Fix that.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:28 +02:00
Brad Jorsch
b042d2be8e Fix --with-gnustepdir
Commit acc868d91d tried to change
--with-appspath to --with-gnustepdir, but either it wasn't done
correctly (and no one noticed) or old versions of AC_ARG_WITH worked
completely differently (and in an extremely odd way) because the option
remained --with-appspath and just the help text was changed. Then commit
bde572f673, which claims to have been
fixing some sort of issue with path assignment, broke it completely (i
guess) because the author there trusted the help text.

This completes the change from commit
acc868d91d that makes the option really be
--with-gnustepdir.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:28 +02:00
Carlos R. Mafra
80814b7dba XRandR temporary amendments
If we Restart() directly, the windows with titlebars come back N pixels
below their original positions before the xrandr-induced restart, where
N is the titlebar height.

To avoid this issue, let's do the proper restart preparation before
actually calling Restart().

Let's also grab ConfigureNotify in the event loop as in the patch
here: http://lists.kde.org/?l=kwin&m=116429907520188&w=2
(thanks to Tamas for pointing it out).

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
e7f3e62d69 Fix typo in wApplicationExtractDirPackIcon()
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Carlos R. Mafra
e10e7d08fa WPrefs: Replace Netscape and Acrobat Reader menu entries
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 12:04:28 +02:00
Brad Jorsch
844bf1b4e3 Fix compilation with LDFLAGS=-Wl,--no-add-needed
If you link against a library A that itself links against a library B,
it may or may not work to use symbols from library B in your executable;
this is known as "indirect linking". GNU ld does indirect linking by
default (but it can be disabled using --no-add-needed), but the new
experimental GNU gold linker does not do this. It's an easy fix for us,
as the tests are all already done in ./configure, we just need to tell
the Makefile.ams to use the results.

This should fix Debian bug #556677, if they ever start using this
branch.

[crmafra: Folded Andreas Metzler patch to update debian/changelog]

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
7374fe5984 Remove local strcasecmp implementation
Remove local strcasecmp implementation; whatever system doesn't have it
is off the table for now.

memcmp is used by WINGs; add autoconf check

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
e18eba6ae7 CommitStackingForWindow prototype
add CommitStackingForWindow() prototype to superfluous.c
Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Tamas TEVESZ
35ed80648b Prevent a WPrefs segfault
Prevent WPrefs (menu panel) segfaulting upon coming by an invalid command in
the root menu.

Reported and first patch version by Bento Loewenstein.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
2010-10-07 12:04:28 +02:00
Carlos R. Mafra
09c56140a2 configure: Disable XRandR by default
Some people using nvidia and/or playing some games (e.g. Einstein)
are reporting some issues with the restart induced by the
resolution changing. Let's disable it by default.
People without nvidia cards etc can still enable it with
--enable-xrandr.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2010-10-07 11:54:15 +02:00
Brad Jorsch
ece6d213aa Option to raise bouncing appicons
If the appicon is not in the dock/clip, or the dock/clip is not set to
"Keep on Top", there's a good chance you won't actually see the bouncing
because some other window is covering the appicon.

Besides adding the option to raise bouncing windows, this patch adds a
utility method to move a window back into its correct stacking position
after it has been messed with using XRaiseWindow.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-09-17 22:40:42 +02:00
Brad Jorsch
5b24997446 Add a preference for XUrgencyHint bouncing
Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
2010-09-17 22:40:42 +02:00
Brad Jorsch
8f63bdafcd Periodic bouncing for XUrgencyHint
When a window has XUrgencyHint set, bounce the app icon periodically.
2010-09-17 11:05:51 +02:00
Alexey I. Froloff
8e0ef4766d Drop BOUNCE_APP #ifdef's
Since bouncing respects DisableAnimations option, there's no need
in #ifdef's.

Acked-by: Carlos R. Mafra <crmafra@gmail.com>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-17 10:18:35 +02:00
Brad Jorsch
1194889c95 Fix bounce direction of docked appicons
I have my dock on the right edge of the screen, and my clip right next
to it. So the first icon underneath the clip is 64 pixels from the top
and 64 from the right. It seems silly for it to bounce downwards instead
of sideways like every other icon under the clip.

So make the choice of vertical or horizontal for docked icons be
relative to the dock or clip rather than absolute screen position.
Left/right or up/down is still chosen by screen position, as are
situations where the icon is a chess bishop's move from the clip.
2010-09-17 10:16:19 +02:00
Brad Jorsch
ee69b6207a Make bouncing respect DisableAnimations 2010-09-17 10:16:19 +02:00
Brad Jorsch
5afe745c01 Automake dependency tracking
I just spent an hour trying to find out why the latest wmaker-crm was
ignoring a number of the preferences in my configuration file. It turns
out the problem was that commit f41db5 added a value into the middle of
the enum in src/keybind.h, and the setting of
AUTOMAKE_OPTIONS = no-dependencies in all the Makefile.ams meant that
make wasn't smart enough to rebuild the files depending on it.

Would anyone mind if we just remove no-dependencies from
AUTOMAKE_OPTIONS? People can still run ./configure with
--disable-dependency-tracking to disable it at configure time.
2010-09-15 20:37:48 +02:00
Brad Jorsch
9318a7f428 Improve dockapp recognition
On Wed, Sep 15, 2010 at 04:40:52PM +0200, Gilbert wrote:
>
> "." = {NoAppIcon = Yes;};
>   "*" = {NoAppIcon = Yes;};

Oh, I see. It lets you override NoAppIcon generically instead of for
each app.

> Exactly, having 'DockApp' as the class name makes them behave more
> consistently internally. This might be fixed in some other way
> internally, but I couldn't figure it out...

Except it doesn't, the only thing it changes inside wmaker is that it
avoids displaying the name as "DockApp" on the settings window.

A "dockapp" is just an application that sets icon_window in WM_HINTS
(which causes a window to be displayed as the app icon) and
initial_state to WithdrawnState (which causes the main window to not
actually appear when the window is mapped). The class has nothing to do
with it.

The problems I mentioned stem from gtk+ not allowing you to set
initial_state to WithdrawnState. Openbox and fluxbox (and maybe others)
don't take the icon_window into their "slit" unless initial_state is
WithdrawnState, so the whole thing completely fails. Wmaker always uses
the icon_window for the app icon, so that part works fine, but the
"main" app window still flashes onscreen for a split second before the
app can call gdk_window_withdraw(), and wmaker applies SharedAppIcon to
it which winds up screwing up the "Kill" menu option.

That said, I've attached a patch to have wmaker treat any window with
class DockApp as if it had initial_state = WithdrawnState, and hopefully
openbox, fluxbox, and the like will pick up the idea too so gtk+
hacks[1] will no longer be needed. If this patch is accpeted, I'll poke
fluxbox and openbox to suggest the idea to them.

[1] E.g. http://wmudmount.svn.sourceforge.net/viewvc/wmudmount/dock.c?r1=8&r2=7

Subject: [PATCH] Improve dockapp recognition

Dockapps are traditionally recognized by having initial_state =
WithdrawnState in WM_HINTS. But some toolkits (e.g. gtk+) will not allow
setting initial_state in this way. So we offer an alternative: any
window with the res_class portion of WM_CLASS set as "DockApp" will be
treated as if it had initial_state = WithdrawnState.
2010-09-15 20:36:46 +02:00
Carlos R. Mafra
2ba8d2eec9 WPrefs: Add ShowClipTitle config option
To "document" the new configuration option, let's make
it possible to configure it in the "Expert Panel" of
WPrefs.
2010-09-12 22:59:55 +02:00
Alexey I. Froloff
790917a8e7 Option to disable clip title
Completely disable clip caption.

Original-patch-by: Alexey Voinov <voins@altlinux.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-12 15:21:05 +02:00
Carlos R. Mafra
8d4819c7ea wconfig: Define BOUNCE_APP and NEWAPPICON 2010-09-11 17:58:18 +02:00
Alexey I. Froloff
392ab2607d Highlite current window's appicon
This patch highlites appicon of a currently focused window.

Original-patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 17:56:40 +02:00
Alexey I. Froloff
a257e16593 Bouncing appicon effect
When starting application (or opening transient dialog) bounce
its appicon.

Original-patch-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 17:53:32 +02:00
Alexey I. Froloff
17cc7c3c77 New titlebar button style
This patch adds new titlebar button style.

Original-patch-by: Carlos Torres <vlaadbrain@operamail.com>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 17:32:57 +02:00
Alexey I. Froloff
cc629f342c Open window menu on right-click in window list menu
When doing right-click in a window list menu open window menu.
Can be useful for sending here window from another workspace.

Original-patch-by: Pavel S. Khmelinsky <hmepas@yauza.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 17:32:57 +02:00
Carlos R. Mafra
afebdb50fa WPrefs: Add MinimizeAllKey shortcut configuration 2010-09-11 17:32:57 +02:00
Alexey I. Froloff
f41db5b5be Add key binding to minimize all windows
MinimizeAllKey - minimize all windows on current workspace.

Original-patch-by: Pavel S. Khmelinsky <hmepas@yauza.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>

[crmafra: AllMinimizeKey --> MinimizeAllKey]
2010-09-11 15:46:24 +02:00
Alexey I. Froloff
ca1c29cd98 Menu translation support
When generating menus, lookup translations for menu entries in
specified textdomain.  Often used by linux distributions.

Original-patch-by: Alexey Voinov <voins@altlinux.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 15:28:01 +02:00
Alexey I. Froloff
e9d42e5121 Luxi Sans doesn't have cyrillic
Replace "Luxi Sans" with "sans serif".

Original-patch-by: Alexey Voinov <voins@altlinux.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 15:18:07 +02:00
Alexey I. Froloff
aeb4cb8a79 Raise shaded window frame when unhiding
When unhiding window by clicking its appicon, unconditionaly
raise its frame.

Original-patch-by: Artem Delendik <u2u@nm.ru>
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
2010-09-11 15:15:43 +02:00
Andreas Metzler
bfd1abd32b Move debugging symbols to new wmaker-dbg package
Debian packaging change. Strip binaries (as required by policy) and
provide detached debugging symbols in newly added wmaker-dbg package.
2010-09-05 02:27:52 +02:00
Andreas Metzler
7e5b8e412f Add version script versioning for libwraster
Enable symbol-versioning for libwraster and stop exporting public
symbols.
2010-08-29 18:38:21 +02:00
Andreas Metzler
44edeea804 Import ld-version-script.m4 from gnulib
ld-version-script.m4 provides a test to check whether binutils support
symbol versioning.
2010-08-29 18:38:21 +02:00
Andreas Metzler
d872b73881 Set library version in configure.ac
Keep libtool's -version-info arguments for the three libraries
(libwraster, libWINGs and libWUtil) centralized in configure.ac
instead of in the specific Makefile.am.
2010-08-29 18:38:21 +02:00
Andreas Metzler
27dcdd3798 Pass tarname argument to AC_INIT
If AC_INIT is invoked without tarname argument PACKAGE_TARNAME and
PACKAGE will be sanitized (lowercased, and all characters other than
alphanumerics and underscores are changed to ‘-’.)

For windowmaker this has the sideeffect of changing install directories,
util/wmaker.inst installs stuff to #pkgdatadir# which suddenly is
/usr/share/windowmaker instead of /usr/share/WindowMaker.

Supplement AC_INIT invokation with tarname (and while we are at it url)
argument to fix this.
2010-08-29 14:55:14 +02:00
Andreas Metzler
ce04eabec6 Build Debian packages with RandR support
Add libxrandr-dev to build-depends.
2010-08-29 14:55:14 +02:00
Carlos R. Mafra
368e7e3e8f WINGs: Remove private snprintf() implementation
The code was added in 2001 in commit acdc0e3d6b for
"backwards compat". This motivation no longer exists in 2010,
so there is no reason to keep a private implementation of
a standard function from the C library.
2010-08-29 14:55:14 +02:00
Carlos R. Mafra
5c8eb580b3 configure: Remove --disable-verbose-compile hack
Instead of using the --disable-verbose-compile hack, let's
use the standard option --enable-silent-rules (or 'make V=0' directly)
available with autoconf 1.11 and higher.

This is enabled in autoconf by using 'silent-rules' in AM_INIT_AUTOMAKE.
The verbosity of compilation is reduced in a similar manner as using
the --disable-verbose-compile option, so we can remove all that ugly
hackery.
2010-08-29 14:55:14 +02:00
Carlos R. Mafra
48044feb29 configure: Remove gcc warning about signed x unsigned 2010-08-29 14:55:14 +02:00
Carlos R. Mafra
2031a25869 configure: Replace obsolete macros 2010-08-29 14:55:14 +02:00
Carlos R. Mafra
be05b0f01e configure: Use AS_HELP_STRING macro to print messages
According to the autoconf manual, using AS_HELP_STRING is recommended
to avoid having to manually adjust the alignment of help text
in ./configure --help
2010-08-29 14:55:14 +02:00
Carlos R. Mafra
b17077ede0 Avoid more gcc warnings
WUtil.h:212: warning: function declaration isn’t a prototype
WUtil.h:259: warning: function declaration isn’t a prototype
WUtil.h:300: warning: function declaration isn’t a prototype
WINGsP.h:593: warning: function declaration isn’t a prototype
WINGsP.h:599: warning: function declaration isn’t a prototype
WINGs.h:616: warning: function declaration isn’t a prototype

raster.c:295: warning: no previous prototype for ‘calculateCombineArea’
2010-08-29 14:55:14 +02:00
Carlos R. Mafra
be065e3bf4 Add /usr/local/share/WindowMaker dir to wmgenmenu 2010-08-29 14:55:14 +02:00
Andreas Metzler
894bf4e292 Fix build failure on missing randr
When building without xrandr support do not try to modify undefined
variable has_randr.
2010-08-29 14:55:13 +02:00
Carlos R. Mafra
c201e1612c Make wmaker XRandR aware
This patch makes wmaker automatically Restart() to take into account
resolution changes done by xrandr.

The motivation to write this patch is that when I start my laptop connected
to an external monitor (VGA1), the resolution in the monitor is initially
wrong (perhaps this is a bug in XOrg or OpenSuse, but anyway), so I always
do this after starting wmaker:

xrandr --output VGA1 --preferred

The resolution in the external monitor gets fixed, but wmaker does not
recognize the change automatically and I have to manually restart it.

So this patch avoids the last step by making wmaker be XRandR-aware.
Wmaker now restarts automatically when it receives a RRChangeScreenNotify
event and I don't have to do the last part of the silly procedure described
above.

I am not sure if restarting wmaker is the most elegant solution, but
it at least solves part of my issue with wmaker + xrandr.
2010-08-22 22:13:45 +02:00
Andreas Metzler
f6b7178542 Correct .TH header
The space in "Window Maker" needs to be escaped in the .TH header,
otherwise parsing fails. (The section would be set to MAKER instead of
1x.)
2010-08-21 12:21:56 +02:00
NIR Ginko
ce32e2b5e0 Add Russian manpages
[includes build fixes by Andreas Metzler]
2010-08-21 12:21:56 +02:00
Martin Dietze
6269d3a66f Made Debian autobuild work again 2010-08-19 16:59:56 +02:00
Andreas Metzler
3289b6c772 SelectWindowsMouseButton -> MouseLeftButtonAction
Implement the switch from SelectWindowsMouseButton et al. to
MouseLeftButtonAction = SelectWindows from WindowMaker 0.65 in Debian's
customized defaults. Closes: #116963
2010-08-18 15:26:17 +02:00
Andreas Metzler
0baac21e95 Add some bug closers
List debian bugs fixed in wmaker-crm in debian/changelog.
2010-08-18 15:26:17 +02:00
Andreas Metzler
5423e8318e Use automake instead of automake1.4.
Use latest automake (instead of automake1.4) for building.
Closes: #549157
2010-08-18 15:24:58 +02:00
Andreas Metzler
c68597b6e8 update debian/changelog. 2010-08-17 10:27:59 +02:00
Andreas Metzler
a78cff4e7f Typo fixes 2010-08-17 10:27:59 +02:00
Andreas Metzler
3b289c4a8c Escape minus sign ("-") in manpages.
man will render - as a hyphen (U+2010) instead of as a minus sign
(U+002D). Fix this by escaping the dash, using \-.
2010-08-17 10:27:59 +02:00
Andreas Metzler
eae99ee833 invoke dh_installdeb after dh_makeshlibs
lintian says

W: wmaker source: debian-rules-calls-debhelper-in-odd-order
dh_makeshlibs

and indeed invoking dh_installdeb (which install the maintainerscripts)
before dh_makeshlibs can add the ldconfig call to them causes these
errors:
E: libwutil1: postinst-must-call-ldconfig usr/lib/libWUtil.so.1.0.2
E: libwings2: postinst-must-call-ldconfig usr/lib/libWINGs.so.2.0.1
2010-08-17 10:27:58 +02:00
Andreas Metzler
baef1646ac Ship libWUtils and libWINGs in dedicated packages
Shared libraries need to be shipped in separate packages with shlibs
information. Add libwutil1 and libwings2 packages and let libwings-dev
depend on them.
2010-08-17 10:27:58 +02:00
Andreas Metzler
df8649cf54 Drop dead code from debian rules 2010-08-17 10:26:53 +02:00
Andreas Metzler
492206fe6c Remove unneeded directory creation
There is no need to generate $mandir manually, dh_installman will do
this if necessary.
2010-08-17 10:26:53 +02:00
Andreas Metzler
8dc7c5f554 Generate symlink with dh_link instead of ln -s 2010-08-17 10:26:53 +02:00
Andreas Metzler
15f74cfb10 Invoke dh_link only once.
Instead of calling dh_link multiple times (once for each symlink) just
call it once, listing the requested links in debian/package.links.
2010-08-17 10:26:53 +02:00
Andreas Metzler
3751b587eb Invoke dh_installman only once.
Instead of calling dh_installman multiple times just call it once. List
the manpages that should be installed in package specific
debian/package.manpages.
2010-08-17 10:26:53 +02:00
Andreas Metzler
a1867f2473 Use dh_lintian.
Simplify debian/rules by making use of dh_lintian.
2010-08-17 10:26:53 +02:00
Andreas Metzler
014ced4794 Drop code for generating debian/conffiles
Starting with debhelper v3 mode every file in etc is flagged as a
conffile by dh_installdeb. - Drop (commented) code for doing this
manually from debian/rules.
2010-08-17 10:26:53 +02:00
Andreas Metzler
d7fd103528 stop removing debian/files manually
There is no need to delete debian/files, dh_clean automatically takes
care of this.
2010-08-17 10:26:53 +02:00
Andreas Metzler
493a263a7d Use static debian/libwraster*.files.
debian/*files (or debian/*.install) is usually not generate
dynamically. Implement this for debian/libwraster3-dev.files and
debian/libwraster3.files.
2010-08-17 10:26:53 +02:00
Andreas Metzler
7f59c4dfa3 Use static debian/libwings-dev.files.
debian/*files (or debian/*.install) is usually not generated
dynamically. Implement this for libwings-dev.files.
2010-08-17 10:26:53 +02:00
Andreas Metzler
ac8da4a8f0 remove dead outdated code from debian/rules
-isp is default behaviour of dpkg-gencontrol since 1.13.16 (18 Feb
2006)

The code for generating debian/shlibs.local is not used, remove it.

dpkg-shlibdeps already searches in debian/libwraster3/usr/lib/ by
default.
2010-08-17 10:26:53 +02:00
Andreas Metzler
1150f741ec do not run complete debian build under fakeroot
Use dpkg-buildpackage -rfakeroot option to only run the parts of the
package generation process which require (fake)root privileges under
fakeroot. (e.g. debian/rules build should not be run as root.)
2010-08-17 10:26:53 +02:00
Andreas Metzler
fef3ee5742 patch management with dpkg-source v3
Simplify debian/rules by using dpkg-source v3 (quilt) instead of the
home-grown patch system in debian/rules.

Change debian/nightly_build.sh to build a non-native package.
2010-08-17 10:26:53 +02:00
Andreas Metzler
dcbfb467de remove cruft from debian/rules 2010-08-17 10:26:53 +02:00
Andreas Metzler
c8c613074e Remove ./libtool on clean
... otherwise it is not possible to build twice from the
same unpacked sourcetree.
2010-08-07 14:53:12 +02:00
Andreas Metzler
c20bfe9737 Use ${binary:Version} instead of ${Source-Version}
Use ${binary:Version} instead of deprecated ${Source-Version}
(Lintian: substvar-source-version-is-deprecated).
2010-08-07 14:53:11 +02:00
Andreas Metzler
7b74111259 Use dh_prep instead of "dh_clean -k"
Use dh_prep instead of "dh_clean -k" (dh-clean-k-is-deprecated). However
do not replace instances of dh_clean without -k option. (Debian
bug590244). Build-Depend on debhelper 7.
2010-08-07 14:53:11 +02:00
Andreas Metzler
de48a9b1f5 Invoke ./configure with correct --build argument.
Invoke ./configure with correct --build argument, as per
/usr/share/doc/autotools-dev/README.Debian.gz.
2010-08-07 14:52:49 +02:00
Andreas Metzler
dadb78b835 Move homepage from description text to homepage field. 2010-08-07 14:50:58 +02:00
Andreas Metzler
ef2349bc69 Add ${misc:Depends} to all package dependencies. 2010-08-07 14:50:58 +02:00
Andreas Metzler
930a3922d5 Add libxmu-dev to build-depends. 2010-08-07 14:50:58 +02:00
Andreas Metzler
6300d3462b line wrap build-depends for enhanced readability.
line-wrapping has been allowed in debian/control since 3.7.0.0, released
April 2006.
2010-08-07 14:50:58 +02:00
Andreas Metzler
9215d2d9dd Fix duplicate entry in manpage.
/usr/share/WindowMaker/Pixmaps/ is listed twice, delete second line.
[Pulled from WindowMaker Debian packaging.]
2010-08-01 18:13:09 +02:00
Andreas Metzler
879d84d883 floppy mountpoint is /media/floppy
Correct floppy mountpoint location to match FHS.

Quoting FHS <http://www.pathname.com/fhs/pub/fhs-2.3.html>:
/media : Mount point for removeable media
Purpose

This directory contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks.
[...]
The following directories, or symbolic links to directories, must be in /media, if the corresponding subsystem is installed:

Directory	Description
floppy	Floppy drive (optional)
[...]
2010-08-01 18:13:09 +02:00
Andreas Metzler
c238d8417f link libWINGs against libm if necessary
libWINGs is using mathematical functions (atan, sqrt, etc.). Check
whether we need to lik against libm to use these and link libWINGs
against it if necessary.
2010-08-01 18:13:09 +02:00
Andreas Metzler
3f27b998a7 link libWINGs against libfontconfig
libWINGs is using libfontconfig function (not just via libXft, e.g.
FcPatternDel). Search for library in ./configure and link libWINGs
against it.
2010-08-01 18:13:09 +02:00
Andreas Metzler
abb8c62fe0 link libWINGs against libXft
libWINGs is using libXft functions (e.g. XftFontClose). Link libWINGs
against libXft.

ametzler@argenau:/tmp/WMAKER/wmaker-crm$ LD_LIBRARY_PATH=debian/wmaker/usr/lib ldd -r debian/wmaker/usr/lib/libWINGs.so.2.0.1 2>&1 | grep XftFontClose
undefined symbol: XftFontClose (debian/wmaker/usr/lib/libWINGs.so.2.0.1)
2010-08-01 18:13:09 +02:00
Andreas Metzler
c396e8ca4f link libWINGs against libwraster
libWINGs is using libwraster functions (e.g. RScaleImage) and therefore
needs to be linked against it.

ametzler@argenau:/tmp/WMAKER/wmaker-crm$ env LD_LIBRARY_PATH=debian/wmaker/usr/lib ldd -r debian/wmaker/usr/lib/libWINGs.so.2.0.1 2>&1 | grep RScaleIma
undefined symbol: RScaleImage   (debian/wmaker/usr/lib/libWINGs.so.2.0.1)
2010-08-01 18:13:09 +02:00
Andreas Metzler
ffb803a0ba link libWINGs against libWUtil
libWINGs is using libWUtil functions (e.g. WMAddIdleHandler). Reorder
lib_LTLIBRARIES to build libWUtil before libWINGs. Link libWINGs against
libWUtil.
2010-08-01 18:13:09 +02:00
Tamas TEVESZ
e75b1b6d70 wrlib: Use snprintf() instead of sprintf() 2010-05-11 09:18:12 +02:00
Brad Jorsch
68bd644b0d Fix wheel resizing with resize increments
In C, dividing two integers automatically rounds towards zero, so ceil(a
/ b) is useless as the result is truncated before ceil ever sees it. The
correct result for positive integers is obtained by (a + b - 1) / b.
2010-04-26 23:23:56 +02:00
Brad Jorsch
4ddc2a5a0a Don't grab Ctrl+Wheel if ResizeIncrement is 0
I personally cannot stand stealing Ctrl+Wheel for resizing windows, so I
turned it off. But wmaker is still preventing Ctrl+Wheel from reaching
apps, which is certainly not the behavior I desire.
2010-04-26 23:23:56 +02:00
Brad Jorsch
12d16d92e7 Fix mouse button grab swallowing
We grab Mod+Button events for our own purposes, and swallow them using
XAllowEvents(AsyncPointer) to prevent the client window from seeing
them. But if events are coming in fast enough (e.g. via fast wheel
scrolling) so that multiple grabbed events are in the queue, the second
queued event would be allowed to leak through to the client by the
unconditional XAllowEvents(ReplayPointer) a few lines later.
2010-04-26 23:23:56 +02:00
Carlos R. Mafra
b575955263 Remove NEWSTUFF #ifdef's
...as they are never defined and there is no code associated to it.
2010-04-16 12:47:29 +02:00
Carlos R. Mafra
f7dc986ed1 Add include guards 2010-04-14 18:42:11 +02:00
Carlos R. Mafra
0350b8445a Remove unneeded extern's in .c files
They were not being used in those files, so let's remove them.
2010-04-14 18:39:28 +02:00
Carlos R. Mafra
4041278f48 Address some sparse warnings
Plain integer as NULL pointer, non-ANSI function declaration etc.
2010-04-14 18:39:17 +02:00
Tamas TEVESZ
62f4eff7ae Add missing initializers 2010-04-12 11:56:00 +02:00
Tamas TEVESZ
4247ac9f82 Add i18n labels to wmgenmenu 2010-04-12 09:58:37 +02:00
Carlos R. Mafra
6002ce0cbc Add more pretty names for wmgenmenu apps 2010-04-12 09:58:37 +02:00
Tamas TEVESZ
22978af5a6 Add nice labels to wmgenmenu 2010-04-12 09:58:37 +02:00
Brad Jorsch
37829a7c60 Fix loading saved states on 64-bit systems
One misuse of CARD32 was missed back when someone fixed the 64-bit
issues (background: X has 8-bit, 16-bit, and "32-bit stored in a long"
data formats; on a 64-bit system, long is 64 bits). This was causing
minimized windows to be restored as shaded, and possibly occasional
crashes, when wmaker was restarted.

Also, throw in a safety check that 10 items really were returned before
trying to access them.
2010-04-12 09:58:37 +02:00
Carlos R. Mafra
518b3b4480 Fix 'make install' from silent compilation 2010-04-12 09:58:37 +02:00
Brad Jorsch
554f9dea25 Remove apparently-unused files
WPrefs.app/Font.c - unused since 2004
wrlib/configure.in - not used and not really edited since 1998, so it's
    probably very out of date
2010-04-12 09:58:37 +02:00
Brad Jorsch
7a38ea85b9 Ignore build files
Ignore various files created by autotools, so they don't clutter the
"git status" output.
2010-04-12 09:58:37 +02:00
Brad Jorsch
bbe55ba242 Fix "make dist"
The "make dist" command can be used to generate the release tarball, but
only if the Makefile.am correctly specifies EXTRA_DIST, specifies
headers in foo_SOURCES, and so on.
2010-04-12 09:58:37 +02:00
Brad Jorsch
39426bde35 Rename INSTALL.pt
All the other INSTALL files were renamed INSTALL-WMAKER, but this one
was forgotten.
2010-04-12 09:58:36 +02:00
Tamas TEVESZ
c960ae622e Kill contribs
- Patches don't apply
- RPM spec refers to stuff long dead, distros probably have better
  ones anyway
2010-04-12 09:58:36 +02:00
Tamas TEVESZ
607beee479 Fix CRLF files 2010-04-12 09:58:36 +02:00
Tamas TEVESZ
abda319c16 Fix Debian builds 2010-04-12 09:58:36 +02:00
Brad Jorsch
65aa3ae9c8 Fix enable-modelock warnings
Fix warnings that only show up when --enable-modelock is passed to
./configure.
2010-04-12 09:58:36 +02:00
Tamas TEVESZ
ec7506e5e5 Plug leak 2010-04-12 09:58:36 +02:00
Brad Jorsch
12de2f319e Fix uninitialized vars
Initialized variables that are conditionally set. In particular, this
construct is dangerous:
  void *p;
  if (something) p = couldReturnNull();
  if (!p) p = fallbackFunction();
2010-04-12 09:58:36 +02:00
Brad Jorsch
bbf3635590 XShapeEvent strict aliasing violation
C99 defines new strict aliasing rules to allow compilers to make certain
optimizations. These rules prohibit converting an XEvent to an event
struct (e.g. XShapeEvent) that is not already in the XEvent union using
pointer type punning (e.g. "(XShapeEvent *)&ev"), and vice versa. The
canonical fix seems to be to create a union between XEvent and the
extension event struct to make the aliasing explicit, so do that.
2010-04-12 09:58:36 +02:00
Tamas TEVESZ
3be81b0243 Fix PO files breaking build 2010-04-12 09:58:36 +02:00
Brad Jorsch
35bcfa6a02 Fix internationalized format string warnings
A few internationalized format strings have only one %s in the default
while two strings are being passed. Change those defaults to have two
%s's, which means we also have to update the .po files to match. May as
well throw in the extra %s in the translated version while we're at it.
2010-04-09 15:16:31 +02:00
Brad Jorsch
6082f2d243 Fix trivial warnings
* Format string integer size warnings
 * Missing or non-value returns in non-void functions
 * A missing #include in WPrefs.app/MouseSettings.c
2010-04-09 15:16:31 +02:00
Tamas TEVESZ
6b5cfc887a Fix out-of-tree builds
- The throwing out of autogen.sh in favor of autoreconf comes from
  http://www.gnu.org/software/automake/manual/autoconf/autoreconf-Invocation.html#autoreconf-Invocation
- 'think that instead of the exit, some better way should be put in
  to control whether or not to automatically run configure. Or maybe
  just don't even run it.
2010-04-09 15:16:31 +02:00
Carlos R. Mafra
e4fedca2bb Remove install-sh, missing and mkinstalldirs from the repo
..as they get overwritten by the configure stuff.
2010-04-09 15:12:02 +02:00
Carlos R. Mafra
c183d9107e Rename wmaker INSTALL file
..so that it does not get overwritten by the configure stuff.
2010-04-09 15:07:40 +02:00
Carlos R. Mafra
fb91e5d67a Do not skip windows in the switchpanel
If a window has the skip_window_list flag set wmaker currently not only skips
this window from the window list (F11) but also from the switchpanel (TAB).

This patch makes skip_window_list-windows appear in the switchpanel and be
skipped only in the window list, strictly honoring what the name of the flag
is supposed to mean.

The motivation for this is that I have lots of workspaces and almost all of
them has a xterm, so that I set the skip_window_list for the xterms not to
overcrowd the window list. But I still want to alt+TAB to xterms on the current
workspace.

In addition to that, now the "internal window" flag is not checked before
appearing in the switchpanel.
2010-04-08 18:38:37 +02:00
Carlos R. Mafra
08f990a946 Use int instead of size_t to silence warning
gcc-4.4.1 was complaining:

fontconv.c: In function ‘mapWeightToName’:
fontconv.c:114: warning: field precision should have type ‘int’, but argument 4 has type ‘size_t’
fontconv.c:114: warning: field precision should have type ‘int’, but argument 4 has type ‘size_t’
fontconv.c: In function ‘xlfdToFc’:
fontconv.c:157: warning: field precision should have type ‘int’, but argument 4 has type ‘size_t’
fontconv.c:157: warning: field precision should have type ‘int’, but argument 4 has type ‘size_t’
2010-04-08 17:11:41 +02:00
Tamas TEVESZ
241e66ff0a Tidy
- Kill unused vars in wrlib
- Add missing initializers to defaults.c:staticOptionList
- Re-format it slightly
- Kill some dead code
- Kill stupid "if (const op var)"
2010-04-08 15:53:50 +02:00
Brad Jorsch
79e1bb53d3 Menu positioning bug
I noticed a bug today in menu workspace positioning (in the next tree):
if I right-click and hold the button down at the left edge of the
screen, the menu appears (correctly) half off the edge but will *not*
slide back onto the screen. Compare the behavior to right-clicking at
the right edge of the screen: the menu appears half off the edge, but
sliding the mouse to the edge causes the menu to slide until it is fully
visible.

Also, opening a submenu in this state positions the submenu as if the
menu were fully on the screen, leaving a gap between the menu and the
submenu.

If the menu happens to also go off the bottom of the screen, moving the
mouse to the bottom edge causes the issue to be magically fixed as soon
as the sliding upwards begins.

I also note inconsistent behavior when simply right-clicking (without
holding) to bring up the menu: at the right or bottom edge the menu
appears in the correct partially off the edge position, but at the left
edge it immediately jumps to be fully on-screen, almost as if
WrapMenus = YES were set for the left edge only.

I bisected it to d316260395. As far as I
can tell the "fix" there was to position the menu at the correct
negative X position but then lie to wmaker so it thought the menu was at
X=0. Presumably the "WrapMenus" behavior was the intended result.

Since (AFAIK) the window menu is the only one with this problem, why
don't we just check if x is too negative in OpenWindowMenu()?
2010-04-08 15:53:50 +02:00
Tamas TEVESZ
c90484324c Fix spacing on WPrefs Misc panel
- w/o XKB_MODELOCK it looks like shit anyway, so let's at least
  make the w/ XKB_MODELOCK case readable.
2010-04-08 15:53:50 +02:00
Tamas TEVESZ
1b666f53e4 Make WPrefs' Expert panel scrollable 2010-04-08 15:53:50 +02:00
Tamas TEVESZ
b59575e709 Add new cycling option
When using Xinerama, make it possible only to cycle between those
windows that are on the currently active head - AFAICT this means
windows that have the majority of their area on the same head as
the pointer.

Patch complete with WPrefs integration, alas this being quite
unusable - for a lack of a better idea, I tucked the option on the
expert panel, making the item list too tall - making it scrollable
would be a nice addition.

The default for the new option (CycleActiveHeadOnly) should be NO,
that is, no change in default behaviour.
2010-04-08 15:53:50 +02:00
Carlos R. Mafra
3f8248f534 wmgenmenu: Change the app order in terminals list
Because the terminal detection stuff by Tamas was choosing 'mrxvt' for
me, but I want it to be 'xterm'.
2010-04-08 15:53:50 +02:00
Tamas TEVESZ
68a55be998 Poke wmgenmenu some more
- change some variable names to better reflect their purpose, do a little
  write-up how a menu is built
- auto-detect what terminal to use for apps in need of a terminal
- fix the chunk that adds the terminal-based apps
2010-04-08 15:53:50 +02:00
Carlos R. Mafra
68f70da310 Regenerate wmgenmenu German translation 2010-04-08 15:53:50 +02:00
Tamas TEVESZ
c165beeb4b Poke wmgenmenu, part 2
- Convert to using WINGs PropList functions
- Add mwm to other_wm, remove ee from Graphics while here
2010-04-02 10:15:58 +02:00
Tamas TEVESZ
daad5ed828 Poke wmgenmenu
- add help and usage, to bring it in line with other tools
- if no item in any particular group was found, don't write an
  empty group
2010-04-02 10:13:15 +02:00
Tamas TEVESZ
2e91634921 Kill leftovers 2010-04-02 08:41:31 +02:00
Tamas TEVESZ
81aaed2bf8 Tidy comms between external apps and wm a bit
- one instance of this left in setstyle, it will follow later
2010-04-02 08:41:11 +02:00
Tamas TEVESZ
e7a46d5cdf Attach utils versions to WM version 2010-04-02 08:38:39 +02:00
Tamas TEVESZ
7dc767ae78 Convert to getopt, continued
plus some assorted fixes:
 - sort headers, remove some unneeded ones
 - small bits of formatting and the like
2010-04-02 08:38:23 +02:00
Tamas TEVESZ
859338fd83 Spice up setstyle
- convert to getopt
- tidy xsendevent
- modify hackPathInTexture() so that:
  - it properly figures where the style file is
  - if it's under the user's home directory, that part of the path
    is changed to `~' - this makes your wm configuration usable on
    systems with a network home, used on systems where home is /home,
    or /u, or /export/home, or whatever.

XXX: there's a note WINGs/findfile.c:wexpandpath() stating that
`too many functions handle a return value of NULL incorrectly'. this is
so true. so if anyone is looking for a small project to sink their
teeth in...
2010-04-02 08:37:16 +02:00
Tamas TEVESZ
1bc042c172 Autoconf mods
- according to the automake manual, `acinclude.m4' is the old style
  of doing stuff, putting local macros in their own directory is the
  way to go, so move acincluce.m4 to m4/windowmaker.m4
- reflect this in autogen.sh and Makefile.am
- while there, add a `conditionally set cflags' macro from the
  autoconf macro archive
- use this to slightly pump warning levels up if we are on gcc
2010-04-01 11:40:08 +02:00
Tamas TEVESZ
6bf7994520 Style stuff up
- convert hand-rolled arg parsers to getopt_long
- sort headers, get rid of some duplicates in the process
- in fontconv, replace magic numbers with constants (there's
  little practical value to this here, but it's much nicer)
- slightly redo fontconv.c:strToInt()
2010-04-01 11:24:46 +02:00
Tamas TEVESZ
444de5e6b6 Make asm code readable 2010-04-01 11:24:25 +02:00
Tamas TEVESZ
4078af654b An XLFD has exactly 15 fields, not "at least" 15 fields. 2010-03-29 21:18:37 +02:00
Tamas TEVESZ
7b9b7de172 Fix png 1.4+ builds
- png_check_sig was removed from png 1.4, use replacement fun, which is
  already present in 1.2.0 (cca. 2001)
2010-03-29 21:18:37 +02:00
Carlos R. Mafra
0c2d2c69b9 Use 'long' instead of 'CARD32' in wClientSetState() and wWindowSaveState()
The rationale is the same as in commit c7f2a189c4
("Fix the call to XChangeProperty() in 64-bit mode"), because we are
calling XChangeProperty() with format 32, which requires the type of
'data' to be 'long'.
2010-03-29 00:17:02 +02:00
Carlos R. Mafra
13ba5d5f5b Remove uncompiled code from src/window.c 2010-03-29 00:17:02 +02:00
Carlos R. Mafra
828cb7a147 Remove GRADIENT_CLIP_ARROWS from wconfig.h.in
...as it appears nowhere else in the source code.
2010-03-28 14:34:11 +02:00
Tamas TEVESZ
71aa4f2884 Switch file ops to stdio
- Does away with the O_BINARY abomination
- as a byproduct, plugs an fd leak in wcolorpanel.c:fetchFile()
- sprinkle some fsync()s to files that have been written to (this
  needs to be done everywhere)

+ fix brown paper bag thinko in configure.ac
2010-03-27 10:31:13 +01:00
Tamas TEVESZ
ea4645bc09 Add Cygwin to GCFB() (it is just like linux)
+ make stub give some clue
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
28cbda550a Remove dead code from wrlib 2010-03-26 21:08:17 +01:00
Tamas TEVESZ
7d905787d2 Remove old unused Red Hat-specific configure checks 2010-03-26 21:08:17 +01:00
Tamas TEVESZ
0e12a076aa Remove looking for libxpg4 on FreeBSD 2010-03-26 21:08:17 +01:00
Renato Botelho
0f5c36a67e Fix non-I18N build
* Remove directly include of <libintl.h> and include src/wconfig.h, that
already include libintl.h and declare _() function
* Replace some gettext() calls to _()

These changes fixes build with LINGUAS is unset, and removes I18N
support in this case.
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
1f2b9999b9 Remove network support from WINGs
- nobody used it

Amend network stuff removal

still more wings network removals

[crmafra: squashed together three patches]
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
55959b4f7e Half-assed fix to make autoconf bend
- this should make platform detection automagic
- also fixes debian builds that broke in the meantime
- fix osdep_darwin.c
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
67a8a82670 Remove wmlib
was this ever used for anything? i checked a couple hundred dockapps,
no joy; there's nothing in debian (afaict) that build-depends on it,
so let's try doing away with it.
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
83774951b7 Remove some dead weight from configure.ac and debian/rules 2010-03-26 21:08:17 +01:00
Tamas TEVESZ
298338c111 GetCommandForPid() for darwin/osx 2010-03-26 21:08:17 +01:00
Tamas TEVESZ
ab9c85a11d Add the BSD version of GetCommandForPid()
- tested on Net, Free, Open and DragonFly

- fix up the linux version (terminate argv with a null ptr)
- add error handling to file ops in the linux version
- add a stub version for platforms not supported
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
294ea56d84 Introduce OS-dependent stuff
- move GetCommandForPid() into a separate file
- slightly rewrite it to be more readable along the way
2010-03-26 21:08:17 +01:00
Carlos R. Mafra
eee6551aff Remove python support from WINGs
As the README used to say, it was a unfinished work. If someone
wants to finish it after all these years it can be recovered
from the logs. But meanwhile let's not carry dead code around.
2010-03-26 21:08:17 +01:00
Tamas TEVESZ
1a0c8afa80 Remove texture plugins
- leave a note for the unlikely case of such configuration being found,
  the user is notified properly
2010-03-26 21:08:16 +01:00
Tamas TEVESZ
61a96e79c4 Trivial format string fixes 2010-03-26 21:08:16 +01:00
Martin Dietze
ef7c45df53 rebase in git pull for nightly build 2010-03-26 21:08:16 +01:00
Tamas TEVESZ
c7868fa405 Make inotify optional
This time keeping the ability to fall back to the old polling method.
2010-03-23 21:50:17 +01:00
Tamas TEVESZ
118a93808a Idle fixes
- add new wglobaldefaultspathfordomain() to wings (replaces several
  hand-rolled individual implementations in utils/)
- make all of 'em handle -h|--help, -v|--version
- try making them not to nothing silently
- change various ways of knowing thyselves to using __progname
- generally try to make them feel similar (NOT right, similar --
  right is a completely different matter)
2010-03-23 21:50:17 +01:00
Tamas TEVESZ
9dadfe7a68 Sensible defaults
In the wmaker-dev list, Iain noted that:

  "I can see the benefit of this.  I know of at least two
   applications[1] which don't bother to set a class and instance.  Early
   versions of my OS X cycling patch for Window Maker caused a crash when
   faced with such windows because I forgot to check that these
   properties existed.  Nowadays it just refuses to do the cycling.

   Also Window Maker won't let you save attributes on such windows from
   the Inspector.

   [1] Interestingly they are competiting commercial applications: No
   Machine and Exceed onDemand."

[crmafra: edit commit log]
2010-03-23 21:50:17 +01:00
Tamas TEVESZ
d51bbe6626 Collect low-hanging fruits 2010-03-23 21:50:17 +01:00
Tamas TEVESZ
5f02b1b5f4 Feet protector for getstyle
Since getstyle now saves the theme pack in $GUR instead of
the cwd, there's a slight possibility you can specify a theme
pack name that will do Bad Things to your existing stuff.

To that end, specified theme pack name is "sanitised" a bit, as in
forward slashes in it are replaced by an underscore.

Oh yes, i forgot to mention. getstyle now saves the theme pack
in $GNUSTEP_USER_ROOT, not in cwd.
2010-03-23 21:50:17 +01:00
Tamas TEVESZ
9f7aaa8aed Some rework on getstyle
- make it use wings functions, remove duplicated code from getstyle
- de-static necessary functions in wings
- add new wrmdirhier to wings
- rename WMMkDirHier to wmkdirhier (fits better)
- remove calling shell from getstyle (what were they thinking?)

i couldn't quite test getstyle (no idea about themes), but it still
basically works.

do back your ~/G dir up... wrmdirhier might eat it!

definitely needs testing, especially by people who have any idea
how themes work.

Some more getstyle

- missed a shell invocation
- maybe copyFile should be in wutils too...?

[crmafra: Folded second patch into the first]
2010-03-23 21:50:17 +01:00
Martin Dietze
66bd06b5d5 Nightly build script with more robust handling of debian patches. 2010-03-23 14:32:25 +01:00
Tamas TEVESZ
43b1914f37 Remove long-dead plugins. 2010-03-20 18:42:56 +01:00
Tamas TEVESZ
2a52ce3544 Remove unneeded files
WINGs/puzzle.c is an example, and is actually also in WINGs/Examples/

wmsetup was actually equivalent to a slightly braindead true(1)
2010-03-20 18:42:56 +01:00
Carlos R. Mafra
2ad40e0734 Maximus: Cleanup the code
By defining a struct containing the coordinates of the
windows (top, bottom, left, right, width, height) and
using a helper function to set up these coordinates, the
whole function becomes much cleaner and easier to read.
2010-03-20 18:42:56 +01:00
Carlos R. Mafra
5178465bb6 Remove DEBUG statements, #if 0 etc
...and some other cleanups.
2010-03-20 18:42:56 +01:00
Tamas TEVESZ
cef4fbb422 Remove unreferenced files 2010-03-17 16:48:24 +01:00
Tamas TEVESZ
9911ecd985 make wtrimspace() use internal api
make wtrimspace() use wings' own function for a task

semantics change: it used to segfault given null, now it returns null.
this doesn't affect any current use (there's exactly one..), and i see
no harm in this behaviour, and perceive this to be more natural.
2010-03-17 16:39:53 +01:00
Tamas TEVESZ
109e504262 Fold many functions into one
The result is not much more convoluted than the original was, but much shorter.
Several vararg macros were added -- no idea what !gcc compilers make of this.

The messages sent to these functions are inconsistent across the source tree.
I have now decided that the logging function will add the final newline -
messages will need to be modified accordingly.

I have no idea why the original implementation was as complicated and ugly as
it was. My guess is that it was anticipated that these are be called from
sighandlers, but why no snprintf when they are all stuffed up with vsnprintf...

Still, the result is not worse in this regard either.
2010-03-17 13:34:24 +01:00
Tamas TEVESZ
63e4338284 Remove unused WINGs/international.c 2010-03-17 13:34:24 +01:00
Carlos R. Mafra
8018da8149 Constify WMMatchDataProc and fix fallout
It addresses this warning

dialog.c: In function ‘LoadHistory’:
dialog.c:209: warning: passing argument 2 of ‘WMFindInArray’ from incompatible pointer type
../WINGs/WINGs/WUtil.h:455: note: expected ‘int (*)(void *, void *)’ but argument is of type ‘int (*)(const void *, const void *)’

but induces others in other places. One of them was this one

window.c: In function ‘wManageWindow’:
window.c:782: warning: passing argument 2 of ‘WMFindInArray’ from incompatible pointer type
../WINGs/WINGs/WUtil.h:455: note: expected ‘int (*)(const void *, const void *)’ but argument is of type ‘int (*)(void *, void *)’

which is fixed by constifying the arguments of matchIdentifier(). The other warnings are
fixed similarly.
2010-03-17 13:34:24 +01:00
Carlos R. Mafra
034339320f Constify the argument of wstrdup() 2010-03-17 11:12:54 +01:00
Tamas TEVESZ
de881d9c03 Kill redundant function 2010-03-17 11:12:53 +01:00
Carlos R. Mafra
e1d5ce7a51 Cleanup includes of wcore.h, defaults.h and pixmap.h
Several files were including others for no reason, and this slows
down the build time (but probably not measurable on a fast machine).
2010-03-17 11:12:53 +01:00
Carlos R. Mafra
b4b25fdf6a Remove redundant 'if defined' check
WindowMaker.h already #includes wconfig.h, which checks exactly
the same thing. So remove it from WindowMaker.h.

However, it would be better if WindowMaker.h didn't include
wconfig.h at all. The only reason I see for the inclusion is
the check for KEEP_XKB_LOCK_STATUS, defined in wconfig.h.
But that can be probably cleaned up too (I guess modern X's
enable XKB stuff that by default, by I haven't checked)

But anyway.
2010-03-17 11:12:53 +01:00
Tamas TEVESZ
badecc244b simplify WMWritePropListToFile()
remove the choice of atomic/non-atomic writes. firstly, the only users
of non-atomic writes were getstyle and geticonset; secondly, who in their
right minds would ever want non-atomic writes; thirdly, the file system
will screw you anyway *G*.
2010-03-17 11:12:53 +01:00
Tamas TEVESZ
833128385f Add a new helper function, WMMkDirHier()
...which creates directory hierarchies under $GNUSTEP_USER_ROOT

- make WMWritePropListToFile() use this

readily solves the "run dialog history vs nonexistent state dir" case.

if other consumers are found for this, just de-static and move the
prototype to WUtil.h or some other appropriate place.
2010-03-17 11:12:53 +01:00
Carlos R. Mafra
9a2dbc5a5f Fix typos, remove commented out code etc 2010-03-15 19:55:52 +01:00
Carlos R. Mafra
939f46b870 Maximus: Simplify the +/- border width madness
Taking the border width into account was making it hard to follow the
algorithm, and complicating things usually lead to mistakes.

In fact, in trying to account for this +/- 1 pixel issue the maximus
geometry for the requested window would sometimes overlap another window
by one or two pixels (depending if it was on the right or left). Therefore,
applying the maximus geometry to this other window in sequence would
maximize it completely instead of finding the correct tiled geometry.

So that always bugged me. Now I got tired of it and decided to kill the
whole consideration of the border width, and simply put some "+ 1"
inconditionally to be on the safe side.

Now it can happen that the windows will stay away one or two pixels,
but trying to be 'good enough' is better than trying to be 'perfect'
and getting it wrong for corner cases.

And the matter is worse because the size of xterms are 'quantized', so
changing the position of the other windows by a few pixels result sometimes
in a overlap of +1 pixel, or a distance of 1 or 2 pixels. Furthermore,
the bottom of xcalc behaves differently from the bottom of a xterm or
xjed (for xcalc the ad hoc correction for bottom_0 must be -8 in total).

But now my tests show that things are OK, and I can use maximus
for all the windows in the screen and no overlap will occur (except
if one of the windows is a xcalc, I don't know why).
2010-03-15 19:49:32 +01:00
Carlos R. Mafra
ee569220df Remove NEWAPPICON #ifdefs
It wasn't defined anywhere and when I defined it, the compilation
did not finish:

appicon.c: In function drawCorner:
appicon.c:206: error: WScreen has no member named focused_texture
appicon.c:208: error: WScreen has no member named unfocused_texture
appicon.c: At top level:
appicon.c:214: error: conflicting types for drawCorner
appicon.c:193: note: previous definition of drawCorner was here
make[2]: *** [appicon.o] Fehler 1
make[1]: *** [all] Fehler 2
make: *** [all-recursive] Fehler 1

So let's simply remove those #ifdefs.
2010-03-15 17:50:17 +01:00
Tamas TEVESZ
baac5ead1e wmgenmenu: Add 'mc' to file managers list
i'd say it's rather unfair to leave grandpa out ;))
2010-03-15 16:56:06 +01:00
Tamas TEVESZ
8d0020cf9a Unused wsmap, begone!
- held only reference to wnew0, which was the only consumer
of wmalloc0, safe trip both of them.
2010-03-15 16:56:06 +01:00
Carlos R. Mafra
4688e1b568 Add more info to the NEWS file etc
...and remove MIRRORS file, update INSTALL and README.
2010-03-15 16:55:19 +01:00
Johann Haarhoff
484b19ba89 Add info about Resize, Maximus and LR Maximize to NEWS
Added information about new functionality added to wmaker between
0.92 and 0.94-crm.
2010-03-14 22:24:46 +01:00
Johann Haarhoff
0db4d7885b Make CTRL+Wheel less intrusive
This patch only calls XGrabButton for CTRL+Button4 and CTRL+Button5.
This leaves CTRL+Button1-3 to the application.

This then removes the functionality of moving a window between
workspaces with CTRL+Button1 and CTRL+Button3
2010-03-14 22:19:08 +01:00
Johann Haarhoff
744ccb85d2 CTRL+Wheel Horizontal Resize + extras
This patch constrains MOD+Wheel to vertical resize, and adds
CTRL+Wheel horizontal resize. Two resize in both directions, you
have to use CTRL+MOD+Wheel.

To enable this functionality I have to grab all CTRL+Mousebutton
events in wmaker, which stops them from reaching the application.
This definitely hurts application functionality in some apps, for
example the "VT Fonts" (CTRL+Button3) menu in xterm is no longer
accessible. To stop this from happening use the "Do not bind mouse
clicks" window attribute for the apps in which you want to disable
this.

Because wmaker now controls all CTRL+Mousebutton events, I also
added CTRL+Button1 and CTRL+Button3 shortcuts that will move a
window back and forth through your workspaces without changing its
position or size.
2010-03-14 22:10:24 +01:00
Carlos R. Mafra
e37db24efe Remove reference to sound support from README.* 2010-03-12 10:44:24 +01:00
Carlos R. Mafra
3473a11787 Remove COPYING.OPL
The only (old) reference to it was from Marco's artwork in
WPrefs, but that was later changed to the GPL.
2010-03-12 10:35:03 +01:00
Carlos R. Mafra
6d6d53a350 Delete reference to non-gpl license in README.pt
The icons from Marco are licensed under the GPL (see
Changelog in commit f65c549814)
2010-03-12 10:34:54 +01:00
Carlos R. Mafra
51885365a6 Convert README.pt to UTF-8 2010-03-12 10:34:54 +01:00
Carlos R. Mafra
0049b5bc8c Remove references to non-gpl artwork license
The non-gpl warnings in WPrefs.app/tiff/README
and WPrefs.app/README were misleading, because
they were refering to Marco van Hylckama Vlieg's
work which was licensed with OpenContent License.

But as Alfredo Kojima wrote in the Changelog in
commit f65c549814 from 30.03.2010,
Marco's icons were licensed with the GPL.

Furthermore, in an email to wmaker-dev on 10.03.2010,
Marco confirmed:

  "Anyway, I have no problem with the artwork being
  licensed under GPL or whatsoever."
2010-03-12 10:33:01 +01:00
Carlos R. Mafra
2901a153ce Remove ancient 'DBase 3' data file
Pointed out by Tamas TEVESZ.
2010-03-09 22:50:52 +01:00
Johann Haarhoff
6b791d8a89 Add a trailing "/" to dirs in dialog autocomplete
The autocomplete feature in the "Run" dialog now adds a trailing "/"
when autocompleting directory names. This does three things:

1) shows you that you are completing a directory and not a filename,
2) saves one character of typing, and
3) makes it behave more consistent with shell (bash) autocompletion
2010-03-09 10:24:33 +01:00
Martin Frydl
1f3adb0ea5 Patch for WINGs buffer overflow
I've found a buffer overflow problem in RSmoothScaleImage. There are
some scaling calculations involving floats which are finally converted
to integers. Since such conversion does not round the number, just
truncates the decimal part, sometimes the number is smaller than it
should be. As a result, smaller buffer is allocated for picture
scaling and thus buffer overflow occurs.

Strange thing is that this bug has not appeared earlier so it probably
has something to do with newer gcc or glibc (I switch from
"prehistoric" Fedora Core 5 to Fedora 12).

<What about the symptoms?>

There were several ones, probably depending on application version and
compilation flags. First, it just stopped responding. Looking at the
process with strace I saw it locked in some FUTEX wait (unfortunately
I don't have the logs). Second, it just crashed. And last I got
complaint from glibc about double free or corrupted heap before
malloc. I've found the bug through wmweather+ dockapp, versions 2.9
and 2.11 (http://sourceforge.net/projects/wmweatherplus/), I've never
encountered it in WindowMaker itself.
2010-02-26 13:15:18 +01:00
Nicolas Bonifas
ad853b386e Removed unused version of RScaleImage() in wrlib/scale.c
... as the "broken_code" preprocessor symbol appears nowhere else.
2010-02-26 13:08:42 +01:00
Carlos R. Mafra
1861880239 wmgenmenu: A Window Maker menu generator
The inspiration comes from Geir T. Kristiansen's 'genmenu' shell script
(http://gtk.no/genmenu) which I have been hapilly using for
the last 9 years or so.

That script generates the Window Maker menu by asking a few questions
and checks whether the applications in a predefined list exist in
the user's $PATH, so that the menu contains only the applications
which are guaranteed to exist and which the user cares about.

However I always thought it was a bit slow to finish, even
when having a file containing the answers to the questions to
be piped in.

And as Kristiansen states in his webpage, his script does not
support internationalization:

   "If you want internationalization I really suggest you rewrite
    genmenu from scratch anyway in a more sensible language and remove
    other limitations while you are at it."

so I decided to rewrite in C and make it support internationalization
(only English and German so far). While I am not sure yet if I removed
"other limitations while you are at it" I definitely made it finish faster.
This C program does not make you questions though.

But in the same spirit as the author of 'genmenu', who says:

    "Genmenu is a hack, deal with it, it just happens to serve my needs."

I present you 'wmgenmenu', which you can use like this:

wmgenmenu > /home/mafra/GNUstep/Defaults/WMRootMenu

and the menu is automatically generated from the list of
predefined apps which are contained in the C sources (wmgenmenu.h).

And when you generate the WMRootMenu as above, wmaker will automatically
load the new menu for you (due to the 'inotify' mechanism in wmaker-crm).

As for 'wmgenmenu' being faster than 'genmenu':

[mafra@Pilar:~]$ time ./genmenu.sh < answers.txt &> /dev/null

real    0m3.626s
user    0m0.968s
sys     0m1.830s

[mafra@Pilar:~]$ time wmgenmenu &> /dev/null

real    0m0.020s
user    0m0.006s
sys     0m0.013s
2010-02-21 11:51:00 +01:00
Carlos R. Mafra
6367bf5234 Remove HEARTBEAT #ifdef's 2010-02-11 10:29:26 +01:00
Carlos R. Mafra
708cf2d2a2 Remove unused stuff from src/defaults.c 2010-02-11 10:29:14 +01:00
Carlos R. Mafra
6723aa55aa Remove old backward compatibility code
Once upon a time (< 2005) the CachedPixmaps directory was located
at ~/GNUstep/.AppInfo/ and that was later moved to
~/GNUstep/Library/WindowMaker. So Dan Pascu introduced this function
in 24519b6292 to make the convertion
automatically to users back then.

As it is highly unlikely that there is an old-timer wmaker user still
running a pre-2005 wmaker which suddenly decides to switch to wmaker-crm
and runs into trouble with his CachedPixmaps folder, let's simply remove it
to make defaults.o 1.8% smaller (596 bytes).
2010-02-11 10:29:14 +01:00
Martin Dietze
e54f763f14 Changed runtime dependency libjpeg62-dev to libjpeg-dev
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569245
2010-02-11 10:29:05 +01:00
Carlos R. Mafra
914d984422 Add new WPrefs German strings
With thanks to Martin Dietze!
2010-02-02 11:05:46 +01:00
Carlos R. Mafra
ba4c4bd61a Regenerate WPrefs German translation file
No new translations were added. The .po file was recreated with

make WPrefs.pot
msgmerge de.po WPrefs.pot > de.po.new
(remove old strings from it)
mv de.po.new de.po
2010-02-02 10:56:01 +01:00
Carlos R. Mafra
585307ba39 Add new German translated strings
It was fun trying to translate them, but even after several
minutes of deep thoughts about the different cases etc I managed
to translate them wrongly.

So I thank Martin Dietze for kindly fixing them!
2010-01-22 19:24:04 +01:00
Carlos R. Mafra
f1980ce1f1 Re-create German translation file
I wanted to learn some German and got curious to read the Window Maker
translations. After noticing that some strings with translations
were already removed from the main source I decided to recreate the
German .po file to get rid of those messages.
2010-01-22 19:21:51 +01:00
Carlos R. Mafra
23a790da1d Add new style 2010-01-22 18:22:53 +01:00
Alexey I. Froloff
7793bb9d67 Turn anti-aliasing on by default. 2010-01-22 01:51:24 +01:00
Carlos R. Mafra
366cb8367b Add a few instructions to the WPrefs.app/po/README
Just in case someone wants to help.
2010-01-21 19:32:15 +01:00
Carlos R. Mafra
422fedbc4b Remove mkpatch script
I don't need it, git should handle everything.
2010-01-16 17:09:34 +01:00
Martin Dietze
c89cb142ba Small fix for wmaker nightly build script 2 2010-01-12 14:59:35 +01:00
Carlos R. Mafra
72dfe4aa89 Remove VIRTUAL_DESKTOP code
Even the option to enable "virtual desktop" in configure.ac was
commented out...and I would never intend to use it anyway.

So let's just remove the ~800 lines of #ifdef'ed code to have a
cleaner code base to read when bored.
2010-01-09 13:48:06 +01:00
Martin Dietze
4e90a87b14 Small fix for wmaker nightly build script 2010-01-09 13:48:06 +01:00
Carlos R. Mafra
f55eef413f wmaker-0.94.0-crm
I am calling it -crm so that people won't confuse its non-official status.
2010-01-09 13:48:06 +01:00
Carlos R. Mafra
643e49f190 Remove [raise,lower]clip shortcut keys
The raising and lowering of the clip is already taken care of
by the "ClipRaiseLowerKey" shortcut.

wmaker gets a bit smaller for free:
   text    data     bss     dec     hex filename
 449483   17384    8208  475075   73fc3 src/.libs/wmaker.old
 449307   17256    8192  474755   73e83 src/.libs/wmaker.new
2010-01-09 13:47:57 +01:00
Carlos R. Mafra
8a2a0b6adc Remove ICON_KABOOM_EXTRA
I don't want it in the sources, and the "normal" icon kaboom
is good enough. And it was #undef'ined by default.
2010-01-07 15:38:41 +01:00
Carlos R. Mafra
0deb198b10 Remove a few unneeded includes 2010-01-07 15:33:41 +01:00
Brad Jorsch
b6689a0108 Keyboard shortcut to raise the dock
This patch adds the DockRaiseLowerKey shortcut, which raises/lowers
the dock depending on whether the dock is lowered/raised.

[crmafra: Reformatted Brad's patch against git repo and removed the
 DockRaiseKey and DockLowerKey shortcuts ]
2010-01-07 12:16:17 +01:00
Carlos R. Mafra
7ef8178d2a Undefine WINDOW_BIRTH_ZOOM
I don't want the (small) overhead of the window birth zoom special effects
because I like apps popping up instantly when I open them (specially now
with the SSD).

Another way to not get the birth animation is to unset "animations" in
WPrefs, but that makes the other animations which I care (ie they don't have
the effect of making my computer seem slower than it really is) go away.
2010-01-06 11:34:24 +01:00
Carlos R. Mafra
b3e817305d Do not compile extra stuff under wrlib/tests etc
Let's avoid compiling these "tests" and extra stuff every time,
saving us some time.
2010-01-06 11:34:24 +01:00
Carlos R. Mafra
a2133e8e2f Do not change workspace during deiconify animation
Paul Harris reported that using the mouse wheel over a miniwindow
would deiconify it to a different workspace than the original one
where it was iconified.

This happens because after the window begins to be deiconified the
"residual" mouse wheel scrolling hits the workspace background, and
Window Maker changes workspace with wWorkspaceRelativeChange().

But if it all happens fast enough (so the deiconification animation
did not finish yet) the workspace will have changed before the
window reaches its final deiconified destination, leading to
the situation that Paul described in the link below.

So to avoid this, let's set a 'ignore_wks_change' variable
from wDeiconifyWindow() and make wWorkspaceRelativeChange() respect it.

Original report: http://lists.windowmaker.info/dev/msg00821.html
2009-12-26 21:09:10 +01:00
Carlos R. Mafra
efa31f30b2 Remove unused function raiseMenus()
GCC warns:

rootmenu.c:350: warning: 'raiseMenus' defined but not used
2009-12-21 23:00:33 +01:00
Carlos R. Mafra
024e2f5299 Remove XSMP_ENABLED constructs
The code was never used and the !XSMP_ENABLED code seems to
work well enough for all these years.
2009-12-21 22:40:28 +01:00
Ralf Hoffmann
629b118767 fixed problem with default visual ID for multi-screen setups by using multiple IDs for each screen
Since a single default visual ID cannot be used for multiple screens, thus
Window Maker refused to start. There is now a global function for getting the
default visual ID. The command line argument --visual-id can be a comma
separated list of visual IDs for each screen. A default value is only set for
the first screen.
2009-12-11 16:36:25 +01:00
Nicolas Bonifas
d8ef209c9a Add menu path to Debian build system
Part of the menu on Debian systems is stored in
/etc/X11/Windowmaker/menu.hook. This patch will add this path to
src/wconfig.h.in when building the Debian wmaker package. This is
what is done in the Debian version of wmaker 0.92.0.
2009-12-10 13:51:26 +01:00
Carlos R. Mafra
2ba803ad98 Remove unused arguments from a few functions
gcc 4.4.1 was warning (among others):

switchpanel.c: In Funktion »getTile«:
switchpanel.c:321: Warnung: unbenutzter Parameter »panel«
switchpanel.c: In Funktion »makeWindowListArray«:
switchpanel.c:377: Warnung: unbenutzter Parameter »scr«
switchpanel.c:377: Warnung: unbenutzter Parameter »workspace«
2009-12-09 21:04:29 +01:00
Carlos R. Mafra
33c9e87692 Remove static function declaration from header file 2009-12-09 20:48:44 +01:00
Carlos R. Mafra
0a5febcada Remove unused function argument from randomPlaceWindow() 2009-12-09 20:35:13 +01:00
Nicolas Bonifas
41fdb79e28 Maximus: Take border into account
This patch fixes a minor bug in Maximus: the new window size didn't take the
 border into account. This bug was particularly visible with the
 "do not cover dock" option turned on.
2009-12-08 16:14:29 +01:00
Ralf Hoffmann
d74a90d1bf changed behavior when focusing new windows with autofocus enabled
New windows will only get focused if the mouse is on the same screen.
The code doesn't handle multiple heads but since it's just one screen
the function works as usual. Checking the head and assign the focus only
if the window is on the same head might be a good idea. Making the whole
stuff optional might be even better.
2009-12-08 16:14:29 +01:00
Ralf Hoffmann
fe8ab024af fixed wrong env setup when setting background
This patch fixes a problem with restarting Window Maker in multi-screen
environments. The code for setting the background by calling wmsetbg
changes the environment. In multi-screen setups the DISPLAY variable
becomes :0.0 instead of :0 (for example). The restarted Window Maker
process therefore only manages one screen.
2009-12-08 16:14:29 +01:00
Ralf Hoffmann
6c6e832c52 activate XGrabServer again
This patch fixes a small problem which only rarely occurs. If a
window is opened only for a very short time and closed right away, in
some circumstances the frame around it stays opened. It looks like
Window Maker doesn't get the destroy message. The XGrabServer call was
commented in the code so I activated it again which seems to prevent this
from happening. I think it actually make sense since the ungrab calls are
used anyway in the following code.
2009-12-08 16:14:29 +01:00
Carlos R. Mafra
13c2d523e2 Remove DRAWSTRING_PLUGIN reference from wconfig.h.in
DRAWSTRING_PLUGIN never appears anywhere else in the sources.
2009-12-08 16:14:29 +01:00
Carlos R. Mafra
e7cc15df71 Remove unused function getRImages()
Pointed out by Nicolas Bonifas.
2009-12-06 15:35:26 +01:00
Carlos R. Mafra
3db3f179d1 Remove unused src/menureader.c file 2009-12-06 15:35:26 +01:00
Carlos R. Mafra
5fa41941fe Remove unused wHackedUngrabButton()
Pointed out by Nicolas Bonifas.
2009-12-06 15:35:25 +01:00
Carlos R. Mafra
4c4d50c813 Remove unused function wIconSetHighlited()
There is no point in carrying unused functions for so long.

Pointed out by Nicolas Bonifas.
2009-12-06 15:35:25 +01:00
Carlos R. Mafra
8c5a7b287a Remove unused functions from src/pixmap.c
In case someone needs them in the future for some reason,
they can be restored from the git logs.

Pointed out by Nicolas Bonifas.
2009-12-06 15:35:25 +01:00
Carlos R. Mafra
347fbcc87a Remove unused function wWindowCheckAttributeSanity()
As pointed out by Nicolas Bonifas, wWindowCheckAttributeSanity() is
currently unused. Removing it saves 200 bytes:

  text    data     bss     dec     hex filename
  23476       0       8   23484    5bbc src/window.o.new
  23676       0       8   23684    5c84 src/window.o.old
2009-12-06 15:35:25 +01:00
Nicolas Bonifas
a2cb317f11 Remove useless NULL test
If menu is NULL we would have a null pointer dereference when initializing scr.

> Ie, why not move the assignment of 'src' to after the test?

I thought about this, but I checked the 3 different calls to
updateWorkspaceMenu (all in winmenu.c). They must all call
updateWorkspaceMenu with non-NULL pointers, so if we have a NULL
'menu' pointer then we obviously have a major problem and it is
probably better to crash here than to silently return and fail a
little latter.

[crmafra: edit changelog]
2009-12-06 15:32:30 +01:00
Nicolas Bonifas
391d5de79e 2 open() statements were not matched with close() statements in function fetchFile 2009-12-06 13:58:24 +01:00
Carlos R. Mafra
ad4358c605 Update German translation
Based on a patch from OpenSUSE whose author is unknown.
2009-12-01 14:17:50 +01:00
Nicolas Bonifas
2203b229b0 Fix the empty button in titlebar after going fullscreen bug (Debian bug #298873) 2009-11-17 01:42:15 +01:00
Carlos R. Mafra
4932433b95 Remove DEMATERIALIZE_ICON code
This animation is not as cool as the NORMAL_ICON_KABOON, so I don't
think having a choice here is justified. Let's remove this option
(it was not defined in wconfig.h.in by default) and keep using
the nicer NORMAL_ICON_KABOON.
2009-10-17 01:56:28 +02:00
Carlos R. Mafra
f9792a042a Remove SILLYNESS
This code makes wmaker a little bit bigger for no gain at all. I could
undefine SILLYNESS and forget it, but I actually also want a clean
source code to read. And the less code the better.

So now I won't get a different Info dialog on Christmas, but
my wmaker will also not carry around that code in the other 364 days
of the year.

As a result, wmaker gets ~1.7 % smaller

   text	   data	    bss	    dec	    hex	filename
 448043	  17424	   8200	 473667	  73a43	wmaker.new
 455340	  18360	   8328	 482028	  75aec	wmaker.old
2009-10-17 01:38:53 +02:00
Carlos R. Mafra
96b9b22cb2 Remove #ifdef SYS_SIGLIST_DECLARED constructs
SYS_SIGLIST_DECLARED was defined nowhere and it was
clearly some dead code.
2009-10-17 01:05:28 +02:00
Johann Haarhoff
1f1eb393f8 Mod+Wheel resize increment now respects size hints
Thanks to Iains patch which showed me how to access the window hints, I
now propose the following: The resize increment is set to the closest
multiple of the size hints larger than wPreferences.resize_increment.

This should fix Carlos' complaint about fixed-increment windows resizing
too "slowly", and it also fixes my complaint about the blank space below
the last line of an xterm.

Thanks to:
    Iain Patterson <wm@iain.cx>
2009-10-13 12:17:57 +02:00
Iain Patterson
bf88570a5f Respect size hints when resizing with wheel.
Use height and width increment when wheel resizing if size hints are
set on a window and meaningful height and width increments are
specified.
Windows which don't care about their resize increments will have height
and width increments set to 1.  For these windows - and windows without
resize hints at all - use the setting configured with ResizeIncrement.
2009-10-12 15:24:13 +02:00
Carlos R. Mafra
a3246cfe3b Remove remaining sound stuff from WPrefs etc
Let's remove the configuration options about "sound" from
WPrefs (as it was never fully functionall anyway) and from
configuration files.

Remove also the xpm and tiff icons.
2009-10-12 03:02:24 +02:00
Carlos R. Mafra
c5f027d811 WPrefs: trivial coding style fixes 2009-10-12 02:41:27 +02:00
Carlos R. Mafra
af8cec15e3 Remove repeated functions enclosed by #if 0
There are already working versions of these functions,
so let's remove these copies.
2009-10-12 01:02:19 +02:00
Carlos R. Mafra
15e37ff942 Remove #ifdef NETWM_HINTS constructs
NETWM_HINT is always defined in src/wconfig.h.in, so
let's remove it from there too.
2009-10-12 01:00:19 +02:00
Carlos R. Mafra
347e804bb6 A few trivial code style cleanups 2009-10-11 23:30:41 +02:00
Johann Haarhoff
a063338175 Mod+Wheel Window Resize
This patch adds the ability to resize windows with the mouse wheel
while holding the Mod key. This currently ignores wWindowConstrainSize
until I can figure out a way to repeatably resize windows with
fixed size increments (like xterm) using this method.

This also adds a slider to WPrefs to choose the increment with which
the wheel will resize a window.
2009-10-11 22:17:54 +02:00
Carlos R. Mafra
781b663341 HOWTO: The perfect Window Maker patch
This document is a very brief description about how you can
create a patch "the git way", so that it can be applied
easily with 'git am'.
2009-10-11 17:37:18 +02:00
Carlos R. Mafra
09140a82b9 Increase granularity of 'shrink/zoom' animation
Now it is a bit easier to actually enjoy the animation :-)
2009-10-10 19:55:57 +02:00
Carlos R. Mafra
87161c5e0c Remove MINIATURIZE_ANIMATION_DELAY_{Z,F,T} tests
We know that they are non-zero because we set their
values explicitly in wconfig.h.in, so there is no
point in checking them.
2009-10-10 19:30:04 +02:00
Carlos R. Mafra
cda27758bc Add function prototypes in action.h and include it in superfluous.c 2009-10-10 19:29:56 +02:00
Carlos R. Mafra
b014ef2770 Remove 'hiding' parameter from animateResize()
It was a bit pointless.
2009-10-10 19:03:12 +02:00
Carlos R. Mafra
e9309e1e39 Delete WINDOW_BIRTH_ZOOM and default to WINDOW_BIRTH_ZOOM2
WINDOW_BIRTH_ZOOM was a bit lame and it makes sense to not have
it at all. So remove the trailing "2" of WINDOW_BIRTH_ZOOM2 and
make it the only choice (you can #define it in src/wconfig.h.in).

Note that it uses the same algorithm as the animation to resize,
ie zoom, twist or flip. You can choose them in WPrefs.
2009-10-10 18:27:52 +02:00
Carlos R. Mafra
06d3360224 Remove 'ghost window move' code
GHOST_WINDOW_MOVE was not defined anywhere. Let's remove that
code.
2009-10-10 00:05:58 +02:00
Carlos R. Mafra
9d6728d3e7 Remove SPEAKER_SOUND dead code
SPEAKER_SOUND is defined nowhere, so this code was not being used
and I don't want its functionality anyway.
2009-10-09 23:59:37 +02:00
Carlos R. Mafra
2765bec3e4 Remove sound support
Two reasons for removing it:

    1) I won't ever want to hear useless sounds

    2) The sound support is a bit of a joke. The code is there but you have
       to hunt it somewhere else (not in any repository that I know of).
       In my 10 years of using wmaker, I never used it for this reason.
       Now I consider having no sound in Window Maker a feature, and I like
       it that way. So there is no point in carrying useless code around.

PS: There is still the code in WPrefs to be removed.
2009-10-09 20:04:47 +02:00
Carlos R. Mafra
7df49cce14 Clean up contrib/ folder
Let's remove the "single click" patch from there.
2009-09-24 23:53:03 +02:00
John H. Robinson, IV
21eb8456ba Updated documentation
Updated URIs
Removed stale/outdated information
Reformatted for 80 columns
2009-09-24 23:41:36 +02:00
Iain Patterson
bc3995bf6b Fix msgfmt error with Armenian translation.
msgfmt said:

hy.po:685: `msgid' and `msgstr' entries do not both end with '\n'

Fixed by adding newline as in original text.
2009-09-24 23:41:10 +02:00
Norayr Chilignaryan
7f457fa275 Window Maker armenian translation 2009-09-24 23:40:46 +02:00
Carlos R. Mafra
484bdbe7d4 Ansify function declarations
I've just noticed them en passant.
2009-09-24 23:40:39 +02:00
Martin Dietze
ef2f5a6f29 Fix automatic Debian builds 2009-09-24 10:13:44 +02:00
Carlos R. Mafra
12b6be768e swpanel: Fix focus issue when alt-tabbing
The problem was the following. While alt-tabbing from one
window to a xterm, wait for the xterm to be raised but
keep the alt key pressed. Now move the mouse cursor
over the xterm and release the alt key.

The result is a xterm in a zoombie focused state; its titlebar
has the focused color but xterm itself is not focused and does
not accept any input.

Fix this by reinstating the check for a NULL pointer from
wSwitchPanelHandleEvent() before changing focus. That function
detects if the mouse cursor moved over to the same window which
is currently being pointed out by the switchpanel, and returns
NULL in this case (the check for panel->current != focus fails).

Thanks to Paul Harris for reporting it!
2009-09-19 16:07:47 +02:00
Carlos R. Mafra
6a0120f014 Maximus: Some cleanups and bug fixes
Let's ignore hidden windows and also adjust the coordinates
a bit, to avoid ~2 pixels of overlap.

I thank Paul Harris for pointing out these bugs.
2009-09-19 16:07:03 +02:00
Carlos R. Mafra
0a0c2391de Maximus: Avoid a window list order issue
If we compute the maximus geometry in only one pass through
the window list, the order in which the windows appear in
the list can affect the outcome.

That is because before computing the intersections in the
y-projections we update the y coordinates from whatever window
which happened to change the new_y coordinate during the
previous x-intersection computations, but that may not be _the_
blocking window which decides the final positions in the y axis.
Therefore we may find that this "intermediate window state"
has a non-vanishing y-intersection with another one -- and
be blocked by it -- even though that should not be the case for
the final outcome.

So to avoid that we first scan through all the windows to decide
the final maximumized coordinates in the y axis. Only after that we
compute the x-coordinates.
2009-09-19 16:06:48 +02:00
Carlos R. Mafra
7a86f48f73 Fix --disable-verbose-compile
Remove an extra $(QUIET), as that was causing a few annoying
messages during the compilation of libraries.
2009-09-19 16:06:18 +02:00
Alexey Voinov
3953f53680 WINGs shared library generation
This patch modifies the linking of the WINGs libraries
to create a shared library. wmaker used to do this, but
it was dropped around wmaker-0.90/0.91.
The shared .so library is needed when compiling and running
the wdm display manager and any other programs which link
to libWINGs.

Submitted by: Gilbert Ashley
Origin: ALT/Sisyphus Linux
2009-09-19 16:06:05 +02:00
Carlos R. Mafra
92eff967a7 Maximus: Consider the full_maximize window attribute
When maximumizing a window which has the full_maximize attribute
set we have to consider two possibilities:

    1. If the new y coordinate is zero it means that no other
       window blocked its maximumization up to the top of the
       screen, so we want to put the titlebar outside.

    2. If the new y coordinate is not zero it means that another
       window in the current workspace blocked its way to y = 0.
       In this case we do nothing with the titlebar.

Note that there is another possible fine tunning which is not
addressed in this patch, which is to consider the resize bar.
2009-09-17 00:46:14 +02:00
Carlos R. Mafra
eaca92db50 Simplify wMaximizeWindow() a little bit
Let's avoid checking the existence of a border every time
we want to adjust the widths. So we'll always subtract the correction
factor, which is zero in case the window has no border.
2009-09-17 00:46:14 +02:00
Carlos R. Mafra
1a85719971 Increase the readability of SlideWindow()
It is easier to read the computations if the variables
have shorter names. At the same time it avoids reading
the struct array elements repeatedly, so as a bonus
misc.o gets 64 bytes (0.5%) smaller

[mafra@Pilar:wmaker.git]$ size src/misc.o.*
   text    data     bss     dec     hex filename
  11125       0    4104   15229    3b7d src/misc.o.new
  11189       0    4104   15293    3bbd src/misc.o.old
2009-09-17 00:44:36 +02:00
Alexey I. Froloff
5979162878 Fix race condition during workspace changes
When changing workspaces, after focusing new window, wmaker handles all
pending events.  If it receives another change-workspace combination,
you may end up with a workspace without any focused window.

Ctrf-F1 and Ctrl-F2 used to switch to 1st and 2nd workspaces.
Hold Ctrl and press F1 and F2 almost at the same time.

This patch ignores all change-workspace commands while workspace
change is in progress.

See also https://bugzilla.altlinux.org/show_bug.cgi?id=7230

[crmafra: Thanks to Alexey I. Froloff for the above explanation]
2009-09-15 20:14:55 +02:00
Carlos R. Mafra
306165775e Yet another trivial coding style cleanup 2009-09-15 20:06:04 +02:00
Carlos R. Mafra
c7f2a189c4 Fix the call to XChangeProperty() in 64-bit mode
The man page of XChangeProperty() says:

  "If the specified format is 32, the property data must be a
   long array."

And as we call it with format 32, the type of 'data' must
be 'long'. It happens to work nowadays in 32-bit architectures
because sizeof(CARD32) = sizeof(long), but that is no longer
true in 64-bit mode.

This patch was downloaded from
www.openbsd.org/cgi-bin/cvsweb/ports/x11/windowmaker/patches/patch-WINGs_wwindow_c
and I thank Alexey I. Frolov and Vladimir Nadvornik for helping me
to understand it on a wmaker-dev thread.
2009-09-15 12:52:14 +02:00
Carlos R. Mafra
ca2c1f900d Trivial coding style fix 2009-09-15 01:52:35 +02:00
Iain Patterson
18408fff93 Mac OS X-style window cycling.
For those not familiar with the way Macs cycle windows, the Command-Tab
sequence (Alt-Tab elsewhere) switches between DIFFERENT application windows
and Command-Grave (key above tab) switches between windows owned by the
SAME application as is currently focused.  So if you had three Safari and
two Finder windows open, and Safari had focus, Command-Tab would switch to
Finder; Command-Tab would switch back to Safari; Command-Grave would switch
to a different Safari window etc.

This patch implements "something like" the above by only populating the
switchpanel with windows matching the currently-focused WWindow's wm_class
when the new cycling mode is activated.  In practice this means you can
switch to The Next XTerm or The Next Firefox Window using this method.

The configuration names for these new shortcuts are GroupNext and
GroupPrev.  The patch tells WPrefs.app about them.  Of course switching to
The Next Window is still possible with the (unchanged) FocusNext and
FocusPrev keys.
2009-09-14 16:51:26 +02:00
Iain Patterson
5c46f48898 Support Xinerama in wmsetbg.
Allow wmsetbg to revert to pre-0.90.0 behaviour when choosing a
background image that is large enough to span several heads in a
Xinerama setup.  If the -X flag is passed to wmsetbg, the background
image will be stretched to fill the logical screen (as it would be by
default in older versions of wmsetbg) instead of being tiled across
screens.
2009-09-14 16:51:26 +02:00
Iain Patterson
567279b962 Pad workspace name display.
Shift the workspace name, shown when switching workspaces, by 32
pixels.  This is purely for aesthetic reasons.  It just looks better
(IMO) than having the name flush against the screen edge.
2009-09-14 16:51:26 +02:00
Iain Patterson
1a27b34160 Constrain switching workspace name to one head.
When switching workspaces, force the name to be shown entirely within
one head of a Xinerama display. Previously the name would span heads if
set to TOP, CENTER or BOTTOM alignment, and was hence hard to read when
the display comprised an even number of heads.
2009-09-14 16:51:26 +02:00
Carlos R. Mafra
9789cf3154 Add Maximus key back in WPrefs.app
Somehow I had forgotten to include this change in version 2
of the patch.
2009-09-14 16:51:26 +02:00
Carlos R. Mafra
513a509096 Fix the use of uinptr_t
Remove the additional cast to (int), as that makes no sense.
2009-09-14 16:51:26 +02:00
Alexey Voinov
f6645ac564 x86_64 mmx fixes
This patch combines two small patches which fix issues with x86_64 and mmx in
the configure script.

Submitted by: Gilbert Ashley
Author: unknown?
Origin: ALT/Sisyphus Linux, Alexey Voinov <voins@altlinux.ru>
2009-09-14 02:09:35 +02:00
Nicolas Bonifas
cf0f7d68d5 Un-maximize window inside current head
If the old_geometry coordinates were saved while the window
was in another xinerama head, use current coordinates as
the old ones to avoid making the window jump heads when
un-maximizing it.
2009-09-13 23:33:39 +02:00
Nicolas Bonifas
3106292f4b Maximus: Use unsigned int for width/height variables
And move its prototype to actions.h (and also that of
save_old_geometry()).
2009-09-13 23:32:15 +02:00
Nicolas Bonifas
e42586c712 Remove commented code in xinerama.c 2009-09-13 23:32:09 +02:00
Tamas TEVESZ
0a47a19b3e Remove bundled wrlib stuff
This patch removes bits and pieces of xmu that for some reason
have been bundled with wmaker. I can very well imagine that at the time
they were bundled, xmu was not, was not available everywhere, or
whatever.

I couldn't come across a system that doesn't have these things in its
system-supplied x libs, though i've been carrying this since january,
and my memory is quite flakey at times.

certainly nothing xorg is at danger, nor xfree86 dating back to at
least 3.3. i believe this stuff should be everywhere that calls itself
to be on par with x11r6.3 at the very least.

it would be incredibly useful if people having access to commercial
unixes could check this on things released in the past, say, 15 years.
i believe back then i had solaris 8+and sco openserver 5+ covered.
2009-09-13 21:40:47 +02:00
Nicolas Bonifas
e4fcd515fe Maximizing a resized window
When a maximized window is resized (either using wmaker or because the
application changed the window size), and you want to maximize it again,
you first have to unmaximize it (because wmaker thinks the window is still
maximized), and only then you can maximize it. The following patch
corrects this behaviour.
2009-09-13 19:17:59 +02:00
Carlos R. Mafra
4bce3e3805 Make left/right maximization work again
The patch "Clean up maximization and un-maximization logic" introduced
a regression wrt to the left/half maximization feature, due to a C
operator order precedence issue.
2009-09-13 18:32:43 +02:00
Carlos R. Mafra
cbd13dd95f Ansify function declaration 2009-09-13 16:07:54 +02:00
Carlos R. Mafra
18c7a20136 Delete stale .cvsignore files 2009-09-13 12:59:25 +02:00
BERTRAND Joel
816fee1b68 Fix miniwindows auto-arranging bug
With this patch, minimized windows do not reshuffle anymore.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=361241
where Martin Hinsch reported:

"The behaviour of icons (minimized applications) is severely broken when
 automatic placement is switched on.
  * When switching the workspace icons often stick thereby covering (and
    hiding) icons on the workspace one is switching to.
  * After minimizing an application, clicking (singly or doubly) on one of
    the icons causes all of them to reshuffle, usually in a way that the
    icon in question changes its place (which is extremely annoying).
  * Icon placement ignores the dock so that icons disappear behind
    it/cover it.

 All of these suddenly appeared about a year ago (I think with 91.0). The
 problems are not architecture-specific since they occur in exactly the
 same way on my pentium machine. Wiping the complete configuration (rm -r
 ~/GNUstep) did not make a change either."
2009-09-11 10:24:54 +02:00
Andreas Tscharner
5b93254d0f Fix compilation failure
This fixes a compilation failure with gcc-4.3.4, where it complains

nxpm.c: In function RGetImageFromXPMData:
nxpm.c:99: error: expected expression before ] token
...
2009-09-09 22:18:34 +02:00
Alexey Voinov
62bf6d17b5 Fix session saving for apps with shared appicons
This patch comes from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
2009-09-06 17:12:24 +02:00
Carlos R. Mafra
8efc490361 Reduce the number of simultaneous inotify events
There is no point in having a buffer capable of 512 simultaneous events,
as it will typically be only 1. But increase the value for the length
of the path + filename to 64 (which is a reasonable size for a
typical /home/something/GNUstep/Defaults/WMRootmenu filename).
2009-09-04 15:02:00 +02:00
Alexey Voinov
5f5b1df7d2 Christmas does not last forever
From https://bugzilla.altlinux.org/show_bug.cgi?id=3480

  "If you open "Info Panel" on 25 dec (Christmas), the
   "Christmas tree" is shown. And after that on all days
    Christmas tree is shown. (Until you restart WM, i think)"

Taken from http://git.altlinux.org/people/raorn/packages/WindowMaker.git
2009-09-03 23:56:33 +02:00
Carlos R. Mafra
88ab8b74b4 wmrlib: Avoid code duplication
We can put common repeated code into a helper function, and
increase readability a bit.
2009-09-03 23:56:33 +02:00
Alexey I. Froloff
2ccc8e4a79 Remove alloca(3)
And use malloc() instead.

See "Dropped useless use of alloca(3)" from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
2009-09-03 21:10:48 +02:00
Alexey I. Froloff
8490e31fde Atomic save for session
This patch is part of "Atomic saves for history and session" from
http://git.altlinux.org/people/raorn/packages/WindowMaker.git
2009-09-03 20:20:12 +02:00
Alexey Voinov
05720d9707 Add history to some dialog boxes
This patch adds history to some dialog boxes. To use it replace %a with
%A in menu file (like in "Run..." menu item). You can specify third
parameter to %A to use different histories for differen dialogs.

All history files is kept in ~/GNUstep/.AppInfo/WindowMaker/ and the number of
history lines controlled by DialogHistoryLines parameter (one for
all dialogs) defaults to 500 lines.

It also adds Tab completion.

Origin: ALT/Sisyphus Linux, Alexey Voinov <voins@altlinux.ru>
2009-09-03 15:44:11 +02:00
Sebastien Bauer
f8dd3dc49e Add option to allow starting DockApps with a single click
This patch is from the contrib directory. It adds an option to allow starting
DockApps with a single click. It's a handy option that adds only a few lines to
the code.

It is a good feature patch example because it includes modifications
to the WPrefs application so that the feature can be easily enabled or
disabled. The one-click ability allows wmaker to integrate more seemlessly with
programs like ROX-Filer which can be configured to use single or double click
actions.

The README in the contrib/ directory says,

author:
Sebastien Bauer <seb_bauer@bigfoot.com>
John Morrissey <jwm@horde.net>

updated for Window Maker 0.65.0 by:
Daniel Richard G. <skunk@graphics.lcs.mit.edu>

updated for Window Maker 0.80.2 by:
Martial Daumas <martial@nasgaia.org>

update for 0.80.2+ by:
steve lion <steve.lion@verizon.net> and vlaad
2009-09-03 15:19:10 +02:00
Carlos R. Mafra
c04a2caeab Clean up maximization and un-maximization logic
We should not try to un-maximize the windows from inside
the function wMaximizeWindow(), as that makes no sense.

If the window is already maximized then we don't call
wMaximizeWindow() anymore and call wUnmaximizeWindow()
instead, which will use the old geometry regardless
of which maximization is active (horizontal, vertical,
maximus, etc). And the old geometry now is also saved
when we enter wMaximizeWindow().

So when we call wMaximizeWindow() or wUnmaximizeWindow()
we really mean "maximize to the specified state" or
"go back to whatever old geometry coordinates we had before".
2009-09-02 04:42:19 +02:00
Carlos R. Mafra
cf62d1591f Maximus: Tiled Maximization
This patch introduces the "tiled maximization" feature, a.k.a. Maximus.

By pressing the keyboard shortcut associated with Maximus, the focused
window will be maximized to the greatest area satisfying the constraint
of not overlapping existing windows.
2009-09-02 04:42:05 +02:00
Daniel Déchelotte
7857f297ea Fix for omnipresent AppIcon bug at startup
Bug overview: right after start up, omnipresent AppIcons (living in the Clip)
    are displayed but non-functionnal.

    How to reproduce it: place two AppIcons in the Clip, make the first one (A)
    omnipresent and leave the second one (B) as is. Make the Clip "autocollapse".
    Switch to the second workspace and restart wmaker. Wmaker starts in the first
    workspace; the Clip is closed (its text color corresponds to the closed state,
    AppIcon B is not shown). However, AppIcon A is displayed.  Moreover, A does
    not react when the Clip expands or collapses.  Finally, a click on A makes it
    disappear. Fortunately, changing to another workspace fixes the problem
    definitively.

    Explanation and correction: internally, wmaker maintains as many clips as
    workspaces. When the user switches to another workspace, the omnipresent
    AppIcons are moved to the new "current" clip. In the situation above (trying
    to reproduce the bug), when wmaker restarts, the omnipresent AppIcons are
    restored in the second workspace, whereas the first workspace is active. In
    the previous code, a "hack" (calling XMapWindow()) unconditionally displayed
    the omnipresent AppIcons. The proposed patch makes sure the omnipresent
    AppIcons are moved to the first workspace on wmaker startup.
2009-09-02 00:17:27 +02:00
Tamas TEVESZ
b37e065252 Clean up #ifdef mess
Use enum instead of #ifdef maze for enumerating keybindings
2009-09-01 14:31:08 +02:00
Daniel Déchelotte
d7183d33b4 Gobble "spurious" EnterNotify events when moving an appIcon or a dock
This is a bug fix. Bug overview: if an AppIcon is moved rapidly over a Clip
    set to auto-expand, the latter may erroneously auto-expand afterwards.

    How to reproduce it: set a Clip to auto-collapse, and make sure it contains a
    (random) AppIcon, so as to easily visualise its open/close state. Now move
    rapidly an AppIcon over the Clip. Try to move it so fast that the cursor
    sometimes is out of the AppIcon's tile. Then, replace the AppIcon out of the
    Clip.

    Explanation and correction: if, while the AppIcon was being moved, the mouse
    cursor entered at least once in the Clip's tile, the latter is going to
    receive an EnterNotify event (after the AppIcon is replaced) and thus expand
    automatically after the relevant delay. The solution is to simply "gobble"
    (i.e., ignore) all EnterNotify events when moving an AppIcon.
2009-09-01 14:12:55 +02:00
klaasvakie
2ed9c12ee5 Fix half_scr_width calculation
Moved the half_scr_width calculation to after the

usableArea = wGetUsableAreaForHead(scr, head, &totalArea, True);

call. This fixes the problem where windows that get "half screen
maximized" cover the dock or clip.
2009-09-01 13:57:58 +02:00
Carlos R. Mafra
229b6984de Use half_scr_width instead of computing it each time
Let's use

    half_scr_width = (usableArea.x2 - usableArea.x1)/2;

to shorten the expressions in the left/right half maximize
code.
2009-08-30 16:28:23 +02:00
Carlos R. Mafra
a1f35d7f5b Increase the readability of wUnshadeWindow() and wShadeWindow() a little bit
Instead of open coding the animation routines in the function bodies,
put them in a helper function called shade_animate(wwin, what), whose
second argument can be SHADE or UNSHADE.
2009-08-30 00:58:18 +02:00
Carlos R. Mafra
34be9d7816 Trivial coding style changes
Some trivial style changes I made while reading src/placement.c
2009-08-30 00:51:27 +02:00
Tamas TEVESZ
9af6316d1d k&r->ansi some stuff
ansify and "fix" function pointer declarations
2009-08-29 21:49:22 +02:00
Johann Haarhoff
6924454836 Left Half / Right Half Maximize
This adds Left Half / Right Half Maximize capability to WindowMaker.
It allows you to maximize a window to only the left or right half
of your screen.

It is useful on widescreen displays where one might to bring up
two different windows side-by-side.
2009-08-29 21:49:16 +02:00
Carlos R. Mafra
328251c68a Define TITLEBAR_HEIGHT in default configuration file
...and use it in src/placement.c

And while we are at it, clean up a bit the visual of wconfig.h.in
2009-08-28 21:21:03 +02:00
Carlos R. Mafra
2f87d01a41 Make wmaker 0.11% smaller by avoiding code duplication
This patch cleans up an obvious code duplication case in the
different "placement" algorithms.

Avoid this needless repetition by using a helper function,
which in turn lets those functions a bit easier to read and
also makes wmaker 0.11% smaller :-)

[mafra@Pilar:wmaker.git]$ size src/.libs/wmaker.*
   text    data     bss     dec     hex filename
 619824   19160    8544  647528   9e168 src/.libs/wmaker.new
 620552   19160    8544  648256   9e440 src/.libs/wmaker.old
2009-08-28 20:18:18 +02:00
Martin Dietze
22730876e4 Nightly Build script can now deal with testing and unstable branches. 2009-08-28 19:04:29 +02:00
Gilbert Ashley
be08535ab4 Show app name in Kill Application dialog
The "Kill Application" dialog window doesn't always show the
application name when killing DockApps. It shows its wm_class
instead, which is not always the same as the app name.

This patch allows the Kill Application dialog window to show
the application name in the window -- as expressed by using the
basename of the path to the application.

[crmafra: Added wtokensplit() to get only the app name]
2009-08-27 16:35:42 +02:00
Vladimir Nadvornik
108127f0b5 Miscellaneous fixes from OpenSuse
These are some of the fixes sent to the wmaker-dev list by
Vladimir Nadvornik, with minor modifications to address Dan
Pascu's concerns.

Original-post: http://lists.windowmaker.info/dev/msg00293.html
2009-08-27 16:34:44 +02:00
Carlos R. Mafra
6d75291e1d Add config option to supress focus requests across workspaces
In commit d6c134f420 ("Do not switch
workspace to follow new windows in others") the default behavior
was changed, and workspace switching to follow focus requests was
strictly forbidden.

Although that seems to be a sane thing to do by default, that raises
concerns about whether Window Maker could be more flexible in that
respect -- allowing the user to choose which applications are or
are not allowed to do that.

This patch adds such configuration, located in the "Advanced Options"
submenu of the top-level "Attributes" menu.
2009-08-26 17:53:08 +02:00
Martin Dietze
ca60620f50 Adapted nightly build script to coexist with new 'next' branch. 2009-08-26 15:51:13 +02:00
Martin Dietze
a9aeefbe70 Fix NULL pointer dereference
Some weird applications like Safari for Windows running on CXOffice
or some applications running on Wine were causing wmaker to crash.
So let's not rely on a window's `frame' property to be not NULL in
src/wmspec.c.

Original-post: http://lists.windowmaker.info/dev/msg00161.html
See-also: http://lists.windowmaker.info/dev/msg00222.html
2009-08-25 01:10:00 +02:00
Martin Dietze
d6c134f420 Do not switch workspace to follow new windows in others
New windows should only be focused if they are in the current workspace.
Not performing this check can lead to WM switching workspaces if a
window is opened which:

   (a) is configured to appear in a particular workspace

and

   (b) sends a _NET_ACTIVE_WINDOW message to give focus to
       something, e.g. a sub window.

This behaviour was observed with firefox if a session with more
than one tab open was restored at startup because:

 "If a Client wants to activate another window, it MUST send a
   _NET_ACTIVE_WINDOW client message to the root window:"

Original-post: http://lists.windowmaker.info/dev/msg00442.html

[crmafra: Added comment]
2009-08-25 00:47:37 +02:00
Martin Dietze
442e3876c6 Add debianisation code and automatic build script 2009-08-24 11:55:20 +02:00
Martin Dietze
19f110d26e Add two menu files from the Debian package 2009-08-24 11:55:20 +02:00
Martin Dietze
3f6ae395ce Add GLOBAL_DEFAULTS_SUBDIR and fix a syntax error in wmlib/Makefile.am 2009-08-24 11:55:20 +02:00
Martin Dietze
ba027149bd Up the version number for the GIT version to 0.93.0-pre 2009-08-24 11:55:20 +02:00
Tamas TEVESZ
f893728d2d Fix format strings 2009-08-23 21:10:02 +02:00
Alexey Voinov
01dddf00c8 swpanel: Consider also the release of FOCUSPREV
The switch panel was not being destroyed with the realease of
FOCUSPREV, only with FOCUSNEXT. Fix this.

One can reproduce this bug as follows.

In the "Keyboard Shortcut Preferences" of WPrefs set "Focus next window"
to e.g. "Alt+Tab" and "Focus previous window" to "Ctrl+Tab".
The switchpanel is not destroyed if we release "Ctrl+Tab" but it
is upon releasing of "Alt+Tab".

Retrieved-from: http://git.altlinux.org/people/voins/packages/?p=WindowMaker.git;a=commit;h=51c95a55c9310f499b1fdeca138106ca7bf74423

[crmafra: Commit log]
2009-08-23 20:03:21 +02:00
Carlos R. Mafra
fe736e849c Remove LITE config option
Why?

     1. The reason for its existence is to "Disable some stuff that are
        duplicated in kde", and I don't think I will ever need that.
        Furthermore, even the description in the configure script reads
        "disable some stuff (dont use it)".

     2. It makes the code uglier at some places, e.g.,

         #ifdef LITE
                {
         #if 0
                }
         #endif
         #else

                if (!wRootMenuPerformShortcut(event)) {
         #endif

        which by the way is the ugliness which motivated this patch.

     3. Does not even compile anymore. It fails with

          CC dockedapp.o
          CC event.o
       event.c: In function 'executeButtonAction:
       event.c:711: error: WScreen has no member named root_menu
       event.c:712: error: WScreen has no member named root_menu
       event.c:713: error: WScreen has no member named root_menu
       event.c:715: error: WScreen has no member named root_menu
       event.c:720: error: WScreen has no member named switch_menu
       event.c:721: error: WScreen has no member named switch_menu
       event.c:722: error: WScreen has no member named switch_menu
       event.c:724: error: WScreen has no member named switch_menu
       make[2]: *** [event.o] Error 1
       make[1]: *** [all] Error 2
       make: *** [all-recursive] Error 1

       But instead of fixing this (it would be trivial), let's get
       rid of the whole ugliness altogether.
2009-08-23 18:45:30 +02:00
Carlos R. Mafra
874b0fadf5 Add spaces to gcc 'case' range extension
According to the gcc manual, that is safer.
2009-08-23 17:28:04 +02:00
Carlos R. Mafra
31f16389f6 Fix function prototype declaration
It is safer if the functions are declared with proper
prototype specifications.

This patch addresses some of the warnings with -Wstrict-prototype,
like this:

event.c:105: warning: function declaration isn't a prototype
2009-08-23 15:15:29 +02:00
Pedro Martelletto
2706f7217c WPrefs: Fix crash due to wtokenfree() memory leak fix
After the fix to avoid a memory leak in wtokenfree(), WPrefs crashes
when opening the 'Applications Menu Definition' dialogue.

The problem is that WPrefs code relied on the fact that the first token
in the array would not be free'd by wtokenfree(), a misbehaviour which
is correctly addressed with this patch.

Retrieved-from: http://www.mail-archive.com/ports@openbsd.org/msg12731.html

[crmafra: small changes in the commit log from the webpage]
2009-08-22 20:51:47 +02:00
Tobias Stoeckmann
e522ca734d WINGs: Fix memory leak in wtokenfree()
wtokenfree() does not free the first entry of an array.
If count is 1 then

   while (--count)

will be

   while (0)

and the inner body of that while-loop will not be entered.
Therefore a memory leak happens every time wtokenfree() is called.

Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/patches/

[crmafra: This patch, altough correct, breaks WPrefs.app, which will be
fixed by the next patch. ]
2009-08-22 20:40:27 +02:00
Nicolas Bonifas
3a0eb643d9 swpanel: Start with the first window when all are minimized
When all windows are minimized, the switch panel cursor is
initially on the second window in the list. With this patch
it will be on the first window.
2009-08-22 13:03:56 +02:00
Carlos R. Mafra
f79379c090 swpanel: Fix stacking issue with swpanel escape handling
Daniel Déchelotte reported one problem with the escape handling in
the switchpanel:

   "Start with two windows: a fullscreen one, and a smaller window
    that appears above the fullscreen one. With the mouse, focus the
    bigger window. Start alt-tabbing, then press Escape. The bigger
    window will then be focused (good) *and raised* (small problem)."

Fix this by adding a test for the escape key before calling
raiseWindow().
2009-08-22 03:08:05 +02:00
Carlos R. Mafra
001bc28037 swpanel: Factor out if (swpanel) test
We can remove redundand tests in each "case:" inside the
switch if we do it in the beginning.
2009-08-22 03:08:05 +02:00
Carlos R. Mafra
203eba8937 swpanel: Clean up "case ButtonRelease"
Get rid of 2 tabs indentation by removing a
not-strictly-necessary temporary variable.
2009-08-22 03:08:05 +02:00
Carlos R. Mafra
d27e43e6b5 swpanel: Clean up StartWindozeCycle() a bit more
We can put the test for 'newFocused' inside change_focus_and_raise()
to clean up the code a little bit.
2009-08-22 03:07:34 +02:00
Tobias Stoeckmann
1db15a3543 Fix multiple errors in findfile.c
Problems:

1.

  During expansion of path, the resulting path can overflow the supplied
  area of PATH_MAX+2 (buffer as well as buffer2). A tampered environment
  variable can be used to modify program flow.

Proof:
      [note: wmaker has been compiled with propolice]
      $ export A="[tested with 4096x A]"
      $ GNUSTEP_USER_ROOT="\$A\$A/\$A/\$A/" wmaker --for-real
      *** stack smashing detected ***: wmaker terminated
      Aborted

2.

  Way too many functions handle a return value of NULL for wexpandpath
  improperly, resulting in segfaults (and maybe other problems). To
  prove the existance of these issues:

Proof:
      $ GNUSTEP_USER_ROOT=~nouser wmaker --for-real
      wmaker error: could not get password entry for user nouser: Success
      Segmentation fault

Solution:

     hard exit with error message about what is going on.

3.

  The improper parsing of environment variables can lead to expansion
  of path names that were not intended to be expanded.

     (a) If a string like "$(var" is found, Window Maker tries to expand "var"
     	 (environment variable) although the syntax is wrong.

Proof:

      $ export PROOF=foo
      $ GNUSTEP_USER_ROOT=/\$\(PROOF wmaker --for-real
      wmaker warning: could not find user GNUstep directory (/foo/Defaults/WindowMaker).

      (b) If the variable out of a) cannot be resolved, a closing bracket will be
      	  added.

Proof:

      $ unset PROOF
      $ GNUSTEP_USER_ROOT=/\$\(PROOF wmaker --for-real
      ./wmaker warning: could not find user GNUstep directory ($(PROOF)/Defaults/WindowMaker).

Author: Tobias Stoeckmann
Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
2009-08-21 12:13:12 +02:00
Daniel Déchelotte
c970c94f82 Remove useless tests
There is no point in checking

      if (dock_state)

if the function would have already returned with
the check if(!dock_state) right above.

Retrived from http://yo.dan.free.fr/wmaker.phtml.en

[crmafra: wrote the commit message]
2009-08-21 04:57:08 +02:00
Carlos R. Mafra
570df8316d Fix use of uninitialized variable
Gcc-4.3.2 warns:

texture.c: In function 'wTextureMakeFunction':
texture.c:393: warning: 'fallbackColor.pixel' is used uninitialized in this function

Based on a patch by Vladimir Nadvornik.
2009-08-21 02:20:27 +02:00
Vladimir Nadvornik
21b5df494b Less strict font requirements
Fixes bug:

  https://bugzilla.novell.com/show_bug.cgi?id=154758
2009-08-21 02:10:50 +02:00
Vladimir Nadvornik
e113ec10c9 Fix findBestIcon()
This patch fixes the issue described here:

https://bugzilla.novell.com/show_bug.cgi?id=371974
2009-08-21 01:54:26 +02:00
Daniel Déchelotte
95a576bd62 Fix "smart" placement bug when there are shaded windows in other workspaces
Bug overview:
    New windows are sometimes mis-placed when the "smart" algorithm is used.

How to reproduce it:
    be sure (with WPrefs.app, for instance) to use the so-called "smart"
    window placement algorithm. In an empty workspace, open a first window
    (for instance, an xterm). The window should appear at the upper left corner.
    Shade it (hide its contents below its title bar by double-clicking on it)
    and select another empty workspace. Open another window. Instead of placing
    it at the exact same place as the first window, wmaker places the new
    window a little bit lower, or frankly to the right.

Explanation and correction:
    when placing a new window, wmaker avoided all shaded windows, instead of
    only avoiding the shaded windows on the active workspace.
2009-08-20 23:59:41 +02:00
Daniel Déchelotte
3f7110b120 Fix focus issues with the switch panel and auto-focus
1. Setup two windows in a workspace, one at the center and the
   other at a corner. Move the mouse to the center of the screen, so
   that the focus goes to the center window. Now, with the help of the
   keyboard (with Alt-tab, typically), try and switch the focus to the
   other window. In doing so, the switch panel shows up, gives the
   focus to the other window and then disappears. However, its
   disappearance make it seem to wmaker that the mouse has just
   entered the center window, so wmaker gives the focus to that
   window again.

   2. It is a lit bit more involved. "Raise window when switching
   focus with keyboard" needs to be set. In a given workspace, maximize
   a first window A, then setup "above" window A two windows B and C
   (one in the upper left corner and the other one in the lower right
   corner, for example). Move the mouse so as to give the focus to
   window B. Press the Alt key, hit the key tab once (window A moves
   up to the "top"), then another time (window C is then selected).
   Eventually relase the Alt key: window B is given the focus again.

Correction: it is a matter of ignoring some (EnterNotify) events
when the switch panel is active or has just been used.
2009-08-20 22:07:10 +02:00
Carlos R. Mafra
f9bb2a428a Escape key handling in switchpanel
Pressing the escape key (ESC) while the switchpanel is active
cancels it and gives the focus back to the window which had it
before the switchpanel was invoked.

If all windows are minimized before the switchpanel was called,
they will continue to be if ESC is pressed.

In other words, pressing ESC is like going to the parallel universe
where you never entered the switchpanel in the first place.

Based on a patch by Nicolas Bonifas from 17.08.2009.
2009-08-20 16:00:26 +02:00
Carlos R. Mafra
333dbf5418 Use helper function in StartWindozeCycle()
This way we avoid code duplication in 6 places.

This changes the previous behavior of the first
instance because the helper function has an extra

       CommitStacking(scr);

 compared to the original code. But it should not
 hurt to have it.
2009-08-20 15:46:45 +02:00
Carlos R. Mafra
a9238c99b9 Clean up coding style in StartWindozeCycle()
No functional changes were made apart from
setting the various KeyCode variables at the
same time as defining them.
2009-08-20 15:09:07 +02:00
Carlos R. Mafra
4a041b6f0a Clean up StartWindozeCycle()
We can get rid of one overall tab by moving the

   if(swpanel)

test -- which was done everytime in each individual case --
to the beginning, therefore encompassing all cases.
2009-08-20 04:07:15 +02:00
Carlos R. Mafra
688a56e8ab Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
    echo $arq;
    indent -linux -l115 $arq;
    done

The different line break at 115 columns is because
I use a widescreen monitor :-)
2009-08-20 00:59:40 +02:00
Carlos R. Mafra
59fc927dc9 Make drawIconProc() static
It is used only inside src/dialog.c
2009-08-20 00:57:03 +02:00
Carlos R. Mafra
066af13b5c Clean up case switching in handleKeyPress()
GCC has an extension to deal with ranges within case statements.
Let's use it to make the code more readable and ~5% smaller,

[mafra@Pilar:wmaker.git]$ size src/event.o.*
   text    data     bss     dec     hex filename
  13087       0    1056   14143    373f src/event.o.new
  13711       0    1056   14767    39af src/event.o.old
2009-08-19 22:11:15 +02:00
Carlos R. Mafra
e2d8cbe238 Remove unsigned type from 'mask'
gcc-4.3.2 warns:

    defaults.c: In function 'getModMask':
    defaults.c:2586: warning: comparison of unsigned expression < 0 is always false

    The line in question is

        if (mask < 0)

    and 'mask' is the return of wXModifierFromKey() which is an 'int' and can
    indeed return a negative value (see src/xmodifier.c), so let 'mask' be
    an 'int' too.
2009-08-18 16:28:43 +02:00
Carlos R. Mafra
cb31fd374c Sanitize calling sites of wDefaultsCheckDomains()
There is no point in having parameter in wDefaultsCheckDomains() and
not using it, so let's simply remove the parameter altogether and
avoid silly-looking things like

    wDefaultsCheckDomains("bla");
2009-08-18 16:20:18 +02:00
Carlos R. Mafra
f4fd88b8a9 Make loop variable be unsigned int
gcc was complaining in a few places things like:

defaults.c:890: warning: comparison between signed and unsigned

so let's just make the loop counting variables be unsigned, as
the never get negative anyway.

I also spotted other two variables which can be unsigned too.
2009-08-18 16:19:48 +02:00
Carlos R. Mafra
f36ab39680 Fix variable shadowing
gcc-4.3.2 warns:
defaults.c:3136: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here

and in a few other places too. Fix this by renaming 'index' to 'widx'.
2009-08-18 16:17:28 +02:00
Carlos R. Mafra
0a32ecf1fe WMCreateFont: Add missing wfree()'s
I removed (forgot) them when in commit ee28b0257a ("Avoid returning
font=NULL in WMCreateFont()"). Add them back.
2009-08-18 04:33:39 +02:00
Carlos R. Mafra
9baff1363c handleKeyPress: Fix shadowing of global 'index' variable
GCC warns:

event.c: In function 'handleDestroyNotify':
event.c:676: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here
event.c: In function 'handleKeyPress':
event.c:1435: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here

So let's rename "index" to "widx".

Note that there is a more serious shadowing in this same function,

event.c:1686: warning: declaration of 'wwin' shadows a previous local

but this is more complicated to solve.
2009-08-18 00:56:09 +02:00
Carlos R. Mafra
f18567db9a inotifyHandleEvents: Reduce buffer size to avoid huge memory consumption
inotifyHandleEvents() was allocating a buffer of size

 (sizeof(struct inotify_event) + FILENAME_MAX)*1024

where FILENAME_MAX is #defined to be 4096 in stdio_lim.h, therefore
it was more than 4 MB!

Reduce it by using 16 instead of FILENAME_MAX and 512 instead of 1024.

Now valgrind does not complain about things like

Invalid write of size 8
 at 0x42002F: inotifyHandleEvents (event.c:323)
 by 0x7FF00020F: ???
 Address 0x7febfc148 is on thread 1's stack

I also made some small coding style changes.
2009-08-18 00:39:45 +02:00
Carlos R. Mafra
be0d694dc2 real_main: Use setenv() instead of putenv() in remaining places
It simplifies the code a bit.
2009-08-17 22:42:38 +02:00
Carlos R. Mafra
6310e40d47 real_main: Use setenv() instead of putenv()
When investigating possible memory leaks with 'valgrind' I noticed
this leak report:

 602 bytes in 13 blocks are definitely lost in loss record 77 of 128
    at 0x4C2362E: malloc (vg_replace_malloc.c:207)
    by 0x4576ED: wmalloc (memory.c:88)
    by 0x45B4F7: wstrconcat (string.c:214)
    by 0x426FC2: main (main.c:608)

which happens here,

    str = wstrconcat("WMAKER_BIN_NAME=", argv[0]);
    putenv(str);

There is a comment further below (in another context)

/* return of wstrconcat should not be free-ed! read putenv man page */

so this leak report is probably a false positive anyway. However,
https://www.securecoding.cert.org/confluence/display/seccode/POS34-C.+Do+not+call+putenv%28%29+with+a+pointer+to+an+automatic+variable+as+the+argument
has some nice discussion about putenv() and after reading it I decided to
use setenv() instead, making 'valgrind' happy along the way. It also
makes the code a bit simpler, avoiding a call to wstrconcat().

I also changed the name of another variable called 'str' to 'pos', just
in case.
2009-08-17 22:19:58 +02:00
Carlos R. Mafra
7a84127a27 Fix improper use of function sentinel
This patch addresses this warning of gcc:

wfontpanel.c: In function 'listFamilies':
wfontpanel.c:588: warning: missing sentinel in function call

Fix it by using the 'NULL' pointer instead of 0 (zero) as the
sentinel.

For more information, see
http://www.linuxonly.nl/docs/2/2_GCC_4_warnings_about_sentinels.html
in particular,

   "On most systems, there is no difference between 0 and (char *)0.
    On 64 bit systems, however, the integer 0 is 32 bits and the
    pointer 0 is 64 bits. The compiler does not know whether it is
    an integer or a pointer, and defaults for the integer. This will
    not clear the upper 32 bits and the function will not stop
    scanning its parameters."

Note that here in my 64-bit Mandriva I don't need to cast (char *)NULL.
2009-08-17 18:13:58 +02:00
Carlos R. Mafra
288853e44f WPrefs: Remove unused function updateThemeList() 2009-08-17 17:44:00 +02:00
Carlos R. Mafra
09a8911b6f Remove unused variables
GCC -Wall complains about them.
2009-08-17 17:35:48 +02:00
Carlos R. Mafra
ceeca912cd Make compilation even less verbose
Add "-s" flag to MAKEFLAGS if --disable-verbose-compile
is enabled.
2009-08-17 16:49:22 +02:00
Carlos R. Mafra
7a3b139dcb Remove prototype of unused function StartLogShell 2009-08-16 11:14:40 +02:00
Tamas TEVESZ
e2b6a85e80 Fix buffer overflow in SendHelperMessage()
The following fixes a buffer overflow in SendHelperMessage() which i
started seeing recently on x64.
2009-08-16 01:05:23 +02:00
John H. Robinson, IV
38074e7bd5 Remove unused StartLogShell function.
Based upon a patch by Tobias Stoeckmann

Small code size reduction,

   text    data     bss     dec     hex filename
 620412   19144    8544  648100   9e3a4 src/.libs/wmaker
 621347   19152    8544  649043   9e753 src/.libs/wmaker.old
2009-08-16 00:35:54 +02:00
Tobias Stoeckmann
f516213bf3 Check for argc==0 when calling wtokensplit()
The WINGs-function wtokensplit does not set argv to NULL if no string has been
split - instead argc is set to 0.

You can only observe this issue if you compile Window Maker without any
optimization:

compile Window Maker with CFLAGS=""
run Window Maker and save a session
change session-file and replace a 'command xyz' line with 'command " "'
restart Window Maker
watch "Fatal error"-message

Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/
Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
2009-08-16 00:16:58 +02:00
Iain Patterson
bbc52564d0 xinerama switchpanel corruption fix
This is a small patch to fix an issue with the switchpanel and a large number
of windows which happens only on a Xinerama setup.

When the number of open windows is so large that displaying all of them would
cause the switchpanel to be too wide for the screen, the panel is supposed to
shrink and scroll to accomodate them all.

In Window Maker 0.92.0 this works for single head displays but not for
Xinerama. The panel extends to the next head and gets garbled. This patch fixes
the issue by correctly constraining the panel to the head with the cursor.

Submitted-by: Gilbert Ashley <amigo@ibiblio.org>
2009-08-16 00:06:31 +02:00
David Benbennick
3e9aae7a91 Fix mixing pixels when maximizing borderless windows
A minor bug has been bothering me for a long time. When you maximize a
borderless window in Window Maker, the window ends up too narrow and too short
by two pixels.

Submitted-by: Gilbert Ashley  <amigo@ibiblio.org>
2009-08-15 23:59:45 +02:00
Samir SAADA
9fa4fbef91 Fix workspace limit segfault
wmaker keeps the names of all workspaces together in
the string 'buf' with fixed length of 1024, therefore
allowing buffer overflows if the number of workspaces
is big enough.

For the default names "Workspace X" (from 1 to 9)
and "Workspace XX" (from 10 to 99) etc, the approximate
number of workspaces necessary to make the buffer
overflow occur is 80, because

(11*9) + (71*12) + 80 = 1031

The fix is to set the size of 'buf' as
the maximum number of workspaces times their maximum
name length.

The problem was reported by John H. Robinson in the wmaker-dev
list ( http://lists.windowmaker.info/dev/msg00214.html ):

 "http://www.youtube.com/watch?v=fkNJZvKwmhE

  Michael reported a problem with Window Maker where it crashes with a
  SIGSGV when trying to create an 82nd workspace.

  /usr/local/WindowMaker-0.92.1pre/bin/wmaker warning: Window Maker exited
  due to a crash (signal 11) and will be restarted.

  I was able to reproduce it by making 81 workspaces, then creating an 82nd."

[ crmafra: Wrote the changelog ]
2009-08-09 02:34:21 +02:00
Tamas TEVESZ
f21ce5768b avoid integer overflow
Actually, the whole thing is so chock full of signed vs unsigned
mixups and the assumption of all the world is 32-bit that i'm not sure
anymore that correcting them one by one is a good idea.

what would probably work best is that if someone deeply familiar with
the code (*looks in dan's general direction*) cleaned the data types
up, then legions of grunts like myself could start cleaning the rest
with relative confidence...
2009-08-09 01:53:12 +02:00
Tamas TEVESZ
b487d56452 Sync comment with reality
Or rather, remove possibility for comment to diverge from reality
2009-08-09 01:51:25 +02:00
Samir SAADA
d316260395 Fix menu positioning bug
Here I tried to prevent the menu of windows to be displayed in the
other side of the screen if the window is half present in the screen
horizontally (ie x < 0)

a worse problem with menu is that it disappears when
the window is half present in the window vertically
ie y < 0, that makes it not usable.
2009-08-09 00:32:32 +02:00
Carlos R. Mafra
6b08fc9e78 Trivial cleanup 2009-08-08 23:38:26 +02:00
Carlos R. Mafra
0c469de04f Fix gcc warnings
This patch fixes the following warnings (with gcc 4.2.3)

    defaults.c:980: warning: unused variable 'replace'
    main.c:504: warning: 'watchPath' may be used uninitialized in this function
    main.c:504: note: 'watchPath' was declared here
    startup.c:616: warning: implicit declaration of function 'XrmUniqueQuark'
2008-11-10 01:42:50 +01:00
Carlos R. Mafra
d680e6e580 Compilation: Add a few spaces in the output
It is even better to have the messages displayed a few spaces
off from the left screen border.

The inspiration comes from the Git compilation output.
2008-11-10 00:14:07 +01:00
Carlos R. Mafra
3c323e1e9a Fix buffer overflows in shortcut and workspace name handling
The handling of user defined shortcuts was not checking the length
of the shortcut before copying it to a fixed-length temporary buffer,

char buf[128];

     strcpy(buf, shortcutDefinition);

and strcpy() is well known for not checking if overflows will occur.

In particular, wmaker was crashing here if a big 'shortcut' was defined
either through WPrefs or by directly editing the configuration files.

This is now avoided by using strncpy() instead.

And this patch also fixes a similar buffer overflow for big workspace
names too.

Furthermore, use MAX_SHORTCUT_LENGTH instead of raw number and define
it to be 32 instead of 128.
2008-11-09 20:18:05 +01:00
Carlos R. Mafra
06f59b9928 wmaker: Fix compiler warnings about pointer <--> integer conversion
There may be issues with running applications in 64-bit mode when
they were written with tacit assumptions about 32-bit platforms.
For example,

    * Assuming that a pointer can be cast back and forth to an integer

The reason is that the size of the integer and pointer may be different.
See the description of "[PATCH] Warn when casting a pointer (constant)
to an integer of different size." in the gcc mailing list

http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01881.html

where it was also suggested the use of casts to uintptr_t. This is
what this patch does.

As a result the following warnings are fixed, leaving us with an
almost warning-free compilation in 64-bit platforms:

defaults.c:1446: warning: cast to pointer from integer of different size
defaults.c:1457: warning: cast to pointer from integer of different size
defaults.c:1471: warning: cast to pointer from integer of different size
defaults.c:1486: warning: cast to pointer from integer of different size
icon.c:67: warning: cast from pointer to integer of different size
menu.c:112: warning: cast from pointer to integer of different size
switchmenu.c:452: warning: cast from pointer to integer of different size
window.c:140: warning: cast from pointer to integer of different size
window.c:2217: warning: cast to pointer from integer of different size
workspace.c:135: warning: cast to pointer from integer of different size
workspace.c:214: warning: cast to pointer from integer of different size
workspace.c:634: warning: cast to pointer from integer of different size
workspace.c:1330: warning: cast to pointer from integer of different size
workspace.c:1514: warning: cast to pointer from integer of different size
wfilepanel.c:135: warning: cast from pointer to integer of different size
wfilepanel.c:171: warning: cast from pointer to integer of different size
wfontpanel.c:499: warning: cast to pointer from integer of different size
wfontpanel.c:500: warning: cast to pointer from integer of different size
wfontpanel.c:505: warning: cast to pointer from integer of different size
wfontpanel.c:506: warning: cast to pointer from integer of different size
wfontpanel.c:776: warning: cast from pointer to integer of different size
wfontpanel.c:777: warning: cast from pointer to integer of different size
wfontpanel.c:877: warning: cast from pointer to integer of different size
wfontpanel.c:878: warning: cast from pointer to integer of different size
wpanel.c:363: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:42: warning: cast from pointer to integer of different size
fontl.c:90: warning: cast to pointer from integer of different size
puzzle.c:138: warning: cast from pointer to integer of different size
puzzle.c:225: warning: cast to pointer from integer of different size
wtableview.c:1031: warning: cast to pointer from integer of different size
wtableview.c:1067: warning: cast to pointer from integer of different size
wtableview.c:1069: warning: cast to pointer from integer of different size
wtableview.c:1074: warning: cast to pointer from integer of different size
wtabledelegates.c:234: warning: cast from pointer to integer of different size
wtabledelegates.c:250: warning: cast from pointer to integer of different size
wtabledelegates.c:265: warning: cast from pointer to integer of different size
wtabledelegates.c:287: warning: cast to pointer from integer of different size
wtabledelegates.c:351: warning: cast from pointer to integer of different size
wtabledelegates.c:372: warning: cast from pointer to integer of different size
wtabledelegates.c:393: warning: cast from pointer to integer of different size
wtabledelegates.c:410: warning: cast to pointer from integer of different size
test.c:44: warning: cast from pointer to integer of different size
test.c:47: warning: cast to pointer from integer of different size
test.c:55: warning: cast from pointer to integer of different size
test.c:58: warning: cast from pointer to integer of different size
2008-11-06 09:07:50 +01:00
Carlos R. Mafra
4339e446e4 automake: Fix warnings about underquoted calls to AC_DEFUN
This patch fixes warnings from automake versions >=1.8 about
underquoted calls to AC_DEFUN.

I followed the recommended modifications of
http://sources.redhat.com/automake/automake.html#Extending-aclocal
2008-11-05 18:17:55 +01:00
Carlos R. Mafra
72689513a3 Makefile: Beautify compilation messages
This patch adds the --disable-verbose-compile switch to the
configure script.

When this option is used it reduces the verbosity of compilation
messages to the essential. However compiler warnings are not affected
and thus gain visibility by not standing in the middle of a storm
of other messages.

In summary, the compilation messages are reduced to a stream of

CC array.o
CC bagtree.o
CC configuration.o
CC connection.o
CC data.o
[...]

instead of a mind-boggling flux of

gcc -DHAVE_CONFIG_H -I. -I../src -I../WINGs/WINGs -I../wrlib -I../src
-I/usr/include/freetype2   -I/usr/local/include
-DLOCALEDIR=\"/usr/local/lib/loca\"/usr/local/share/WINGs\"
-DDEBUG  -fno-strict-aliasing -g -O2 -c array.c
gcc -DHAVE_CONFIG_H -I. -I../src -I../WINGs/WINGs
-I../wrlib -I../src -I/usr/include/freetype2   -I/usr/local/include
-DLOCALEDIR=\"/usr/local/lib/loca\"/usr/local/share/WINGs\"
-DDEBUG  -fno-strict-aliasing -g -O2 -c bagtree.c
[...]
2008-11-05 18:03:07 +01:00
Rodney Padgett
56d8568787 Use inotify to check for changes to the defaults database. Workaround for
event handler timer.

After upgrading my kernel recently I noticed that dnotify has been
depreciated, so I decided to try and implement the new inotify code in
Window Maker instead.

During testing, I also found that one of the timers which was removed
(the one causing the most wake-ups), calling delayedAction, was
responsible for handling signals. Basically with this timer removed,
signals were only handled after an X event occurs.

After looking at the delayedAction function, I couldn't see the purpose of it.
It certainly wouldn't cause any delay as it was called by the timer every
500ms, so there is no time correlation with when a signal was received.
Also, it appeared to count the signals and call DispatchEvent for each
one, but it appears DispatchEvent would just handle the most recent signal
and take action on that. The signals handled by delayedAction are the
various exit and reset signals, so only one need to be handled. I
therefore have commented out delayedAction (it wasn't called by any other
procedure) and added a call to DispatchEvent imediately after the signal
is registered, in handleExitSig.

I'm not sure what problems this may cause with dead children - these are
only cleaned up after an Xevent now that the timer is removed- but I
haven't observed any problems since a few months ago.
2008-08-09 13:14:39 -05:00
Pedro Gimeno
c91bb1ba13 Fix periodic focus bug
Pedro Gimeno explains:

"As you most likely already know, every X Window event comes with a
timestamp. You can see it using e.g. xev.

I don't know if this is Debian-specific and I'm no X Window expert, but
the fact is that in my machine this timestamp, according to my
/usr/include/X11/X.h, is a 32-bit unsigned integer and it holds the
event time in milliseconds according to my tests.

This timestamp appears to be in milliseconds from the start of the Unix
epoch, modulo 2^32. The problem is that 32 bits are too little for this
purpose: 2^32 milliseconds are exactly 49 days, 17 hours, 2 minutes and
47.296 seconds.

Now, the WindowMaker code rejects any focus event whose timestamp is
less than the last one seen, using code similar to this:

 if (timestamp < LastTimeStamp) return;
 LastTimeStamp = timestamp;

This is a disaster when timestamp wraps around because of the 32-bit
limit. Say LastTimeStamp equals 2^32-1 and a focus event comes two
milliseconds after. Its timestamp will equal 1 because of the
wraparound. Obviously, 1 < 2^32-1 so the event will be rejected even if
it comes from the future (relative to LastTimeStamp) and not from the
past. Focus events are no longer accepted because nothing can be greater
than 2^32-1 (unless you click on that exact millisecond, 49 days after).

If you look in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=102314
you'll see two people confirming the periodicity and predictability of
the bug. Arnaud Giersch was who noted that the period was 2^32
milliseconds (and not 2^31 as I thought it could be because of a signed
int involved) and who noted the coincidence with the Unix epoch.

My fix works by subtracting one timestamp from the other (an operation
which is done modulo 2^32) and rejecting the focus event only if the new
timestamp is within 1 minute (60000 milliseconds) in the past. Given the
periodicity of the timestamp, actually after 49.7 days there will be
another minute in the future during which focus events will not be
accepted; again after 99.4 days, etc., but thanks to the subtraction,
they will now be relative to the *last* focus change and not to the Unix
epoch.

The patch could be simplified to get rid of the compareTimes function.
It's written like that because it comes from the previous patch (which
you can see in the same bug report).

So the date comparison line could end up looking like this:

   if (scr->flags.ignore_focus_events || LastFocusChange - timestamp <
60000)

so you can get rid of the compareTimes function. However please respect
the other change of 'int' to 'Time'.

As for why you aren't experiencing this problem, perhaps the event
timestamp does not come from the Unix epoch in your X Window system, but
rather starts counting when you start it or your computer, I don't know.
Or maybe your X Window server's timestamps are 64 bits wide instead of
32 bits, which I don't think because I doubt the X11 protocol specifies
a 64-bit record for the transmission of the timestamp. In either case,
the output of xev will probably help understanding the cause.

Or maybe even it's a click-to-focus only bug and you're not using that
mode. I haven't checked who calls wSetFocusTo.

Note that I can reproduce it just by manipulating the system clock,
which seems to be tied to the event timestamps."

For more information see:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=102314

Reported-by: Joey Hess <joeyh@debian.org>
Signed-off-by: Pedro Gimeno <parigalo@formauri.es>
2008-06-26 15:03:38 -03:00
Paulo Cesar Pereira de Andrade
e4800e84d0 Workaround for Composite problems when default depth is not 24.
This is really a workaround patch, the proper fix would be to have
WindowMaker know about Composite, and take advantage of it's features.
2008-05-03 20:02:31 -03:00
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
Carlos R. Mafra
722c82c8ab wmaker: Reduce wakeups to zero
This patch removes wmaker from PowerTop's shame list, where
it appeared with ~3-4 wakeups/second.

It adds the linux kernel's dnotify mechanism (adapted from
the example in Documentation/dnotify.txt in the kernel source),
to detect when a configuration file in ~/GNUStep/Defaults has
changed to load it again on-the-fly. For me it usually means that
modifications to ~/GNUStep/Defaults/WMRootMenu via the 'genmenu'
script are automatically detected and loaded.

The use of dnotify makes the ancient behaviour of polling unecessary
and cuts down the wakeups count.

Other 'apparently' useless timers are also deleted and it's been almost
one year now that I use this patched exclusively without problems, so
I am pretty sure that it doesn't hurt to remove them.

The end result of all this is that wmaker generates 0 (zero) wakeups
when idle in a Linux system.

Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
2008-05-02 20:01:50 -03:00
Carlos R. Mafra
2061c30758 Add .gitignore to git repository 2008-05-02 01:01:24 -03:00
dan
4e8423d18a Fixed segfault when unhiding an application in certain conditions (seen
with KDE applications with transient windows)
2006-04-27 19:16:58 +00:00
dan
a5aa8573c9 updated todo with ideas for post 1.0 2006-04-27 02:57:57 +00:00
dan
ecd5217633 Enhanced the cursor positioning/selecting text using the mouse in a textfield.
This also fixed an endless loop that could be entered by the previous code
in certain situations, after the patch to fix navigation/selection in a
textfiled with UTF8 chars was applied.
2006-04-27 02:48:18 +00:00
dan
577b3ee949 Removed WINGs' dependency on rgb.txt (from X11).
This fixes issues with locating the file which is being stored on different
locations depending on the X server release/version
2006-04-26 20:28:24 +00:00
dan
bc4de88d8b Applied patches from Stanislav Maslovski <stanislav.maslovski@gmail.com> to
fix the 2 problems mentioend below:

- Fixed buggy handling of UTF8 characters in textfields in WINGs.
- Fixed segfault in WPrefs when some font description is missing from the
  configuration file.
2006-04-25 23:52:43 +00:00
dan
4688c9839b more fixes for missing linking flags in some cases 2006-04-25 20:01:51 +00:00
dan
90c0e656f1 replaced windowmaker.org with windowmaker.info everywhere 2006-04-25 19:35:14 +00:00
dan
42191340fd - Improved Info panel display.
- Fixed missing library paths when linking some binaries on certain
  platforms with a recent pkg-config
2006-04-25 18:59:24 +00:00
dan
d873d09fa5 yet another cvs commit notification test 2006-04-25 18:50:42 +00:00
dan
2e114bcc1e another cvs commit notification test 2006-04-25 18:46:14 +00:00
dan
1a73c71d56 cvs commit notification test 2006-04-25 18:23:19 +00:00
dan
240586edc5 cvs commit notification test 2006-04-25 17:58:33 +00:00
dan
eae4c45cf5 test cvs commit notifications 2006-03-28 19:50:04 +00:00
dan
c2c58734b8 test cvs commit notifications 2006-01-23 06:47:27 +00:00
dan
085e9d6254 - updated the XDND code in WINGs to work with GDK based applications.
WINGs based applications should now work with both KDE and GNOME
  applications (Sylvain Reynal <sreynal@nerim.net>)
- better check for the XDND protocol version when interoperating with other
  applications. As it seems xdnd version 3 (which WINGs supports) and newer
  are not backward compatible with xdnd version 1 and 2. This is why WINGs
  applications cannot interoperate with GNUstep applications (which uses
  xdnd version 2). Xdnd version 4 and 5 are backwards compatible with
  version 3 though. (Sylvain Reynal <sreynal@nerim.net>)
2006-01-22 20:33:19 +00:00
dan
f683b99405 updated estonian translation 2006-01-22 19:20:57 +00:00
dan
bacf8229b0 - release colors to avoid issues with the reference count overflowing a
small integer and causing unexpected color releases that can crash
  Window Maker (Martin Frydl <martin.frydl@systinet.com>)
- fixed a small memory leak in WINGs/wview.c caused by not releasing the
  background color of a view (Martin Frydl <martin.frydl@systinet.com>)
2006-01-22 18:19:09 +00:00
dan
fa7a5db4bd - fixed issue with invisible modal windows from Qt and Gtk applications
on 64bit platforms (Max Loparyev <max@city.veganet.ru>)
- fixed issue with icon colors on big endian platforms
  (Max Loparyev <max@city.veganet.ru>)

patch based on a previous patch by Vladimir Nadvornik <nadvornik@suse.cz>
2006-01-22 18:05:00 +00:00
dan
e534138417 test 2006-01-22 16:29:39 +00:00
dan
73d94f7bdc test 2006-01-22 16:03:31 +00:00
dan
054f954390 Applied some patches from Balaton Zoltan <balaton@eik.bme.hu>
- small fix for compilation in a different directory than the source
- fixed some warnings on 64bit platforms
2006-01-22 15:53:44 +00:00
dan
c0317ddae5 eliminated gcc-4 compilation warnings 2005-08-22 23:58:19 +00:00
dan
91f5abc955 - fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
2005-08-22 19:07:57 +00:00
dan
d26f18505a Fixed WPrefs.app to find its icons when not installed under GNUstep paths 2005-07-17 19:16:46 +00:00
dan
f3a960d9d8 updated german translations 2005-07-05 19:41:06 +00:00
dan
5f0a357b1f try to work around some user's IQ level 2005-07-05 08:44:00 +00:00
dan
20d5925d08 updated news file (part 2) 2005-07-03 18:08:46 +00:00
dan
b655a5fa5f updated news file 2005-07-03 18:01:46 +00:00
634 changed files with 106203 additions and 127061 deletions

View File

@@ -1,8 +0,0 @@
Makefile Makefile.in
aclocal.m4
configure config.log config.cache config.guess config.status config.sub
libtool ltconfig ltmain.sh
autom4te.cache
.psrc .inslog2 tca.map tca.log pchdir *.rpt
update
WindowMaker*.tar.gz

77
.gitignore vendored Normal file
View File

@@ -0,0 +1,77 @@
*.lo
*.o
*Makefile
*Makefile.in
.deps/
.libs/
INSTALL
aclocal.m4
autom4te.cache*
config-paths.h
config.guess
config.h
config.h.in
config.h.in~
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
stamp-h1
contrib/WindowMaker.spec
m4/
src/wconfig.h
src/wmaker
test/wtest
util/convertfonts
util/geticonset
util/getstyle
util/seticons
util/setstyle
util/wdread
util/wdwrite
util/wmagnify
util/wmaker.inst
util/wmgenmenu
util/wmmenugen
util/wmsetbg
util/wmsetup
util/wxcopy
util/wxpaste
wrlib/get-wraster-flags
wrlib/libwraster.la
wrlib/tests/testdraw
wrlib/tests/testgrad
wrlib/tests/testrot
wrlib/tests/view
wrlib/wrlib.pc
WINGs/Examples/colorpick
WINGs/Examples/connect
WINGs/Examples/fontl
WINGs/Examples/puzzle
WINGs/Examples/server
WINGs/Extras/libExtraWINGs.a
WINGs/Extras/libExtraWINGs.la
WINGs/Extras/test
WINGs/Tests/testmywidget
WINGs/Tests/wmfile
WINGs/Tests/wmquery
WINGs/Tests/wtest
WINGs/WINGs.pc
WINGs/get-wings-flags
WINGs/get-wutil-flags
WINGs/libWINGs.a
WINGs/libWINGs.la
WINGs/libWUtil.a
WINGs/libWUtil.la
WPrefs.app/WPrefs
WindowMaker/Defaults/WMRootMenu
WindowMaker/Defaults/WMState
WindowMaker/Defaults/WMWindowAttributes
WindowMaker/Defaults/WindowMaker
WindowMaker/IconSets/Default.iconset

10
AUTHORS
View File

@@ -107,10 +107,10 @@ made autoarrange icons a runtime option, SHADOW_RESIZEBAR c-time option,
no workspace switch to the same workspace, dashed icon selection,
misclellaneous bug fixes, definable cursors, --no-polling command line option.
The JED Text Editor <xjed@windowmaker.org>
The JED Text Editor <xjed@windowmaker.info>
Project maintainer
Alfredo K. Kojima <kojima@windowmaker.org>
Alfredo K. Kojima <kojima@windowmaker.info>
The guy who types random keys to feed JED with the necessary entropy
Jay Kominek <jkominek@xtn.net>
@@ -149,7 +149,7 @@ Fix for unassociated alpha tiff
Craig Nellist <crn@ozemail.com.au>
selection in textfield
Dan Pascu <dan@windowmaker.org>
Dan Pascu <dan@windowmaker.info>
dock ghost (superfluous mode) fix, enhancement for scrollable menus,
clip, numerous other stuff, project maintainer
@@ -197,7 +197,7 @@ many fixes and enhancements for move, resize and window placement code.
Marco van Hylckama Vlieg <fatal@global.uibk.ac.at>
house icon for WINGs file dialogs, defaultAppIcon and Clip xpm tchX.tiff
Plus the following icons:
DefaultAppIcon.tiff GNUterm.tiff clip2.tiff defaultterm.tiff draw.tiff
GNUterm.tiff clip2.tiff defaultterm.tiff draw.tiff
linuxterm.tiff mixer.tiff notepad.tiff pdf.tiff ps.tiff real.tiff sgiterm.tiff
sound.tiff staroffice2.tiff timer.tiff wilber.tiff write.tiff xdvi.tiff
xv.tiff
@@ -217,7 +217,7 @@ FRBall <frb@umr.edu>
dgradient fix
"]d" <id@windowmaker.org>
"]d" <id@windowmaker.info>
Window list menu miniaturized/hidden hints, XDE support, XKB lock
language status, WINGs enhancements, bug fixes, window commands menu
enhancement, window move/resize by keyboard. GNUstepGlow.tiff icon,

View File

@@ -4,11 +4,11 @@
If you find a bug please fill this form and send it to
developers@windowmaker.org Please, USE THIS FORM!!!
wmaker-dev@lists.windowmaker.org Please, USE THIS FORM!!!
You can also report a bug in the WWW bug tracker at
http://windowmaker.org/cgi-bin/bugs or by sending this report
to bugs@windowmaker.org
http://bugs.windowmaker.org/projects/wmaker/issues or by sending this report to
bugs@windowmaker.org
0. Before reporting this bug I already:

31
COPYING
View File

@@ -1,9 +1,8 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -16,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -56,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -111,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -169,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -226,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -279,8 +278,8 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -292,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -304,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -1,91 +0,0 @@
OpenContent License (OPL)
Version 1.0, July 14, 1998.
This document outlines the principles underlying the OpenContent
(OC) movement and may be redistributed provided it remains
unaltered. For legal purposes, this document is the license under
which OpenContent is made available for use.
The original version of this document may be found at
http://www.opencontent.org/opl.shtml
LICENSE
Terms and Conditions for Copying, Distributing, and Modifying
Items other than copying, distributing, and modifying the Content
with which this license was distributed (such as using, etc.) are
outside the scope of this license.
1. You may copy and distribute exact replicas of the OpenContent
(OC) as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any
warranty; and give any other recipients of the OC a copy of this
License along with the OC. You may at your option charge a fee for
the media and/or handling involved in creating a unique copy of the
OC for use offline, you may at your option offer instructional
support for the OC in exchange for a fee, or you may at your option
offer warranty in exchange for a fee. You may not charge a fee for
the OC itself. You may not charge a fee for the sole service of
providing access to and/or use of the OC via a network (e.g. the
Internet), whether it be via the world wide web, FTP, or any other
method.
2. You may modify your copy or copies of the OpenContent or any
portion of it, thus forming works based on the Content, and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified content to carry prominent notices
stating that you changed it, the exact nature and content of the
changes, and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the OC or any part
thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License, unless otherwise permitted
under applicable Fair Use law.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the OC, and
can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work
based on the OC, the distribution of the whole must be on the terms
of this License, whose permissions for other licensees extend to
the entire whole, and thus to each and every part regardless of who
wrote it. Exceptions are made to this requirement to release
modified works free of charge under this license only in compliance
with Fair Use law where applicable.
3. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to copy,
distribute or modify the OC. These actions are prohibited by law if
you do not accept this License. Therefore, by distributing or
translating the OC, or by deriving works herefrom, you indicate
your acceptance of this License to do so, and all its terms and
conditions for copying, distributing or translating the OC.
NO WARRANTY
4. BECAUSE THE OPENCONTENT (OC) IS LICENSED FREE OF CHARGE, THERE
IS NO WARRANTY FOR THE OC, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
AND/OR OTHER PARTIES PROVIDE THE OC "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK OF USE OF THE OC IS WITH YOU.
SHOULD THE OC PROVE FAULTY, INACCURATE, OR OTHERWISE UNACCEPTABLE
YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION.
5. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
MIRROR AND/OR REDISTRIBUTE THE OC AS PERMITTED ABOVE, BE LIABLE TO
YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE OC, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

View File

@@ -1,3 +1,48 @@
Changes since version 0.92.0:
.............................
- added check for --with-gnustepdir option to configure to verify that its
argument is an absolute path
- updated german translations (Torsten Marek <shlomme@gmx.net>)
- fixed WPrefs.app to find its icons when not installed under GNUstep paths
- fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- eliminated gcc-4 compilation warnings
- small fix for compilation in a different directory than the source
(Balaton Zoltan <balaton@eik.bme.hu>)
- fixed some warnings on 64bit platforms (Balaton Zoltan <balaton@eik.bme.hu>)
- fixed issue with invisible modal windows from Qt and Gtk applications
on 64bit platforms (Max Loparyev <max@city.veganet.ru>)
- fixed issue with icon colors on big endian platforms
(Max Loparyev <max@city.veganet.ru>)
- release colors to avoid issues with the reference count overflowing a
small integer and causing unexpected color releases that can crash
Window Maker (Martin Frydl <martin.frydl@systinet.com>)
- fixed a small memory leak in WINGs/wview.c caused by not releasing the
background color of a view (Martin Frydl <martin.frydl@systinet.com>)
- updated estonian translation (Ivar Smolin <okul@linux.ee>)
- updated the XDND code in WINGs to work with GDK based applications.
WINGs based applications should now work with both KDE and GNOME
applications (Sylvain Reynal <sreynal@nerim.net>)
- better check for the XDND protocol version when interoperating with other
applications. As it seems xdnd version 3 (which WINGs supports) and newer
are not backward compatible with xdnd version 1 and 2. This is why WINGs
applications cannot interoperate with GNUstep applications (which uses
xdnd version 2). Xdnd version 4 and 5 are backwards compatible with
version 3 though. (Sylvain Reynal <sreynal@nerim.net>)
- Improved Info panel layout and fonts.
- Fixed missing library paths when linking some binaries on certain
platforms with a recent pkg-config (debian unstable/sid for one)
- Fixed buggy handling of UTF8 characters in textfields in WINGs.
(Stanislav Maslovski <stanislav.maslovski@gmail.com>)
- Fixed segfault in WPrefs when some font description is missing from the
configuration file (Stanislav Maslovski <stanislav.maslovski@gmail.com>)
- Removed WINGs' dependency on rgb.txt (from X11) and issues with locating it
on the filesystem for different systems/distributions.
- Fixed segfault when unhiding an application in certain conditions (seen
with KDE applications with transient windows)
Changes since version 0.91.0:
.............................
@@ -785,9 +830,9 @@ Changes since version 0.51.2:
- fixed focus problem with unfocusable windows
- fixed bug in WPrefs that changed EXIT to SHUTDOWN
- fixed menu title messup bug in WPrefs
- added a dot to mark hidden applications (compile time) (id@windowmaker.org)
- enhancements to the modelock patch (id@windowmaker.org)
- show kbd mode for modelock (id@windowmaker.org)
- added a dot to mark hidden applications (compile time) (id@windowmaker.info)
- enhancements to the modelock patch (id@windowmaker.info)
- show kbd mode for modelock (id@windowmaker.info)
- enhanced positioning of transient windows
- added dynamically loadable texture renderer code
from Tobias Gloth <gloth@online.de>
@@ -1628,7 +1673,7 @@ Changes since version 0.14.1:
They are icons for dock, clip, defaultAppIcon, sound server and for xterm.
All the rest needed for apps that can be started from menu, and have entries
in WMWindowAttributes, are in WindowMaker-data.tar.gz which can be found on
http://windowmaker.org/ or ftp://ftp.windowmaker.org/pub/contrib/icons
http://windowmaker.info/ or ftp://ftp.windowmaker.info/pub/contrib/icons
- Changed the SlideWindow() function to better adapt to slow machines. Also
the animation constants are now run time. They are IconSlideDelay = 0;
IconSlideStep = 5; and IconSlideSlowDown = 50; See NEWS for a more in depth
@@ -1696,7 +1741,7 @@ Changes since version 0.14.0:
or exiting, while an Attribute Editor panel is open.
- Put clip.tif, clip.png, clip.xpm, clip2.tif, clip2.xpm, Cone.xpm and
Penguin.xpm in WindowMaker-data_tar.gz. These are icons intended for fiend.
It can be found on ftp://ftp.windowmaker.org/pub/wmaker/contrib/icons
It can be found on ftp://ftp.windowmaker.info/pub/wmaker/contrib/icons

67
FAQ
View File

@@ -143,10 +143,9 @@ here for example screenshots.
1.2 Where can I get Window Maker?
----------------------------------
The official site to get new developmental versions from is
ftp://ftp.windowmaker.org/pub/beta/srcs/.
http://windowmaker.org/pub/source/beta/
NOTE: Also see http://wm.current.nu/downloads.html for the latest
Stable and Development versions.
The mercurial repository is available at https://hg.windowmaker.org/wmaker
The development versions are usually very stable themselves, so if you
want to have all the newest features, you can rather safetly go with the
@@ -158,23 +157,15 @@ crash.
1.3 Where are the mailing list archives?
----------------------------------------
Phillip Smith from Netplex, our wonderful provider of windowmaker.org, has set
up some new lists from the domain. Please read the information on the web
pages at http://www.windowmaker.org/lists.html for information on how to
subscribe, the posting guidelines, and how to access the web archives.
Many thanks to Ed Orcutt who hosted the original lists from his own machine
for many years and Caldera who graciously allowed Ed to continue hosting
from them when he moved to his new position with them. Ed provided a very
valuable service for many years and we are sad to see him go.
Please read the information on the web pages at http://lists.windowmaker.org/
for information on how to subscribe, the posting guidelines, and how to access
the web archives.
1.4 Where is more documentation on configuring Window Maker?
----------------------------------
Besides the mailing list archives, there are nice documents in
ftp://ftp.windowmaker.org/pub/docs/, at
http://wm.current.nu/downloads.html on my download page and at
http://wm.current.nu/user-guide/index.htm in the online user-guide.
http://windowmaker.org/documentation.php
1.5 What is an appicon?
@@ -182,52 +173,34 @@ http://wm.current.nu/user-guide/index.htm in the online user-guide.
An appicon is the icon (without the tiny titlebar a minimized application icon
has) produced by most applications that initially is in the bottom left corner
of the screen while an application is running. For an example, run xterm and
notice the icon in the corner. (Make sure that you use xterm and not a
default older rxvt because older versions of rxvt do not properly set their
window attributes.)
notice the icon in the corner.
1.6. How can I get a question added to the FAQ?
----------------------------------
Right now, the only method is to mail Chris Green <sprout@dok.org> or
myself <largo@current.nu> the question or post it on the Window Maker
Mailing list, and see if enough people have the same problem.
Ask on the mailing list, or send your request to faqs@windowmaker.org
If you are a developer and would like to be able to edit the official FAQ on
Chris's site, let him know at <sprout@dok.org>
He is currently pondering writing a front end that allows everyone to add
entries and only require a moderator approval before being posted.
Other avenues are the Window Maker wiki
http://bugs.windowmaker.org/projects/wmaker/wiki
and the forums
http://bugs.windowmaker.org/projects/wmaker/boards
1.7. How do I report bugs?
----------------------------------
You can look at the BUGFORM file in your tarball of Window Maker.
Alternatively, you can use the Window Maker Bugtracker at
http://windowmaker.org/cgi-bin/bugs.
http://bugs.windowmaker.org/projects/wmaker/issues
1.8. Is there an anomymous cvs server?
1.8. Is there a public source code repository?
----------------------------------
Yes there is. To check out from cvs, first
Yes there is. To check out from mercurial use:
hg clone http://hg.windowmaker.org/wmaker wmaker
export CVSROOT=":pserver:anoncvs@cvs.net-community.com:/gnustep"
cvs login
To update your source tree, cd to the wmaker directory and type
hg pull
'anoncvs' is the password.
Then issue the command. "wm" is the name of the module.
cvs -z3 checkout -d WindowMaker wm
To update your source tree, cd to the WindowMaker directory and type
cvs -z3 update
inside the WindowMaker directory.
-=-=-=-=-=-=-
@@ -1192,10 +1165,10 @@ Several Nice applications are available:
http://www.geocities.com/SiliconValley/Vista/2471/linux.htm#xapps
ascd,WMRack,asmixer,asmodem, and others
ftp://ftp.windowmaker.org/pub/wmaker/contrib/srcs/apps/
ftp://ftp.windowmaker.info/pub/wmaker/contrib/srcs/apps/
wmavgload, wmmount, and wmload
ftp://ftp.windowmaker.org/pub/wmaker/contrib/srcs/utils/
ftp://ftp.windowmaker.info/pub/wmaker/contrib/srcs/utils/
wmppp-wmifs, wmtime, wmmon and other nifty apps
http://windowmaker.mezaway.org/

View File

@@ -51,7 +51,7 @@ If I18N support does not work for you, check these:
However, please note that if your font is something like:
"Trebuchet MS,Luxi Sans,sans:pixelsize=12"
"Trebuchet MS,sans serif:pixelsize=12"
this will not be able to display asian languages if any of the
previous fonts before sans are installed. This is because unlike

View File

@@ -1,64 +0,0 @@
Často kladené otázky na podporu místního nastavení
==================================================
Pokud vám nefunguje podpora I18N, tak zkontrolujte tato nastavení:
- systémová proměnná LANG musí být nastavená tak, aby odpovídala vašemu
místnímu nastavení (čeština = czech), vaše místní nastavení musí být
podporovatelné vaším operačním systémem nebo X emulací. Všechny
podporovatelné lokalizace zobrazíte příkazem "locale -a". Měli byste
také zkontrolovat, zda-li je vaše místní nastavení podporované
X emulací. Soubor: "/usr/X11R6/lib/X11/locale/locale.alias" by měl
obsahovat podobnou sekvenci (podpora pro češtinu):
cs cs_CZ.ISO8859-2
cs_CS cs_CZ.ISO8859-2
cs_CS.ISO8859-2 cs_CZ.ISO8859-2
cs_CZ cs_CZ.ISO8859-2
cs_CZ.iso88592 cs_CZ.ISO8859-2
cz cz_CZ.ISO8859-2
cz_CZ cz_CZ.ISO8859-2
- zkontrolujte použití správných fontů pro vaše místní nastavení.
Pokud nepoužíváte správné fonty s kódováním, které je nastaveno v
Xlib nebo libc, tak se můžou dít "dost divné věci". Zkuste explicitně
zadat kování do proměnné LANG: LANG=cs_CS.ISO8859-2 nebo
LANG=cs_CZ.iso88592 a znovu zkontrolujte:
"/usr/X11R6/lib/X11/locale/locale.alias"
- pokud váš operační systém nepodporuje místní nastavení (locales), nebo
pokud váš OS nepodporuje místní nastavení pro váš jazyk, můžete
použít emulaci místního nastavení X Window Systému. Zprovoznit tuto
emulaci je možné spuštěním ./configure s volbou "--witn-x-locale".
Pokud používáte nějaký komerční systém jako je například IRIX, AIX,
Solaris, ...,tak asi X emulaci nebudete potřebovat. Ovšem pokud je
vaším operačním systémem Linux, NetBSD nebo jiný užasný, volně
šiřitelný operační systém, tak je možné, že vaše místní nastavení
zatím není podporované. Potom použijte volbu "--witn-x-locale".
Pozn: Aby jste mohli používat X emulaci místních nastavení, tak vaše
Xlib musí být zkompilované s touto podporou. Xlib v RedHat 5.0
tak zkompilované nejsou (RH4.x jsou OK). Překompilované Xlib
s podporou pro emulací místních nastavení pro RH5.0 jsou
dostupné na adrese:
ftp://ftp.linux.or.jp/pub/RPM/glibc
- fonty, které používáte by měli být podporované vaším místním nastavením.
Jestliže vaše nastavení fontů v souboru ~/GNUstep/Defaults/WindowMaker
vypadá takto:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*"; ,
nemůžete zobrazovat znaky jiné než iso8859-x ve fontu helvetica.
Jednoduchý způsob, jak zobrazovat znaky různých jazyků, je nastavit všechny
fonty takto:
"-*-*-medium-r-normal-*-14-*-*-*-*-*-*-*"
Také je nutné změnit nastavení fontů v souborech stylů v adresáři:
~/Library/WindowMaker/Style.
- pokud si nejste jisti, zda-li systémová proměnná LC_TYPE správnou
hodnotu, tak ji nenastavujte.

View File

@@ -1,57 +0,0 @@
(Toto je len preklad dosť starého súboru! Ak by ste mali skutočne problémy
s Window Makerom a slovenčinou a v tomto súbore by ste nenašli pomoc,
pošlite popis problému na adresu <judas@linux.sk>.)
Ak vám nefunguje podpora miestnych nastavení, skontrolujte nasledujúce:
- premenná LANG je nastavená na vaše miestne nastavenia a tieto
sú podporované vašim OS alebo X emuláciou. Zoznam podporovaných
miestnych nastavení získate príkazom "locale -a". Zoznam
miestnych nastvení podporovaných X emuláciou sa nachádza v
súbore "/usr/X11R6/lib/X11/locale/locale.alias".
- používate správne fonty pre svoje miestne nastavenia. Ak
používate font s odlišným kódovaním ako je nastavené v Xlib
alebo libc, môžu sa diať čudné veci. Skúste explicitne zadať
kókovanie do premennej LANG, teda sk_SK.ISO-8859-2. Znovu,
pozrite si súbor "/usr/X11R6/lib/X11/locale/locale.aliax".
- ak váš OS nepodporuje žiadne miestne nastavenia alebo váš OS
nepodporuje vaše miestne nastavenia, môžete použiť emuláciu
podpory miestnych nastavení X Window Systému. To urobíte
voľbou "--with-x-locale" skriptu configure. Ak používate
komerčný OS ako Solaris, IRIX, AIX, ..., pravdepodobne
nepotrebujete použiť X emuláciu miestnych nastavení. Ale ak
je váš OS Linux alebo NetBSD alebo ..., je možné, že vaše
miestne nastavenia ešte nie sú podporované. Vtedy použite
"--with-x-locale".
Pozor: aby ste mohli používať X emuláciu miestnych nastvení,
vaša Xlib musí byť skompilovaná s touto podporou.
Xlib v Linux RedHat5.0 tak skompilovaná nie je.
(RH4.x je v poriadku). Prekompilovaná Xlib pre
RH5.0 s podporou emulácie miestnych nastavení je
dostupná na adrese
ftp://ftp.linux.or.jp/pub/RPM/glibc
- fonty, ktoré používate, podporujú vaše miesne nastavenia.
Ak vaše nastavenia fontov v ~/GNUstep/Defaults/WindowMaker
vyzerajú takto:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*";
......................................................
potom nemôžete zobrazovať znaky iné ako iso8859-x vo fonte
helvetica. Jednoduchý spôsob ako zobrazovať znaky rôznych
jazykov je nastaviť všetky fonty takto:
"-*-*-medium-r-normal-*-14-*-*-*-*-*-*-*"
a tiež potrebujete zmeniť nastavenia fontov v súboroch štýlov
v adresári ~/Library/WindowMaker/Style.
- premenná LC_CTYPE nie je nastavená alebo má správnu hodnotu. Ak
si nie ste istí, nenastavujte ju.

View File

@@ -1,52 +1,18 @@
Installation Instructions for Window Maker
The latest version of Window Maker (-crm) can be found in the
git repository at
http://repo.or.cz/w/wmaker-crm.git
SUPPORTED PLATFORMS
===================
(ie: I've heard someone has compiled it on...)
- Intel GNU/Linux Conectiva 5.9 (beta)
- Intel GNU/Linux Slackware
- Intel GNU/Linux Debian
- Intel GNU/Linux other distributions
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- Solaris 2.8 on Ultra Sparc 10 and E450
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 over MacOS
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
- IBM S/390 running Linux
- IBM S/390 running Conectiva Linux (experimental)
- iBook running Darwin
- Darwin PPC / Macos X
- Windows NT with Cygwin/XFree86
- Sony PlayStation2 running Linux
- Intel GNU/Linux Systems in general
All registered trademarks are registered by their owners. (duh)
Patches to make it work on other platforms are welcome.
Patches to make it work on other platforms are welcome.
REQUIREMENTS:
@@ -54,7 +20,7 @@ REQUIREMENTS:
The following software is required to use Window Maker:
- X11R6.x
- X11R6.x
Window Maker can be compiled in older versions of X, like X11R5
(Solaris) or X11R4 (OpenWindows) but it will not work 100% correctly.
In such servers there will not be application icons and you'll have
@@ -84,17 +50,17 @@ OPTIONAL:
These libraries are not required to make Window Maker work, but they
are supported in case you want to use them. Version numbers are those
that I have (and therefore, guraranteed to work), but other versions
might work too.
might work too.
- libXPM 4.7 or newer
Older versions may not work!!!
Older versions may not work!!!
Available at ftp://sunsite.unc.edu/pub/Linux/libs/X/
There is builtin support for XPM files, but it will not
load images in some uncommon encodings.
- libpng 0.96 or newer and zlib
- libpng 0.96 or newer and zlib
For PNG image support.
http://www.cdrom.com/pub/png/
@@ -120,6 +86,12 @@ might work too.
CONFIGURE OPTIONS:
==================
If you downloaded the cvs or git versions, type
./autogen.sh
to generate the config files.
These options can be passed to the configure script to enable/disable
some Window Maker features. Example:
@@ -145,26 +117,18 @@ To get a list of other options, run ./configure --help
texture generation a little bit, but in some cases it seems to be
necessary due to a bug that manifests as messed icons and textures.
--disable-motif
--disable-motif
disable support for mwm window manager hints
--enable-lite
remove things that are already supported in desktop environments,
like KDE and GNOME. Disabled things are: window list, root
applications menu, multiple window selection. Note that you will not
be able to exit Window Maker from itself anymore; you will have to
use kill with the SIGTERM signal or exit it from KDE. It is not
advisable to enable it.
--enable-modelock
XKB language status lock support. If you don't know what it is you
probably don't need it.
--disable-xpm
--disable-xpm
disables use of the XPM library even if it is available on your
system.
--disable-png
--disable-png
disables use of PNG library
--disable-tiff
@@ -183,73 +147,14 @@ To get a list of other options, run ./configure --help
PLATFORM SPECIFIC NOTES:
========================
- DEC/Alpha machines
#>>>>>>>>>>>
From: Anton Ivanov <aivanov@eu.level3.net>
To: Marcelo E. Magallon <mmagallo@debian.org>
Subject: Re: Is the WindowMaker package working ok on Alpha?
> Hi,
>
> I was reading some docs on the WindowMaker tarball, and found this:
>
> | - DEC/Alpha machines
> | You might need to pass the --disable-shm flag to configure,
> | like ./configure --disable-shm
>
> is anyone having problems with WindowMaker on Alpha? Can someone
> please test this? Should the flag be passed when building on Alpha?
Disclaimer: alphas under my command have never run X and are least likely to
suddenly start running it anytime soon.
Alpha used to have some ridiculously low amount of shared memory
configured.
So quite a lot of apps used to barf. Namely - cdrecord, mysql server, etc.
Check where is yours at the moment and raise it to a more appropriate
value by either catting to the appropriate /proc entry or changing the
/usr/src/linux/include/asm/shmparam.h.
Otherwise the shared memory on alpha should be fully functional and I
see no reason to disable it. Mine are bumped up to 32 or more on most
machines.
And If I recall correctly the comments in that file are actually
wrong. Value is not bytes, but in machine size word. For alpha *8.
As I said - I do not run X on them so all #include "stdisclaimer.h"
apply.
#<<<<<<<<<<<<
- SCO Unix - run configure like
CFLAGS="-belf -DANSICPP" ./configure
- SunOS, Solaris
If you have gcc installed, run configure as:
CPP_PATH="gcc -E -x c" ./configure
Sun's cpp lacks some features needed by Window Maker and it can
cause problems when parsing the config files.
You also might need to use the --with-libs-from and --with-incs-from
to supply the directory where libtiff is located.
Someone mailed me that you also must make /usr/local/lib be the
first path in LD_LIBRARY_PATH to make it work.
If you have a Ultra Creator 3D or some other machine with high-end
graphics, be sure to start the X server with the default visual
set to 24bpp or you might experience problems with mangled colors.
This is a wmaker bug and will be fixed.
- GNU/Linux in general
Make sure you have /usr/local/lib in /etc/ld.so.conf and that you
run ldconfig after installing.
Uninstall any packaged version of Window Maker before installing a new
version.
version.
- RedHat GNU/Linux
RedHat systems have several annoying problems. If you use it,
RedHat systems have several annoying problems. If you use it,
be sure to follow the steps below or Window Maker will not work:
* if you installed the Window Maker that comes with RedHat, uninstall
@@ -269,7 +174,7 @@ apply.
seem to have bugs that cause the system to hang.
- Debian GNU/Linux
If you want JPEG and TIFF support, make sure you have libtiff-dev
If you want JPEG and TIFF support, make sure you have libtiff-dev
and libjpeg-dev installed.
- SuSE GNU/Linux
@@ -307,11 +212,11 @@ smaller, you can instead type:
This will build and install Window Maker with default parameters.
If you want to customize some compile-time options, you can do the
following.
following.
1. (optional) Look at the CONFIGURE OPTIONS section above for the
1. (optional) Look at the CONFIGURE OPTIONS section above for the
options available. Also run:
./configure --help
to get a complete listing of other options that are available.
@@ -321,14 +226,14 @@ following.
./configure --enable-modelock
3. (optional) Edit src/wconfig.h with your favorite text editor
3. (optional) Edit src/wconfig.h with your favorite text editor
and browse through it for some options you might want to change.
4. Compile. Just type:
make
5. Login as root (if you can't do that, read the "I don't have the
5. Login as root (if you can't do that, read the "I don't have the
root password :-(" section) and install Window Maker in your system:
su root
make install
@@ -350,8 +255,8 @@ Type:
wmaker.inst will install Window Maker configuration files and will
setup X to automatically launch Window Maker at startup.
That's it!
That's it!
You can type "man wmaker" to get some general help for configuration
and other stuff.
@@ -365,12 +270,11 @@ Installing the extras package
-----------------------------
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
You can get the file at ftp://ftp.windowmaker.org. This file is optional
and only have a few icons, and themes. Look for the latest <version-number>
available.
Also there is a WindowMaker-extra.readme to instruct you where that package
should go.
You can get the file at http://windowmaker.org/pub/source/release/. This file
is optional and only have a few icons, and themes. Look for the latest
<version-number> available. Also there is a WindowMaker-extra.readme to
instruct you where that package should go.
@@ -380,14 +284,14 @@ I don't have the root password :(
If you can't get superuser privileges (can't be root) you can install
wmaker in your own home directory. For that, supply the --prefix option
when running configure in step 2 of building Window Maker. You will
also need to supply the --with-appspath option, to specify the path for
also need to supply the --with-gnustepdir option, to specify the path for
WPrefs.app Example:
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Applications
./configure --prefix=/home/jshmoe --with-gnustepdir=/home/jshmoe/GNUstep/Applications
Then make /home/jshmoe/bin be included in your search PATH, add
/home/jshmoe/lib to your LD_LIBRARY_PATH environment variable and run
/home/jshmoe/lib to your LD_LIBRARY_PATH environment variable and run
bin/wmaker.inst
Of course, /home/jshmoe is supposed to be replaced with your actual home
@@ -429,7 +333,7 @@ autoconf 2.13
automake 1.4
libtool 1.3
Note that it must not be libtool 1.2b, it must be libtool 1.3,
Note that it must not be libtool 1.2b, it must be libtool 1.3,
from the GNU sites.
== configure doesn't detect libtiff, or other graphic libraries.
@@ -443,7 +347,7 @@ located. You can put multiple paths in any of these options, as the example
of --with-incs-from shows. Just put a space between them.
== configure doesn't detect libXpm.
== configure doesn't detect libXpm.
* Check if you have a symbolic link from libXpm.so.4.9 to libXpm.so
@@ -465,7 +369,7 @@ If you're not sure, try renaming ~/GNUstep to ~/GNUtmp and then run wmaker.inst
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker is not finding cpp (the C preprocessor). If your cpp is
not located in /lib/cpp, edit src/config.h and correct the path in
not located in /lib/cpp, edit config.h and correct the path in
CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up
@@ -500,12 +404,12 @@ in sh
The list of supported locales can be found in po/README.
English is the default language.
Read po/README if you wish to translate and maintain locale files
Read po/README if you wish to translate and maintain locale files
for other languages.
2 - Additionally, if your language uses multi-byte characters, such
as Japanese or Korean, you must set the MultiByteText option to YES
in ~/GNUstep/Defaults/WMGLOBAL
in ~/GNUstep/Defaults/WMGLOBAL
3 - Configure, build and install Window Maker normally.
@@ -530,5 +434,3 @@ following order (for brazilian portuguese, in this case):
menu.pt_BR
menu.pt
menu

View File

@@ -1,604 +0,0 @@
Instrukce pro instalaci okenního manažera Window Maker
PODPOROVANÉ PLATFORMY
=====================
("Podporované" znamená, že to na dané platformě někdo zprovoznil...)
- Intel GNU/Linux Conectiva 5.9 (beta)
- Intel GNU/Linux Slackware
- Intel GNU/Linux Debian
- Intel GNU/Linux ostatní distribuce
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 over MacOS
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
- IBM S/390 s Linuxem
- iBook s OS Darwin
Patche pro rozběhání na jiných platformách jsou vítané.
POŽADAVKY
=========
Následující software je potřebný/nezbytný pro běh Window Makeru:
- X11R6.x
Window Maker může být zkompilován na starších verzích X, jako
je X11R5 (Solaris) nebo X11R4 (OpenWindows), ale nebude to pracovat
100% spolehlivě. Na těchto systémech nebudou fungovat ikony
aplikací a budete mít problémy s používáním doku. Upgrade
uživatelských knihoven (Xlib, Xt atd.) zlepší tyto problémy pokud
nemůžete aktualizovat váš X server.
Následující software je potřebný ke zkompilování Window Makeru:
- Zákládní běžné věci
Když budete komplivat Window Maker, tak se ujistěte, že máte gcc
(nebo jiný ANCI C kompilátor) a nainstalované hlavičkové soubory
pro X. Hlavně pro začátečníky v Linuxu: musíte nainstalovat všechny
X-devel balíky a gcc. Jinak nebudete schopni zkompilovat žádný
program s grafickým rozhraním, tedy ani Window Maker.
- autoconf, automake a libtool
Tyto nástroje NEJSOU POTŘEBA, ale když máte jeden nebo dva nebo
všechny tři nainstalované, tak se UJISTĚTE, že máte přesně
následující VERZE:
autoconf 2.54
automake 1.4
libtool 1.4.2
Máte-li odlišnou verzi, tak ji dočasně přejmenujte, nebo ji rovnou
odinstalujte z vašeho systému. Pokud nebudete programovat, tak ji
stejně nebudete potřebovat, takže ji můžete bezpečně odinstalovat.
Pozn. libProblist není potřeba ke zkompilování Window Makeru, protože
libProblist byl přímo zabudován do WINGs. Z toho důvodu není
potřeba ani lex (flex) a yacc (nebo bison).
NEPOVINNÉ
=========
Tyto knihovny nejsou nutné pro běh Windo Makeru, ale jsou podporované, když
je budete chtít použít. Tyto verze jsou používané vývojovým týmem, který
garantuje, že budou fungovat. Ostatní verze by měli fungovat také.
- libXPM 4.7 nebo novější
Starší verze nemusí fungovat!!!
Dostupné na ftp://sunsite.unc.edu/pub/Linux/libs/X/
Je zde zabudovaná podpora pro soubory XPM, ale nenačte obrázky s
nestandardním formátem kódování.
- libpng 0.96 nebo novější a zlib
Pro podporu PNG obrázků
http://www.cdrom.com/pub/png/
- libtiff 3.4 nebo novější
Pro podporu TIFF obrázků
Dostupné na ftp://ftp.sgi.com/graphics/tiff
- libjpeg 6.0.1 nebo novější
Pro podporu JPEG obrázků
http://www.ijg.org/
- libgif 2.2 nebo libungif
Pro podporu GIF obrázků
Dostupné na ftp://prtr-13.ucsc.edu/pub/libungif/
-GNU xgettxt
Když chcete používat češtinu nebo jiné jazyky kromě angličtiny,
tak potřebujete GNU xgettext.
Ostatní verze nejsou kompatibilní a nebudou fungovat
GNU verze je dostupná na ftp://ftp.gnu.org
KONFIGURAČNÍ NASTAVENÍ
======================
Tyto volby mohou být předané konfiguračnímu skriptu jako argumenty za
účelem povolení/zakázání určité vlastnosti Window Makera.
Příklad:
./configura --enable-kde --enable-gnome
nakonfiguruje Window Maker s podporou KDE a GNOME
Seznam ostatních možností dostanete spuštěním ./configure --help
--with-libs-from
specifikuje, které další adresáře s knihovnami se mají
prohledávat. Řetězec -L musí předcházet každému adresáři,
např:
--with-libs-from="-L/opt/libs -L/usr/local/lib"
--with-incs-from
určuje, které další adresáře s hlavičkovými soubory se mají
prohledat. Řetězec -I musí předcházet každému adresáři,
např:
--with-incs-from="-I/opt/headers -I/usr/local/include"
--enable-single-icon
umožňuje skrýt všechny ikony aplikací WM_CLASS+WM_INSTANCE
do jedné jediné. Tato vlastnost není podporovaná ze strany vývojářů.
Když budete mít s touto funkcí problémy, tak se obraťte na jejího
autora: Christopher Seawood <cls@seawood.org>
--disable-shm
zakáže používání zdílené paměti MIT. To trochu zpomalí generování
textur, ale v některých případech se to jeví jako nezbytnost z důvodu
chyby, která způsobuje špatné zobrazování ikon a textur.
--disable-motif
zakáže podporu pokynů pro okenní manažer mwm.
--enable-lite
odstraní nástroje a funkce, které jsou dostupné v desktopových
prosředích KDE a GNOME. Odstraní se: seznam oken, menu aplikací,
výběr více oken. Uvědomte si, že takto nebudete schopni ukončit
samotný Window Maker pomocí aplikačního menu. Budete muset zabít Window
Maker z textové konzole nebo ho ukončit z KDE nebo GNOME.
Nedoporučuje se povolit tuto vlastnost.
--enable-modelock
podpora pro XKB nastavení jazyka. Když nevíte, o co jde, tak to
pravděpodobně nebudete potřebovat.
--enable-sound
povolí podporu modulu zvukových efektů.
--disable-xpm
zakáže podporu knihovny XPM, pokud je dostupná na vašem systému.
--disable-png
zakáže podporu knihovny PNG.
--disable-tiff
zakáže podporu knihovny TIFF.
--disable-gif
zakáže podporu knihovny GIF.
--disable-jpeg
zakáže podporu knihovny JPEG.
--disable-shape
zakáže tvarovaná okna (pro oclock, xeyes, atd.).
POŽADAVKY PRO SPECIFICKÉ PLATFORMY
==================================
-DEC/Alpha
Následující mail není přeložen, ale hovoří se v něm, že pravděpodobně
není potřeba konfigurovat Window Maker na Alphě s volbou --disable-shm.
-------------------------------------------------------------------------------
From: Anton Ivanov <aivanov@eu.level3.net>
To: Marcelo E. Magallon <mmagallo@debian.org>
Subject: Re: Is the WindowMaker package working ok on Alpha?
> Hi,
>
> I was reading some docs on the WindowMaker tarball, and found this:
>
> | - DEC/Alpha machines
> | You might need to pass the --disable-shm flag to configure,
> | like ./configure --disable-shm
>
> is anyone having problems with WindowMaker on Alpha? Can someone
> please test this? Should the flag be passed when building on Alpha?
Disclaimer: alphas under my command have never run X and are least likely to
suddenly start running it anytime soon.
Alpha used to have some ridiculously low amount of shared memory
configured.
So quite a lot of apps used to barf. Namely - cdrecord, mysql server, etc.
Check where is yours at the moment and raise it to a more appropriate
value by either catting to the appropriate /proc entry or changing the
/usr/src/linux/include/asm/shmparam.h.
Otherwise the shared memory on alpha should be fully functional and I
see no reason to disable it. Mine are bumped up to 32 or more on most
machines.
And If I recall correctly the comments in that file are actually
wrong. Value is not bytes, but in machine size word. For alpha *8.
As I said - I do not run X on them so all #include "stdisclaimer.h"
apply.
-------------------------------------------------------------------------------
- SCO Unix - configure spusťte takto:
CFLAGS="-belf -DANSICPP" ./configure
- SunOS, Solaris
Když máte naistalovaný gcc, tak configure spusťte takto:
CPP_PATH="gcc -E -x c" ./configure
Preprocesoru cpp od Sunu chybějí některé vlastnosti, které Window Maker
potřebuje, a to může způsobit problémy během parsování konfiguračních
souborů. Je možné, že budete muset použít --with-libs-from a
--with-incs-from k nahrazení adresáře s libtiff.
Někdo doporučuje použít /usr/local/lib jako první cestu v LD_LIBRARY_PATH.
Když máte Ultra Creator 3D nebo jinou high-end grafickou kartu, tak se
ujistěte, že X server startuje s 24 bitovou barevnou hloubkou, jinak
můžete mít problémy s pomícháním barev. Toto je chyba Window Makeru,
která bude odstraněna.
- GNU/Linux obecně
Ujistěte se, že soubor /etc/ld.so.conf obsahuje řádek "/usr/local/lib".
Odinstalujte jakoukoliv starší verzi balíčku Window Makeru před instalací
novější verze.
Nezapomeňte spustit ldconfig po instalaci Window Makeru.
- RedHat GNU/Linux
RedHat několik obtěžujících chyb. Pokud ho používáte dodržujte několik
následujících kroků, jinak vám Window Maker nebude fungovat.
* pokud máte nainstalovaný Window Maker z distribuce RedHat, tak ho před
upgradem odinstalujte
* ujistěte se, že nemáte systémové proměnné LANG a LINGUAS nastavené
na en_RN
* ujistěte se, že vaše systémová proměnná PATH obsahuje položku
/usr/local/bin
* ujistěte se, že soubor /etc/ld.so.conf obsahuje řádek "/usr/local/lib"
před tím, než spustíte ldconfig (na konci instalace)
* pokud máte problémy, které se projevují chybovou hláškou, která
obsahuje text --no-reexec, tak odinstalujte libtool-1.2b a nainstalujte
si novější verzi libtool-1.3. libtool-1.3 můžete nalézt na adrese:
ftp.gnu.org . Přečtěte si také odstavec ŘEŠENÍ PROBLÉMÚ.
* pokud máte nainstalovaný balíček Window Maker od RedHatu a nyní
instalujete novou verzi "ručně" (kompilováním zdrojových kódů), tak
nejprve odinstalujte stávající balíček.
* ujistěte se, že se na vašem systému nachází symbolický link z
/usr/include/X11 na /usr/X11R6/include/X11. Pokud tomu tak není, tak
na příkazovou řádku napište:
ln -s /usr/X11R6/include/X11 /usr/include/X11
* ujistěte se, že máte symbolický link /lib/cpp ukazující na cpp
program
Pokud pochybujete o nějakém z předcházejích kroků, tak neváhejte
kontaktovat uživatelskou podporu distribuce RedHat. Oni vám laskavě
zodpoví všechny vaše dotazy zohledňující váš systém. Oni vědí
mnohem více o vašem (jejich) systému než my (my nepoužíváme
RedHat).
- PowerPC MkLinux
Budete potřebovat poslední verzi Xpma. Starší verze pravděpodobně
obsahují chybu, která způsobuje zamrznutí systému.
- Debian GNU/Linux
Pokud chcete podporu JPEG a TIFF, tak se ujistěte, že máte nainstalovány
balíčky libtiff-dev a libjpeg-dev.
- SuSE GNU/Linux
Pokud máte již nainstalován baliček Window Maker od SuSE, tak ho
odstraňte než se pustíte do kompilace Window Makeru. když tak
neučiníte, budete mít problémy.
- MetroX (neznámá verze)
Metrox obsahuje chybu, která zapřičiňuje, že obrázky, které jsou
nastaveny jako pozadí, jsou poškozeny. Pokud používáte Metrox a
máte podivné problémy s texturami, tak nepoužívejte textury v
titulcích nebo používejte jiný X server.
INSTALACE
=========
Nejjednodušší způsob, jak nainstalovat Window Maker, je spustit skript
Install nebo Install.cs (ten s vámi komunikuje česky). Oba skripty
vás jednoduše provedou celou instalací.
su
Install.cs
Poznámka: tato metoda neposkytuje všechny možnosti konfigurace a pokud
se setkáte s nějakými problémy, tak stejně budete muset
použít následující způsob kompilace.
Kompilace Window Makeru
-----------------------
Pro osvědčený způsob zadejte následující příkazy v shellu:
./configure
make
pak se přihlašte jako root a zadejte:
make install
ldconfig
pokud nejste programátor a nebudete ladit Window Maker, tak se můžete zbavit
ladících symbolů v binárních souborech a zmenšit jejich velikost:
make install-strip
ldconfig
Takto zkompilujete a nainstalujete Window Maker se standartními parametry.
Pokud chcete upravit některé vlastnosti, tak musíte učinit následující:
1. (volitelné) Podívejte se na část MOŽNOSTI KONFIGURACE, kde jsou
uvedené možnosti konfigurace. Nebo spusťte:
./configure --help
tak dostanete kompletní seznam všech dostupných možností konfigurace.
2. Spusťte ./configure s možností, kterou jste si vybrali. Například,
pokud chcete použít možnost --enable-kde, tak zadejte:
./configure --enable-kde
3. (volitelné) Otevřete soubor ./src/wconfig.h vaším oblíbeným editorem
a upravte některé možnosti, které si přejete změnit.
4. Kompilace. Zadejte pouze:
make
5. Přihlaste se jako root (pokud tak nemůžetet učinit, tak si přečtěte
část "Nemám rootovské helso :-(") a nainstalujte Window Maker na váš
systém:
su root
make install
Nastavení specifické pro uživatele
----------------------------------
Tyto instrukce nejsou povinné, pokud upgradujete Window Maker ze starší
verze na novější a pokud není uvedeno jinak v souboru NEWS.
Každý uživatel na vašem systému, který si přeje používat Window Maker musí
udělat následující:
1. Nainsatlovat konfigurační soubory Window Makeru do jeho domovského
adresáře:
wmaker.inst
wmaker.inst nainstaluje konfigurační soubory a nastaví X server tak,
aby automaticky spouštěl Window Maker při jejich spuštění.
To je všechno, přátelé.
Informace o konfiguraci a spoustě ostatních věcí vám poskytne:
man wmaker
Pro hlubší úvod do Window Makeru si přečtěte Uživatelskou příručku (User Guide).
Měli byste se také podívat na FAQ (Frequently Asked Questions = často kladené
otázky), pokud budete mít nějaké problémy/potíže jak při samotné kompilaci,
tak s užíváním Window Makeru.
Instalování speciálního balíčku
-------------------------------
Rozbalte WindowMaker-extra-<číslo_verze>.tar.gz v adresáři /usr/local/share
Tento soubor si můžete sehnat na adrese: ftp://ftp.windowmaker.org. Instalace
tohoto souboru vůbec není nutná. tento balíček obsahuje několik ikon a témat.
Hledejte poslední dostupnou verzi. V balíčku také naleznete soubor
WindowMaker-extra.readme, který vám poradí, co máte udělat.
Nemám rootovské helso :-(
-------------------------
Pokud nemáte superuživatelská privilegia (nemůžete se přihlásit jako root),
tak nezoufejte, protože můžete nainstalovat Window Maker do vašeho vlastního
domovského adresáře. K tomu musíte použít volbu --prefix při spuštění
./configure. Také musíte použít volbu --with-appspath, která specifikuje
cestu pro WPrefs.app.
Příklad:
./configure --prefix=/home/karel --with-appspath=/home/karel/GNUstep/Applications
Potom přidejte adresář /home/karel/bin do systémové proměnné PATH a adresář
/home/karel/lib do sytémové proměnné LD_LIBRARY_PATH a nakonec spusťte
~/bin/wmaker.inst.
Samozřejmě, že adresář /home/karel bude ve vašem případě nahrazen vaším
vlastním domovským adresářem.
UPGRADE
=======
Pokud upgradujete ze starší verze Window Makeru:
1. Nakonfigurujte a zkompilujte Window Maker jako obvykle.
2. Nainstalujte Window Maker (ale nespouštějte wmaker.inst).
3. Přečtěte si soubor NEWS a aktualizujte vaše konfigurační soubory,
pokud je to nezbytné.
ŘEŠENÍ PROBLÉMÚ
===============
Pokud máte nějaké problémy během konfigurace (když běží configure), jako
například neschopnost použít knihovnu grafického formátu, o kterém víte, že
ho máte nainstalován, tak se podívejte do souboru config.log. Možná zde
najdete příčinu svých problémů.
== Error with loading fonts, even if they exist.
Zkuste kompilaci bez podpory NLS (národního prostředí).
== Error when configuring
ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
odstraňte volbu --no-reexec ze souboru aclocal.mc a spusťte znovu configure.
Také zkontrolujte, zda verze autoconfu a automaku, které máte nainsatlované
odpovídají níže uvedeným hodnotám:
autoconf 2.13
automake 1.4
libtool 1.3
Poznámka: nemůže to být libtool 1.2b, ale musí to být libtool 1.3 ze stránek
GNU.
== configure doesn't detect libtiff, or other graphic libraries.
Smažte soubor config.cache, pak znovu spusťte configure s následujícími
volbami (a jinými, které používáte):
--with-libs-from="-L/usr/local/lib"
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
Na příslušná místa vložte cesty k vaším grafickým knihovnám a odpovídajícím
hlavičkovým souborům. Můžete zadat několik cest do těchto voleb, jako je to
ve výše uvedeném příkladě --with-incs-from. Jenom je nezapomeňte oddělit
mezerou.
== configure doesn't detect libXpm.
* Zkontrolujte, jestli máte symbolický link ze souboru libXpm.so.4.9 na
soubor libXpm.so
== Segmentation fault on startup
* Zkontrolujte, jestli verze knihovny libXPM je vyšší než 4.7
* Zkontrolujte, zda-li máte upravenou verzi ~/GNUstep/Defaults/WindowMaker
Pokud si nejste jisti, tak zkuste přejmenovat ~/GNUstep na ~/GNUtmp a
spusťte wmaker.inst
== "...: your machine is misconfigured. gethostname() returned (none)"
* Jméno vašeho počítače je nastaveno nesprávně, protože začíná uvozovkami.
Spusťte man hostname a zde se dozvíte, jak změnit jméno vašeho počítače.
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker nemůže nalézt cpp (preprocesor jazyka C). Pokud se váš cpp
nenachází v /lib/cpp, tak otevřte soubor src/config.h a nastavte správně
cestu CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up
* Přečtěte si odstavec POŽADAVKY na začátku tohoto souboru.
MÍSTNÍ NASTAVENÍ / INTERNACIONALIZACE
=====================================
Window Maker podporu národních jazyků. Aby jste ji povolili, tak
musíte zkompilovat Window Maker s několika dalšími parametry.
Seznam podporovaných jazyků naleznete v souboru ./po/README.
0 - Musíte mít nainstalovaný balíček GNU gettextu. Tento balíček
můžete nalézt na ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
Kroky 1,2 a 3 můžete vynechat, pokud používáte skript Install.cs nebo
skript Install.
1 - Vyberte si jazyky, které budete chtít používat. Zadejte seznam
těchto jazyků do systémové proměnné LINGUAS. Angličtina je
podporována vždy. Příklady
C - shell:
setenv LINGUAS "pt ja de"
Bash(sh):
export LINGUAS
LINGUAS="pt ja de"
Přečtěte si soubor po/README pokud chcete přeložit Window Maker
pro nějaký další jazyk.
2 - Navíc, pokud váš jazyk používá multi-byte znaky, například Japonština
nebo Korejština, tak musíte nastavit volbu the MultiByteText na YES
v souboru ~/GNUstep/Defaults/WMGLOBAL
3 - Nakonfigurujte, zkompilujte a nainstalujte Window Maker jako obvykle.
4 - Národní prostředí si můžete změnit i za běhu Window Makeru. Systémovou
proměnnou LANG nastavíte na vámi zvolenou hodnotu. Například, pokud
chcete použít portugalské prostředí, musíte spustit:
C - shell:
setenv LANG pt
Bourne shell a podobné:
export LANG
LANG=pt
Nakonec musíte restartovat/spustit Window Maker.
Poznámka: Když máte nastavenou systémovou proměnnou LC_TYPE, tak
musíte zrušit před spuštěním Window Makeru.
Window Maker hledá soubory s definicí menu v tomto pořadí (pro
brazilskou portugalštinu):
menu.pt_BR
menu.pt
menu
5 - Pokud si vyberete jazyk, který používá multi-byte znaky, tak musíte
příslušným způsobem nastavit fonty. Přečtěte si manuálové stránky
o XCreateFontSet k získání většího množství informací o daném
problému. Musíte změnit v souboru ~/GNUstep/Default/WindowMaker
nastavení fontů pro titulky, menu, atd. Fonty pro dialogy nastavíte
v souboru ~/GNUstep/Default/WMGLOBAL. Řetězce %d ve jménech fontů
nemusí být odstraněné. Také můžete použít skript wsetfont, který
toto vše učiní za vás. Pokud se ho rozhodnote použít, tak si k němu
přečtěte instrukce tak, že spustíte wsetfont bez argumentů.
Příklad části souboru ~/GNUstep/Default/WindowMaker:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
a souboru ~/GNUstep/Default/WMGLOBAL:
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
Tyto dva fonty jsou používány v aplikacích, které používají WINGs (WindowMaker a
WPrefs.app).
Skript wsetfont vám umožní nastavit fonty mnohem jednoduším způsobem. Podívejte
se na jeho manuálové stránku k získání bližších informací.

View File

@@ -1,594 +0,0 @@
Instrucciones de Instalación para Window Maker
PLATAFORMAS SOPORTADAS
======================
(obs: Alguien me mencionó que lo compiló en...)
- Intel GNU/Linux Conectiva 5.9 (beta)
- Intel GNU/Linux Slackware
- Intel GNU/Linux Debian
- Intel GNU/Linux other distributions
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 over MacOS
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
- IBM S/390 running Linux
- iBook running Darwin
- Windows NT with Cygwin/XFree86
- Sony PlayStation2 running Linux
Todas las marcas registradas están registradas por sus dueños. (duh)
Los parches que lo hagan funcionar en otras plataformas son bienvenidos.
REQUERIMIENTOS:
==============
El siguiente software se necesita para usar Window Maker:
- X11R6.x
Window Maker puede ser compilado en versiones más antiguas de X,
como X11R5 (Solaris) o X11R4 (OpenWindows) pero no funcionará 100%
correctamente.
En tales servidores no habrá íconos de aplicación y tendrá problemas
usando el dock. Actualizar las bibliotecas cliente (Xlib, Xt, etc)
ayudará si no puede actualizar el servidor.
Lo siguiente se necesita para compilar Window Maker:
- Requerimientos básicos y obvios
Si compila Window Maker, asegúrese de tener gcc (u algún otro
compilador ANSI C) y los archivos header de X instalados. Especialmente
para los usuarios de Linux principiantes: debe instalar todos los paquetes
de desarrollo de X y la suite gcc. De lo contrario no será capaz de
compilar ningún programa X, incluyendo Window Maker.
- libPropList
Esta biblioteca se puede encontrar en ftp://ftp.windowmaker.org/pub/libs
o en ftp://ftp.gnome.org/pub/libPropList
Instálela antes de compilar Window Maker.
- autoconf, automake y libtool
Estas herramientas NO son necesarias, pero SI tiene una o más de ellas
instaladas, asegúrese de tener TODO lo siguiente con estas versiones
exactas:
autoconf 2.54
automake 1.4
libtool 1.4.2
Si tiene una versión distinta, desactívelas temporalemte renombrándolas
a otras cosa o desinstalándolas desde su sistema. Si no desarrolla
software no las necesita, así que puede desinstalarla sin peligro.
- lex (o flex) y yacc (o bison)
Estas son usadas por libPropList. lex en realidad no se necesita ya que
su archivo de salida está incluido, pero o yo o automake es tonto,
causando que el script configure para libPropList simplemente
aborte sin ningún motivo si lex no es encontrado.
OPCIONAL:
=========
Estas bibliotecas no son necesarias para hacer que Window Maker funcione,
pero están soportadas en caso de que quiera usarlas. Los números de versión
son aquellos que yo tengo (y por lo tanto, garantizo que funciona), pero
otras versiones podría funcionar también.
- libXPM 4.7 o más actual.
Versiones antiguas pueden no funcionar!!!
Disponible en ftp://sunsite.unc.edu/pub/Linux/libs/X/
Hay soporte nativo para archivos XPM, pero no cargará imagenes de
algunos formatos poco comunes.
-libpng 0.96 o más actual y zlib
Para soporte de imágenes PNG.
http://www.cdrom.com/pub/png/
- libtiff 3.4 o más actual.
Para soporte de imaen TIFF.
Puede obtenerla en ftp://ftp.sgi.com/graphics/tiff
- libjpeg 6.0.1 o más actual
Para soporte de imagen JPEG
http://www.ijg.org/
- libgif 2.2 o libungif
Para soporte de imagen GIF.
ftp://prtr-13.ucsc.edu/pub/libungif/
- GNU xgettext
Si quiere usar mensajes traducidos, necesitará GNU gettext.
Otras versiones de gettext no son compatibles y no funcionarán.
Obtenga la versión GNU desde ftp://ftp.gnu.org
OPCIONES DE CONFIGURACIÓN:
=========================
Estas opciones pueden ser pasadas al script configure para activar/desactivar
algunas opciones de Window Maker. Ejemplo:
./configure --enable-kde --enable-gnome
configurará Window Maker para que sea compilado con soporte para KDE y GNOME.
Para obtener una lista de otras opciones, ejecute ./configure --help
--with-libs-from
especifica rutas adicionales por donde se debe buscar bibliotecas.
El -L flag debe preceder a cada ruta, tal como:
--with-libs-from="-L/opt/libs -L/usr/local/lib"
--with-incs-from
especifica rutas adicionales para la búsqueda de archivos header.
El parámetro -I debe preceder a cada ruta, tal como:
--with-incs-from="-I/opt/headers -I/usr/local/include"
--enable-single-icon
activa el agrupamiento de todos los appicons (iconos de aplicaciones)
del WM_CLASS+WM_INSTANCE en uno solo. Esta característica no es soportada
por todos los desarrolladores. Si tiene algún problema con ella, contacte
a su autor: Christopher Seawood <cls@seawood.org>
--disable-shm
desactiva el uso de la extensión MIT de memoria compartida. Esto
ralentizará la generación de texturas un poco, pero en algunos casos
parecerá necesario debido a un error que se manifiesta como íconos y
texturas desordenadas.
--disable-motif
desactiva el soporte para el gestor de ventanas mwm.
--enable-lite
quita cosas que ya están soportadas en los entornos de escritorio,
tal como KDE y Gnome. Desactiva cosas como: lista de ventanas,
menú de aplicaciones raíz, selección de ventanas múltiple. Note
que no podrá salir más desde dentro de Window Maker; tendrá que usar
kill con la señal SIGTERM o salir de KDE. No aconsejo activarlo.
--enable-modelock
Soporte para bloqueo de estado de lenguaje XKB. Si no sabe que es esto
probablemente no lo necesite.
--enable-sound
activa el soporte del módulo para efectos sonoros.
--disable-xpm
desactiva el uso de la biblioteca XPM aunque este disponible en su
sistema.
--disable-png
desactiva el uso de la biblioteca PNG.
--disable-tiff
desactiva el uso de la biblioteca TIFF.
--disable-gif
desactiva el uso de la biblioteca GIF.
--disable-jpeg
desactiva el uso de la biblioteca JPEG.
--disable-shape
desactiva la forma de ventanas (para oclock, xeyes etc.)
NOTAS ESPECÍFICAS A LA PLATAFORMA:
=================================
- máquinas DEC/Alpha
#>>>>>>>>>>>
From: Anton Ivanov <aivanov@eu.level3.net>
To: Marcelo E. Magallon <mmagallo@debian.org>
Subject: Re: El paquete WindowMaker funciona bien en Alpha?
> Hola,
>
> Estuve leyendo algunos documentos en el tarball de WindowMaker,
> y encontré esto:
>
> | - máquinas DEC/Alpha
> | podría necesitar pasar el parámetro --disable-shm a configure,
> | así ./configure --disable-shm
>
> alguien está teniendo problemas con WindowMaker en Alpha? Puede alguien
> por favor probar esto? Debería el parámetro ser pasado al compilar
> en Alpha?
Descargo de responsabilidad: alphas bajo mi mando nunca han ejecutado X
y es poco probable de que las ejecute repentinamente en algún momento.
Alpha suele tener alguna ridícula poca cantidad de memoria compartida
configurada.
Así que muchísimas aplicaciones suelen to barf. Concretamente - cdrecord, mysql server, etc.
Verifique donde está el suyo en este momento y súbalo a un valor más adecuado catting la entrada
adecuada de /proc o cambiando el /usr/src/linux/include/asm/shmparam.h.
De lo contrario la memoria compartida en alpha debiera ser completamente funcional y no veo razón
para desactivarla. Las mías están aumentadas a 32 o más en muchas máquinas.
Y si recuerdo correctamente los comentarios en aquél archivo están en realidad mal.
El valor no está en bytes, pero si en palabra de tamaño máquina. Para alpha *8.
Como dije - no ejecuto X en ellas asi que apliqué a todas #include "stdisclaimer.h".
#<<<<<<<<<<<<
- SCO Unix - ejecute configure así
CFLAGS="-belf -DANSICPP" ./configure
-SunOS, Solaris
Si tiene gcc instalado, ejecute configure como:
CPP_PATH="gcc -E -x c" ./configure
Sun cpp le falta algunas características que necesita Window Maker y
puede causarle problemas al analizar sintacticamente los archivos config.
También podría necesitar usar el --with-libs-from y --with-incs-from para
suministrarle el directorio donde libtiff se aloja.
Alguien me envió un mensaje diciéndome que también debe hacer que /usr/local/lib
sea la primera ruta en LD_LIBRARY_PATH para que funcione.
Si tiene un Ultra Creator 3D o alguna otra máquina con gráficos high-end,
asegúrese de iniciar el servidor X con el valor visual por defecto a 24bpp o
podría experimentar problemas con colores destrozados.
Este es un error de wmaker y será reparado.
- GNU/Linux en general
Asegúrese de tener /usr/local/lib en /etc/ld.so.conf y de ejecutar
ldconfig después de instalar.
Desinstale cualquier versión empaquetada de Window Maker antes de
instalar una nueva versión.
- RedHat GNU/Linux
Los sistemas RedHat tienen varios problemas molestos. Si lo usa,
asegúrese de seguir los pasos de más abajo o Window Maker no funcionará:
* si instaló el Window Maker que viene con RedHat, desinstálelo antes de
actualizar;
*asegúrese que no tiene las variables de entorno LANG y LINGUAS establecidas a
en_RN;
*asegúrese de tener /usr/local/bin en su variable de entorno PATH;
* asegúrese de tener /usr/local/lib en /etc/ld.so.conf antes de ejecutar
ldconfig;
*si tiene problemas que mencionan un menaje de error con --no-reexec
desinstale libtool-1.2b e instale libtool-1.3 en su lugar. libtool-1.3
se puede encontrar en ftp.gnu.org. También lea la sección TROUBLESHOOTING
(PROBLEMAS);
* si instaló el paquete Window Maker desde RedHat y está instalando una
nueva versión de WM a mano (compilandolo usted mismo), desinstale antes el
paquete desde RedHat.
*asegúrese de tener un enlace simbólico desde /usr/include/X11 hacia
/usr/X11R6/include/X11 (si no, tipee ln -s /usr/X11R6/include/X11 /usr/include/X11)
* asegúrese de tener /lib/cpp apuntando al programa cpp.
Si tiene alguna duda en cuanto a hacer algunas de las cosas de arriba,
por favor no dude en contactar el soporte para usuarios de RedHat. Ellos
responderán amablemente a todas sus preguntas en lo que respecta a su sistema.
Ellos también conocen mucho más acerca de su propio sistema que nosotros
(nosotros no usamos RedHat).
- PowerPC MkLinux
Necesitará tener la última version de Xpmac. Las versiones más antiguas
parecen tener errores que producen el cuelgue del sistema.
- Debian GNU/Linux
Si quiere soporte JPEG y TIFF, asegúrese de tener libtiff-dev y
libjpeg-dev instalados.
- SuSE GNU/Linux
Si instaló el paquete Window Maker desde SuSE,
desinstálelo antes de instentar compilar wmaker o podría
tener problemas.
- MetroX (version desconocida)
MetroX tiene un error que corrompe pixmaps que se establecen como
fondos de ventana. Si usa MetroX y tuvo problemas raros con texturas, no use
texturas en las barras de títulos. O use un servidor X distinto.
INSTALACIÓN:
=============
Compilando Window Maker
------------------
Para un comienzo rápido, tipee lo siguiente en el prompt del shell:
./configure
make
luego, regístrese como root y tipee:
make install
ldconfig
o si quiere remover los símbolos de depuración desde los binarios y hacerlos más
pequeños, puede tipear:
make install-strip
ldconfig
Esto compilará e instalará Window Maker con los parámetros por defecto.
Si quiere personalizar algunas opciones de compilación, puede hacer lo siguiente.
1. (opcional)Mire en la sección OPCIONES DE CONFIGURACIÓN para ver las
opciones disponibles. También ejecute:
./configure --help
para obtener un listado completo de otras opciones que están disponibles.
2. Ejecute configure con las opciones que quiera. Por ejemplo, si quiere
usar la opción --enable-kde, tipee:
./configure --enable-kde
3. (opcional) Edite src/wconfig.h con su editor de texto favorito y
echele un vistazo por algunas opciones que podría querer cambiar.
4. Compile. Solo tipee:
make
5. Regístrese como root (si no puede hacerlo, lea la sección "No tengo la contraseña de root" :-()
e instale Window Maker en su sistema:
su root
make install
Configuración específica del usuario
------------------------------------
Estas instrucciones no necesitan ser seguidas al actualizar Window Maker
desde una versión más antigua, a menos que se indique de otra forma en el archivo
NEWS.
Todo usuario en su sistema que desee ejecutar Window Maker debe hacer lo siguiente:
1. Instale los archivos de configuración de Window Maker en su directorio home.
Tipee:
wmaker.inst
wmaker.inst instalará los archivos de configuración de Window Maker y
configurará X para que automáticamente lance Window Maker al inicio.
Eso es todo!
Puede tipear "man wmaker" para obtener algo de ayuda general para la
configuración y otras cosas.
Lea la Guia de Usuario para una explicación más a fondo de Window Maker.
Podría querer dar una mirada a la FAQ también.
Instalando el paquete extras
----------------------------
Desempaquete WindowMaker-extra-<número-de-versión>.tar.gz en /usr/local/share
Puede obtener el archivo en ftp://ftp.windowmmaker.org. Este archivo es optativo
y solo tiene unos pocos íconos, y temas. Busque el último <número-de-versión>
disponible.
También hay un WindowMaker-extra.readme que le enseña donde vería ir ese paquete.
No tengo la contraseña de root :(
--------------------------------
Si no puede obtener privilegios de superusuario (no puede ser root) puede
instalar wmaker en su propio directorio home. Para esto, proporcione la
opción --prefix al ejecutar configure en el paso 2 de compilando Window Maker.
También necesitará proporcionar la opción --with-appspath, para especificar la ruta
para WPrefs.app. Ejemplo:
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Applications
Luego haga /home/jshmoe/bin para que se lo incluya en su ruta de búsqueda, agregue
/home/jshmoe/lib a su variable de entorno LD_LIBRARY_PATH y ejecute bin/wmaker.inst
Por supuesto, /home/jshmoe se supone que va a ser reemplazado con la ruta a su
directorio home real.
ACTUALIZANDO
============
Si está actualizando desde una versión antigua de Window Maker:
1. Configure y compile Window Maker como siempre.
2. Instale Window Maker (pero no ejecute wmaker.inst)
3. Lea el archivo NEWS y actualice sus archivos de configuración,
si es necesario.
PROBLEMAS
=========
Cuando tenga alguno problemas durante la configuración (al ejecutar configure),
tal como no poder usar una biblioteca de formato gráfico que piensa tener instalada,
mire en el archivo config.log para obtener ideas sobre el problema.
== Error al cargar las fuentes, siempre que existan.
Intente recompilar sin el soporte NLS.
== Error al configurar
ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
quite la opción --no-reexec desde aclocal.m4 y libPropList/aclocal.m4 y
reconfigure.
También asegúrese que las versiones de autoconf y automake que tenga instaladas son:
autoconf 2.13
automake 1.4
libtool 1.3
Note que ella no debe ser libtool 1.2b, debe ser libtool 1.3,
desde los sitios GNU.
== No puedo encontrar proplist.h o libPropList.something
Baje e instale libPropList desde los lugares ya citados en algún lugar
de este archivo.
== configure no detecta libtiff, u otras bibliotecas gráficas.
Elimine config.cache, luego vuelva a ejecutar configure añadiendo las siguientes
opciones a configure (entre sus otras opciones):
--with-libs-from="-L/usr/local/lib"
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
Sustituya las rutas donde están localizadas sus bibliotecas gráficas y sus
correspondientes archivos header. Puede colocar rutas múltiples en cualquiera de
estas opciones, como se muestra en el ejemplo de --with-incs-from . Solo coloque
un espacio entre ellas.
== configure no detecta libXpm.
* Verifique si tiene un enlace simbólico desde libXpm.so.4.9 a libXpm.so
== Segmentation fault al inicio.
* Verifique si la versión de libXPM que tiene es por lo menos la 4.7
* Verifique si tiene una versión actualizada de ~/GNUstep/Defaults/WindowMaker
Si no está seguro, intente renombrar ~/GNUstep a ~/GNUtmp y luego ejecute wmaker.inst
== "...: your machine is misconfigured. gethostname() returned (none)"
* el hostname de su máquina está definido a algo inválido, como comenzar con
un paréntesis. Haga un man hostname para obtener información acerca de como definirlo.
== El menú raíz contiene solo 2 entradas. ("XTerm" y "Exit...")
* Window Maker no está encontrando cpp (el preprocesador de C). Si su
cpp no está ubicado en /lib/cpp, edite src/config.h y corrija la ruta en
CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up
* Lea la sección REQUERIMIENTOS de este archivo.
LOCALES/INTERNACIONALIZACIÓN
============================
Window Maker tiene soporte de idioma nacional. Para activar este soporte,
debe compilar Window Maker con algunos parámetros adicionales.
0 - Debe tener el paquete GNU gettext instalado. Puede obtenerse en
ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
Los pasos 1 al 3 pueden saltearse si usa el script Install.
1 - Debe seleccionar los idiomas que quiere soportar. Defina el
LINGUAS a la lista de locales que quiera. El Inglés siempre está
soportado. Ejemplo:
setenv LINGUAS "pt ja de"
en csh
o
export LINGUAS;LINGUAS="pt ja de"
en sh
La lista de locales soportados se pueden encontrar en po/README.
El Inglés es el idioma pr defecto.
Lea po/README si desea traducir y mantener archivos locale para otros
idiomas.
2 - Adicionalmente, si su idioma usa caracteres multi-byte, tal como
Japonés o Coreano, debe definir la opción MultiByteText a YES
en ~/GNUstep/Defaults/WMGLOBAL
3 - Configure, compile e instale Window Maker normalmente.
4 - Para seleccionar un locale particular en tiempo de ejecución debe definir la
variable de entorno LANG al locale que quiera. Por ejemplo, si quiere definir
el locale portugués, debe ejecutar
setenv LANG pt
en csh o
export LANG; LANG=pt
en Bourne sh y similares
Nota: Si tiene definida la variable de entorno LC_CTYPE, debe
indefinirla antes de ejecutar wmaker.
Window Maker busca los archivos de definición de menú en el siguiente orden:
(para portugués brasileño, en este caso):
menu.pt_BR
menu.pt
menu
5 - Si elige un idioma que usa caracteres multi-byte, debe configurar
las fuentes adecuadamente. Lea la página del manual para XCreateFontSet
para obtener más detalles sobre esto. Debe cambiar el archivo ~/G/D/Windowmaker
para las fuentes usadas en barras de título, menús y otras cosas. Para las fuentes
usadas en ventanas de diálogo, cambie ~/G/D/WMGLOBAL. El %d en los nombres de las
fuentes no debe ser quitado. Puede también usar el script wsetfont proporcionado para
esta tarea. Lea el mismo script para obtener instrucciones.
Por ejemplo, puede especificar lo siguiente en ~/G/D/WindowMaker:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
y en ~/G/D/WMGLOBAL:
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
Las 2 fuentes de arriba son usadas únicamente por aplicaciones que usan WINGs
(WindowMaker y WPrefs.app)
El script wsetfont que se proporciona le permitirá cambiar las definiciones de fuentes
de una manera fácil. De una mirada al script para detalles de uso.
traducido por Efraín Maximiliano Palermo <max_drake2001@yahoo.com.ar>

View File

@@ -1,631 +0,0 @@
Instructions pour l'installation de Window Maker
PLATEFORMES SUPPORTÉES
======================
(c.à.d. : j'ai entendu dire que la compilation a été réalisée avec succès sur..)
- Intel GNU/Linux Conectiva 5.9 (beta)
- Intel GNU/Linux Slackware
- Intel GNU/Linux Debian
- Intel GNU/Linux (autres)
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- Solaris 2.8 sur Ultra Sparc 10 et E450
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 sous MacOS
- Amiga 3000 sous RedHat Linux 5.1 (Rawhide)
- IBM S/390 sous Linux
- IBM S/390 sous Conectiva Linux (experimental)
- iBook sous Darwin
- Windows NT sous Cygwin/XFree86
- Sony PlayStation2 sous Linux
Toutes les marques déposées sont la propriété de leur propriétaire.
Tout patch qui pourrait faciliter l'adaptation à d'autres plateformes
est le bienvenu.
PRÉ-REQUIS
==========
Les logiciels suivants sont nécessaires à l'utilisation de Window Maker :
- X11R6.x
Window Maker peut être compilé avec des versions plus anciennes de X,
comme X11R5 (Solaris) ou X11R4 (OpenWindows), mais il ne fonctionnera
pas correctement à 100%.
Avec ces serveurs X, les icônes des applications n'apparaîtrons pas,
et vous aurez des problèmes à l'utilisation du dock. La mise à jour
des librairies côté client (Xlib, Xt, etc.) pourront améliorer les
choses si vous ne pouvez pas mettre à jour le serveur.
Les éléments suivants sont nécessaires à la compilation de Window Maker :
- pré-requis de base
Pour compiler Window Maker, assurez-vous que gcc (ou tout autre
compilateur de C ANSI) ainsi que les fichiers d'en-têtes de X sont
installés. Débutants sous Linux : vous devez installer les paquetages
de développement de X ainsi que ceux de la suite gcc. Le cas contraire,
vous ne pourrez jamais compiler aucun programme prévu pour X, y compris
Window Maker.
- autoconf, automake et libtool
Ces outils ne sont pas indispensables, mais si au moins l'un d'eux
est installé sur votre système, assurez-vous que TOUS le sont, et
que les versions de ces outils sont exactement :
autoconf 2.54
automake 1.4
libtool 1.4.2
Si les versions installées sur votre système différent, désactivez-les
provisoirement, par exemple en les renommant, ou en les désinstallant
de votre système. Si vous ne développez ni de compilez de logiciels,
vous n'en avez pas besoin et leur désinstallation n'est donc pas un
problème.
OPTIONNEL
=========
Ces librairies ne sont pas nécessaires pour utiliser Window Maker, mais
elles sont supportées, au cas où vous souhaiteriez les utiliser. Les
versions ci-dessous sont celles dont je dispose (et du coup, il est
garanti qu'elles fonctionnent), mais des versions différentes peuvent
fonctionner aussi bien.
- libXPM 4.7 ou plus récent
Les versions plus anciennes peuvent ne pas fonctionner !!!
Disponible sur ftp://sunsite.unc.edu/pub/Linux/libs/X/
Le support des fichiers XPM est intégré, mais il ne prendra
pas en compte les images dont le format est exotique.
- libpng 0.96 ou plus récent, et zlib
Pour pouvoir utiliser les images au format PNG.
http://www.cdrom.com/pub/png/
- libtiff 3.4 ou plus récent
Pour pouvoir utiliser les images au format TIFF.
Vous trouverez ça ici : ftp://ftp.sgi.com/graphics/tiff
- libjpeg 6.0.1 ou plus récent
Pour pouvoir utiliser les images au format JPEG.
http://www.ijg.org/
- libgif 2.2 ou libungif
Pour pouvoir utiliser les images au format GIF.
ftp://prtr-13.ucsc.edu/pub/libungif/
- GNU xgettext
Si vous voulez disposer des traductions en d'autres langues, GNU gettext
est nécessaire. Les autres versions de gettext sont incompatibles et ne
fonctionneront pas.
Vous trouverez la version GNU sur ftp://ftp.gnu.org
OPTIONS DE CONFIGURATION
========================
Ces options peuvent être passées au script de configuration afin d'activer
ou désactiver des fonctionnalités de Window Maker. Par exemple :
./configure --enable-kde --enable-gnome
configurera Window Maker avec le support intégré pour KDE et GNOME.
Afin d'obtenir la liste des autres options, exécutez ./configure --help
--with-libs-from
ajoute des chemins d'accès pour la recherche des librairies.
L'option -L doit précéder chaque chemin d'accès, comme suit :
--with-libs-from="-L/opt/libs -L/usr/local/lib"
--with-incs-from
ajoute des chemins d'accès pour la recherche des fichiers d'en-tête.
L'option -I doit précéder chaque chemin d'accès, comme suit :
--with-incs-from="-I/opt/headers -I/usr/local/include"
--enable-single-icon
active le regroupement des toutes les appicons des WM_CLASS et WM_INSTANCE
en une seule icône. Aucun support n'est offert par les développeurs pour
cette fonctionnalité. Si vous avez des problèmes avec celle-ci, contactez
son auteur :
Christopher Seawood <cls@seawood.org>
--disable-shm
désactive l'utilisation de l'extension "MIT shared memory". Cela ralentira
un petit peu la génération des textures, mais il semble que cela soit
nécessaire dans certains cas pour éviter un bogue se manifestant au niveau
des icônes et des textures.
--disable-motif
désactive le support pour les fonctionnalités en rapport avec le gestionnaire
de fenêtres mwm.
--enable-lite
désactive des fonctionnalités déjà prises en compte par les gestionnaires de
bureau tels que KDE et GNOME. Celà concerne : la liste de fenêtres, le menu
des applications, la sélection multiple de fenêtres. Attention : vous ne
pourrez plus sortir de Window Maker autrement qu'en utilisant kill avec le
signal SIGTERM ou en quittant à l'aide de KDE. Il n'est pas conseillé
d'utiliser cette option.
--enable-modelock
active le support pour le verrouillage du "XKB language status". Si vous ne
savez pas de quoi il retourne, c'est probablement que vous n'en avez pas
utilité.
--enable-sound
active le support pour le module de gestion des effets sonores.
--disable-xpm
désactive l'utilisation de la librairie XPM même si elle est présente
sur votre système.
--disable-png
désactive l'utilisation de la librairie PNG.
--disable-tiff
désactive l'utilisation de la librairie TIFF.
--disable-gif
désactive l'utilisation de la librairie GIF.
--disable-jpeg
désactive l'utilisation de la librairie JPEG.
--disable-shape
désactive l'utilisation de "shaped windows" (pour oclock, xeyes, etc.).
NOTES SPÉCIFIQUES AUX PLATEFORMES
=================================
- machines DEC/Alpha
#>>>>>>>>>>>
De : Anton Ivanov <aivanov@eu.level3.net>
A : Marcelo E. Magallon <mmagallo@debian.org>
Sujet : Re : Est-ce que le paquetage WindowMaker fonctionne correctement sur Alpha?
> Salut,
>
> Je lisais la doc contenue dans l'archive de WindowMaker, quand je suis
> tombé sur ça :
>
> | - machines DEC/Alpha
> | Il est possible que vous deviez utiliser l'option --disable-shm pour
> | configurer la compilation, comme suit :
> | ./configure --disable-shm
>
> est-ce que quelqu'un a eu des problèmes avec WindowMaker sur Alpha? Est-ce
> que quelqu'un peut tester cela? Doit-on vraiment utiliser cette option
> pour compiler sur Alpha?
Notez bien : les Alphas dont je me sers ne sont jamais sous X et ne sont pas près
de l'être.
Bien souvent, la configuration des Alphas n'inclut qu'un volume ridiculement
petit de mémoire partagée. Aussi il n'est pas étonnant qu'un grand nombre
d'applications comme cdrecord ou mysql server plantent carrément.
Vérifiez ces réglages sur votre système et modifiez-les en conséquent :
pour cela, manipulez l'entrée appropriée dans /proc ou modifiez le fichier
/usr/src/linux/include/asm/shmparam.h.
En dehors de ce cas, la mémoire partagée sous Alpha est sensée ne pas
poser de problème et je ne vois aucune raison de la désactiver.
Pour ma part, elle est à 32 ou plus sur la pluspart des machines.
De plus, si ma mémoire est exacte, les commentaires dans ce fichier
sont tout à fait inexacts. La valeur n'est pas exprimée en octets, mais en
mots, dépendant de la machine. Pour les Alphas, c'est donc *8.
Je rappelle que je n'utilise pas X sur ces machines, donc ce que j'indique
est soumis à toutes les réserves habituelles. (#include "standard_disclaimer.h")
#<<<<<<<<<<<<
- SCO Unix
Lancez configure comme suit :
CFLAGS="-belf -DANSICPP" ./configure
- SunOS, Solaris
Si gcc est installé, lancez configure comme suit :
CPP_PATH="gcc -E -x c" ./configure
Le cpp de Sun ne dispose pas de certaines fonctionnalités nécessaire pour
Window Maker et cela peut occasionner des problèmes avec l'utilisation des
fichiers de configuration.
Il peut être aussi nécessaire d'indiquer le chemin d'accès à la librairie
libtiff en utilisant les options --with-libs-from et --with-incs-from
avec configure.
Quelqu'un m'a rapporté qu'il est nécessaire de faire figurer /usr/local/lib
en premier dans la variable d'environnement LD_LIBRARY_PATH.
Si vous utilisez un Ultra Creator 3D ou une autre machine graphique
de haut niveau, faites en sorte de démarrer le serveur X avec le mode
graphique par défaut à 24bpp sinon vous pourriez constaer des problèmes
au niveau des couleurs.
C'est une bogue répertorié au niveau de Window Maker, il sera corrigé.
- GNU/Linux en général
Assurez-vous que /usr/local/lib figure dans /etc/ld.so.conf et que vous
avez lancé ldconfig après l'installation.
Désinstallez tout précédent paquetage de Window Maker avant d'installer
une nouvelle version.
- RedHat GNU/Linux
Il peut y avoir plusieurs problèmes ennuyeux sur les systèmes RedHat.
Voici la marche à suivre sous peine de ne pouvoir utiliser Window Maker
sur ces systèmes :
* si la version de Window Maker livrée avec RedHat est installée,
désinstallez-la avant de mettre à jour votre système;
* assurez-vous que ni la variable d'environnement LANG ni LINGUAS ne
contiennent "en_RN";
* vérifiez que /usr/local/bin est présent dans votre variable d'environnement
PATH;
* il faut que /usr/local/lib soit dans /etc/ld.so.conf avant de lancer
ldconfig;
* si vous rencontrez des messages d'erreur en rapport avec "--no-reexec",
désinstallez libtool-1.2b et installez libtool-1.3.
libtool-1.3 peut être trouvé sur ftp.gnu.org.
Consultez aussi la section PROBLÈMES;
* si vous aviez auparavant installé le paquetage de Window Maker livré
avec RedHat et que vous voulez installer maintenant manuellement une nouvelle
version, vous devez au préalable désinstaller le paquetage provenant de la
RedHat;
* assurez-vous qu'il existe un lien symbolique de from /usr/include/X11 vers
/usr/X11R6/include/X11 (le cas échéant, lancez cette commande :
ln -s /usr/X11R6/include/X11 /usr/include/X11);
* assurez-vous que /lib/cpp pointe bien vers le programme cpp
Si vous avez un doute concernant quoi que ce soit de relatif à l'installation
de Window Maker sur une RedHat, n'hésitez pas à contacter le support
utilisateur de RedHat. Ils vous renseigneront toujours et tenteront de vous
dépanner dans l'utilisation et la configuration de votre système RedHat.
D'un autre côté, ils sont plus au fait que nous pour tout ce qui est relatif
aux RedHat (nous n'en utilisons pas).
- PowerPC MkLinux
Installez la version la plus récente de Xpmac. Les versions plus
anciennes semblent contenir un bogue qui est susceptible de bloquer
le système.
- Debian GNU/Linux
Si vous voulez bénéficier du support des fichier JPEG et TIFF,
assurez-vous que les paquetages libtiff-dev et libjpeg-dev sont installés.
- SuSE GNU/Linux
Désinstallez tout précédent paquetage de Window Maker avant d'installer
une nouvelle version. Le cas échéant, vous pourriez rencontrer des
problèmes.
- MetroX (version indéterminée)
MetroX contient un bogue qui corrompt les pixmaps utilisées en fond
de fenêtres. Si vous utilisez MetroX et rencontrer des problèmes
avec les textures, n'utilisez pas les textures dans les barres de titre,
ou bien utilisez un autre serveur X.
INSTALLATION
============
Compiler Window Maker
---------------------
Pour aller vite, tapez ce qui suit dans un prompt shell :
./configure
make
puis, loguez-vous en tant que root and tapez :
make install
ldconfig
ou, si vous voulez ôter les infos de débogage des exécutables et ainsi les
rendre plus petits, tapez plutôt :
make install-strip
ldconfig
Tout ceci compile et installe Window Maker avec les réglages par défaut.
Maintenant, si vous voulez personnaliser des options de compilation, vous
pouvez faire :
1. (optionnel) Consulter la section OPTIONS DE CONFIGURATION
dans ce même fichier. Exécutez aussi :
./configure --help
pour avoir la liste des autres options disponibles.
2. Lancez configure avec les options choisies. Par exemple, si vous voulez
utiliser l'option --enable-kde, tapez :
./configure --enable-kde
3. (optionnel) Éditez src/wconfig.h avec votre éditeur de texte favori et
et modifiez sont contenu à votre guise.
4. Compilez. Il faut juste taper :
make
5. Loguez-vous en tant que root (si vous ne pouvez pas le faire, lisez le
paragraphe "Je n'ai pas le mot de passe de root :-(") et installez
Window Maker sur votre système :
su root
make install
Réglages pour un utilisateur
----------------------------
Ces instructions suivantes ne sont pas nécessaires si vous mettez à jour
Window Maker à partir d'une version plus ancienne, à moins que ce soit
précisé dans le fichier NEWS.
Chaque utilisateur qui veut utiliser Window Maker sur votre système doit
faire ce qui suit :
1. Installer les fichiers de configuration de Window Maker dans son
répertoire personnel.
Pour ceci, il doit taper :
wmaker.inst
wmaker.inst installera les fichiers de configuration de Window Maker
pour l'utilisateur et configurera ses paramètres de X de façon à ce que
Window Maker soit automatiquement lancé au démarrage de X.
C'est tout!
Vous pouvez aussi taper "man wmaker" afin d'obtenir plus de renseignements
sur la configuration et d'autres sujets.
Consultez le Guide de l'utilisateur afin d'obtenir des informationss plus
en détail sur Window Maker.
Pourquoi ne pas aussi jeter un oeil aux FAQs..
Installation du paquetage additionnel
-------------------------------------
Décompressez WindowMaker-extra-<version-number>.tar.gz dans /usr/local/share
Vous trouverez le fichier sur ftp://ftp.windowmaker.org. Ce paquetage est optionnel,
il contient des icônes et des thèmes supplémentaires. Vérifiez que vous avez
bien la derniere version de ce paquetage.
Il y a aussi un fichier WindowMaker-extra.readme qui indique comment procéder à
l'installation de ce paquetage.
Je n'ai pas le mot de passe de root :-(
---------------------------------------
Si vous n'avez pas acc-s aux privilèges du super-utilisateur (root), vous pouvez
installer Window Maker dans votre répertoire personnel. Pour ce faire, ajoutez
l'option --prefix correctement renseignée au moment de l'exécution de ./configure
(étape 2 de la compilation de Window Maker).
Il est aussi nécessaire d'utiliser l'option --with-appspath, afin de préciser
le chemin d'accès à WPrefs.app. Par exemple :
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Applications
Puis, faites en sorte que /home/jshmoe/bin soit inclus dans votre PATH, ajoutez
/home/jshmoe/lib à votre variable d'environnement LD_LIBRARY_PATH puis lancez
bin/wmaker.inst
Bien sûr, /home/jshmoe est supposé être remplacé par votre répertoire personnel.
MISE À JOUR
===========
Si vous mettez à jour une version plus ancienne de Window Maker :
1. Configurez et compilez Window Maker comme d'habitude
2. Installez Window Maker (mais n'exécutez pas wmaker.inst)
3. Consultez le fichier NEWS et mettez à jour vos fichiers de configuration
si nécessaire.
PROBLÈMES
=========
Si vous rencontrez des problèmes pendant la phase de configuration, comme par
exemple l'impossibilité d'utiliser une librairie de manipulation de format
graphique alors que vous pensez qu'elle est installée, jetez un oeil au contenu
du fichier config.log, vous y trouverez peut-être des indices pour résoudre
ce problème.
== erreur de chargement de polices, alors qu'elles existent
Essayez de recompiler sans le support pour le NLS.
== erreur à la configuration
ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
Otez l'option --no-reexec du fichier aclocal.m4 et relancer la configuration.
Assurez vous aussi que les versions d'autoconf et d'automake correspondent bien
aux pré-requis :
autoconf 2.13
automake 1.4
libtool 1.3
Notez bien que ce ne doit PAS être libtool 1.2b, mais libtool bien 1.3,
disponible sur les sites GNU.
== configure ne trouve pas libtiff ou une autre librairie graphique
Effacez le fichier config.cache, et exécutez à nouveau configure avec les options
suivantes (en plus des options que vous utilisiez déjà) :
--with-libs-from="-L/usr/local/lib"
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
Insérez les chemins d'accès aux librairies graphiques et à leurs fichiers d'en-tête.
Plusieurs chemins d'accès peuvent être ajoutés pour chacune de ces options,
comme montré pour --with-incs-from. Séparez-les juste par un espace.
== configure ne trouve pas libXpm
* Vérifiez que vous avez un lien sympbolique de libXpm.so.4.9 vers libXpm.so
== segmentation fault au démarrage
* Vérifiez que la version de libXPM qui est installée est au moins 4.7.
* Vérifiez que votre fichier ~/GNUstep/Defaults/WindowMaker est à jour.
Si vous n'en êtes pas sûr, renommez ~/GNUstep en ~/GNUtmp et lancez wmaker.inst.
== "...: your machine is misconfigured. gethostname() returned (none)"
* Le nom d'hôte de votre machine n'est pas indiqué ou est invalide (il commence
par une parenthèse par exemple). Consultez les pages du manuel (man hostname) pour
savoir comment le positionner correctement.
== Le menu des applications ne contient que 2 entrées ("XTerm" et "Exit...")
* Window Maker ne trouve pas cpp (le preprocesseur de C). Si votre cpp n'est pas situé
dans /lib/cpp, editez src/config.h et modifiez le chemin d'accès dans CPP_PATH en conséquent.
== checking lex output file root... configure: error: cannot find output from true; giving up
* Consultez la section PRE-REQUIS dans ce même fichier.
LOCALES/INTERNATIONALISATION
============================
Window Maker supporte les langues étrangères. Pour activer cette fonctionalité,
vous devez compiler Window Maker avec des paramètres supplémentaires.
0 - GNU gettext doit être installé. Il peut être trouvé ici :
ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
Vous pouvez passer à l'étape 4 si vous utilisez le script Install.
1 - Il vous faut choisir les langues que vous voulez rendre disponible. Modifiez
pour cela la liste des codes de nationalité dans LINGUAS. L'anglais est inclus
de façon implicite dans cette liste. Par exemple :
setenv LINGUAS "pt ja de"
sous csh
ou
export LINGUAS;LINGUAS="pt ja de"
sous sh
La liste de tous les codes de nationalité peut être trouvée dans po/README.
L'anglais est la langue par défault.
Lisez po/README si vous souhaitez traduire ou maintenir les fichiers propres
à d'autres adaptations nationales.
2 - De plus, si votre langue utilise des caractères multi-octets, comme
le japonais ou le coréen, vous devez vous assurer que l'option MultiByteText est à YES
dans ~/GNUstep/Defaults/WMGLOBAL.
3 - Configurez, compilez et installez Window Maker normalement.
4 - Pour choisir une langue particulière à l'exécution, vous devez positionner la variable
d'environnement LANG avec la valeur correspondant au code de nationalité adéquat.
Par exemple, si vous voulez utiliser le portugais, vous devez faire :
setenv LANG pt
sous csh ou
export LANG; LANG=pt
sous Bourne sh et apparentés
Note : si la variable d'environnement LC_CTYPE est positionnée, vous devez l'ôter de
l'environnement (unset LC_CTYPE), avant d'exécuter Window Maker.
En ce qui concerne les fichiers de configuration des menus, Window Maker procède
à une recherche suivant cet ordre (pour le portugais brésilien, dans ce cas) :
menu.pt_BR
menu.pt
menu
5 - Si vous choisissez une langue qui utilise les caractères multi-octets, vous
devez configurer les polices de façon adéquate. Consultez pour cela les pages
de manuel de XCreateFontSet. Vous devez modifier dans votre fichier ~/G/D/WindowMaker
les polices utilisées dans les titres, menus et autres. En ce qui concerne les polices
utilisées dans les boîte de dialogue, modifiez ~/G/D/WMGLOBAL.
Le %d dans la définition des polices ne doit PAS être enlevé. Vous pouvez aussi utiliser
le script wsetfont, fourni à ces fins.
Consultez le script lui-même pour en connaître les instructions.
Par exemple, vous pouvez mettre ceci dans ~/G/D/WindowMaker :
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
et dans ~/G/D/WMGLOBAL :
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
Les 2 polices ci-dessus sont uniquement utilisées par les applications qui utilisent
WINGs (Window Maker et WPrefs.app).
Le script wsetfont inclus vous permettra de changer les réglages des polices de
façon plus aisée. Consultez-le afin d'obtenir plus d'informations.

View File

@@ -1,557 +0,0 @@
Instruções de Instalação do Window Maker
PLATAFORMAS SUPORTADAS
======================
(obs: fiquei sabendo que conseguiram compilar nesses sistemas...)
- Intel GNU/Linux Slackware 3.5 (plataforma primária)
- outras distribuições do Intel GNU/Linux
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 em MacOS
- Amiga 3000 rodando RedHat Linux 5.1 (Rawhide)
Patches que possibilitem a execução em outras plataformas serão bem-vindos.
Se a última versão não funcionou para você, tente a 0.53.0,
que é conhecida por ser bastante estável em várias plataformas.
REQUERIMENTOS
=============
Os softwares a seguir são necessários para o uso do Window Maker:
- X11R6.x
O Window Maker pode ser compilado em versões mais antigas do X, como X11R5
(Solaris) ou X11R4 (OpenWindows) mas não funcionará 100% corretamente. Em
tais servidores não existirão ícones de aplicações e você terá problemas
usando o dock. Fazer upgrades das bibliotecas (Xlib Xt etc) ajudará se você
não pode fazer upgrade do servidor.
Para compilar o Window Maker você precisará do seguinte:
- Requerimentos básicos e óbvios
Se você vai compilar o Window Maker, tenha certeza de que você possui o gcc
(ou outro compilador ANSI) e os arquivos headers do X. Especialmente para
os iniciantes em Linux: você deve instalar todos os pacotes de desenvolvimento
do X e a suite gcc. Do contrário você não será capaz de compilar nenhum
programa X, incluindo o Window Maker.
- libPropList
Você pode achar esta biblioteca em ftp://ftp.windowmaker.org/pub/libs ou
ftp://ftp.gnome.org/pub/libPropList. Você deve instalar corretamente
esta biblioteca antes de instalar o Window Maker.
- autoconf, automake and libtool
Estes pacotes não são necessários, mas se você tiver um ou mais deles instalados,
verifique se todos eles são das seguintes versões:
autoconf 2.54
automake 1.4
libtool 1.4.2
Se você possui uma versão diferente, desative-os mudando os nomes dos arquivos
para outra coisa ou removendo-os do seu sistema. Se você não desenvolve
software você não precisa deles, logo, você pode desinstalá-los com segurança.
- lex (ou flex) e yacc (ou bison)
São usados pelo libPropList. O lex não seria necessário, já que o seu
arquivo de saída é incluído, mas como ou eu ou o automake é um pouco
burro, o script de configuração para o libPropList simplesmente
abortará sem motivo caso o lex não seja achado.
OPCIONAL:
=========
Estas bibliotecas não são necessárias para que o Window Maker funcione, mas elas
são suportadas caso você deseje usá-las. Os números das versões são os que eu
possuo (e portanto quase certamente funcionarão), mas outras versões devem funcionar
também.
- libXPM 4.7 ou mais atual
Versões antigas podem não funcionar.
Disponível em ftp://sunsite.unc.edu/pub/Linux/libs/X/
Há suporte nativo para arquivos XPM, mas ele não carregará imagens em
algumas formatos incomuns.
- libpng 0.96 ou mais atual e zlib
Para suporte a imagens PNG.
- libtiff 3.4 ou mais atual
Para suporte a imagens TIFF. Você pode baixar o libtiff em
ftp://ftp.sgi.com/graphics/tiff.
- libjpeg 6.0.1 ou mais atual
Para suporte a imagens JPEG.
- libgif 2.2 ou libungif
Para suporte a imagens tipo GIF.
- GNU xgettext
Se você deseja usar mensagens traduzidas, será necessário o GNU gettext. Outras
versões do gettext não são compatíveis e não funcionarão. Baixe a versão
GNU através do site ftp://ftp.gnu.org
A maioria dos pacotes citados pode ser encontrado em ftp.uu.net/pub/graphics
OPÇÕES DE CONFIGURAÇÃO
======================
Estas opções podem ser passadas ao script de configuração para ativar/desativar algumas
opções do Window Maker. Exemplo:
./configure --enable-kde --enable-gnome
irá configurar o Window Maker para que seja compilado com suporte ao KDE e GNOME.
Para obter uma lista com outras opcoes, execute ./configure --help:
--with-libs-from
Especifica diretórios (paths) adicionais onde se deve achar as bibliotecas.
A flag -L deve preceder cada caminho, tal como:
--with-libs-from="-L/opt/libs -L/usr/local/lib"
--with-incs-from
Especifica diretórios adicionais para os arquivos de cabeçalho (header files)
que serão procurados. A flag -l deve preceder cada caminho descrito, tal como:
--with-incs-from="-I/opt/headers -I/usr/local/include"
--enable-single-icon
Permite o agrupamento de todas as aplicações com a mesma WM_CLASS+WM_INSTANCE em
uma só. Esta opção não é suportada por todos os desenvolvedores. Se você tiver algum
problema com essa opção, escreva para o seu autor: Christopher Seawood
<cls@seawood.org>
--disable-shm
Desativa o uso da extensão de memória compartilhada do MIT. Isto reduzirá
um pouco a geração de texturas, mas em alguns casos se mostrará necessário
em virtude de um bug que se manifesta quando manipulam-se ícones e texturas.
--disable-motif
Desativa compatibilidade com gerenciador de janelas mwm.
--enable-lite
Remove coisas que já são suportadas em ambientes desktops como o KDE
e o GNOME. As opções desativadas são: lista de janelas (window list), menu de
aplicações root (root applications menu), seleção múltipla de janelas
(multiple window selection). Note que não será mais possível sair do Window
Maker de dentro; você terá que usar o kill com o sinal SIGTERM ou sair do KDE.
Não é aconselhado ativar essa opção.
--enable-modelock
Suporte ao bloqueio de status de linguagem do XKB. Se você não sabe o que
é isto, você provavelmente não precisa.
--enable-sound
Ativa o suporte ao módulo de efeitos sonoros.
--disable-xpm
Desativa o uso da biblioteca XPM mesmo se esta estiver disponível no seu sistema.
--disable-png
Desativa o uso da biblioteca PNG
--disable-tiff
Desativa o uso da biblioteca TIFF
--disable-gif
Desativa o uso da biblioteca GIF
--disable-jpeg
Desativa o uso da biblioteca JPEG
--disable-shape
Desativa o uso das shaped windows (para oclock, xeyes etc.).
--enable-debug
Não use esta opção a não ser que saiba realmente o que está fazendo
NOTAS ESPECÍFICAS PARA AS PLATAFORMAS
=====================================
- máquinas DEC/Alpha
Você provavelmente precisará usar a flag --disable-shm para configurar,
como ./configure --disable-shm
- SCO Unix - execute o configure tal como
CFLAGS="-belf -DANSICPP" ./configure
- SunOS, Solaris
Se você possui o gcc instalado, execute o configure como abaixo:
CPP_PATH="gcc -E -x c" ./configure
O cpp da Sun não possui agumas funções necessárias ao Window Maker e pode
causar problemas quando analisados os arquivos de configuração.
Você pode ainda precisar usar --with-libs-from e --with-incs-from
para fornecer o diretório onde a libtiff está localizada.
Alguem me mandou um email dizendo que você precisará deixar o /usr/local/lib
como primeiro caminho (path) no LD_LIBRARY_PATH para que funcione.
Se você tem uma Ultra Creator 3D ou outra máquina com gráficos high-end,
certifique-se de iniciar o servidor X com o visual padrão definido em 24bpp
ou você poderá ter problemas com cores desfiguaradas. Isto é um bug do
wmaker e será consertado.
- GNU/Linux em geral
Confira se você possui /etc/local/lib no /etc/ld.so.conf e rode ldconfig
após a instalação.
Remova qualquer versão em pacote do Window Maker antes de instalar uma versão
mais atual.
- RedHat GNU/Linux
Os sistemas RedHat apresentam vários incômodos. Se você usa, certifique-se
de seguir os passos abaixo ou o Window Maker não funcionará:
* se você instalou o Window Maker que vem junto com o Red Hat, desinstale-o
antes de instalar uma versão mais atual.
* certifique-se de que você não possui as variáveis de ambiente LANG e LINGUAS
configuradas como en_RN;
* certifique-se de que você possui /usr/local/bin na variável PATH;
* certifique-se de que você tem /usr/local/lib no /etc/ld.conf.so antes de
executar o ldconfig;
* se você tiver problemas que mencionem uma mensagem de erro com o
--no-reexec, remova a libtool-1.2b e instale a libtool-1.3. A libtool-1.3
pode ser encontrada em ftp.gnu.org. Também leia a seção TROUBLESHOOTING;
* se você instalou o pacote Window Maker do RedHat e está instalando uma
nova versão na mão (você mesmo está compilando), remova o pacote Window
Maker do seu sistema RedHat antes.
* certifique-se de que você possua o vínculo simbólico do /usr/include/X11
ao /usr/X11R6/include/X11 (se não, digite ln -s /usr/X11R6/include/X11
/usr/include/X11)
* certifique-se de que você tem o /lib/cpp apontando para o programa cpp.
Se você possui alguma dúvida quanto a realizar qualquer uma das tarefas acima,
por favor não hesite em contatar o suporte ao usuário RedHat. Eles gentilmente
irão responder a todas as suas dúvidas relacionadas ao sistema. Eles sabem
muito mais sobre o sistema deles do que nós (nós não usamos RedHat).
- PowerPC MkLinux
Você terá que possuir a última versão do Xpmac. Versões mais antigas
parecem ter bugs que fazem com que o sistema trave.
- Debian GNU/Linux
Se você deseja suporte a JPEG e TIFF, certifique-se que no seu sistema estão
instaladas as bibliotecas libtiff-dev e libjpeg-dev.
- SuSE GNU/Linux
Se você instalou o pacote Window Maker do SuSE, certifique-se de
removê-lo do seu sistema antes de compilar o wmaker ou você poderá
ter problemas.
- MetroX (versão desconhecida)
O MetroX possui uma falha que corrompe os pixmaps que são definidos
como backgrounds de janelas. Se você usa MetroX e está tendo problemas
estranhos com texturas, não use texturas nas titlebars. Ou use
um servidor X diferente.
INSTALAÇÃO:
===========
Desempacote o WindowMaker-extra-<numero-da-versao>.tar.gz no /usr/local/share.
Você pode pegar o arquivo no site ftp://ftp.windowmaker.org. Este arquivo
é opcional e possui alguns ícones e temas. Procure pelo último <número-da-versão>
disponível.
Ainda há o WindowMaker-extra.readme para instruí-lo sobre onde o pacote deve ir.
Compilando o Window Maker
-------------------------
Se você quer fazer de modo rápido e simples, digite o seguinte no seu prompt:
./configure
make
depois entre como root e digite:
make install
ldconfig
ou se você quiser remover os símbolos de depuração dos seus binários para
que eles se tornem menores, você pode digitar:
make install-strip
ldconfig
Estes comandos irão compilar e instalar o Window Maker com parâmetros padrões.
Se você deseja configurar algumas opções de compilação, você pode fazer o seguinte:
1.(opcional) Olhe na seção OPÇÕES DE CONFIGURAÇÃO acima para ver as
opções disponíveis. Execute também:
./configure --help
para obter uma lista completa das outras opções.
2. Rode o configure com as opções que você deseja. Por exemplo, se
deseja usar a opção --enable-kde, você deve digitar:
./configure --enable-kde
3. (opcional) Edite o arquivo src/wconfig.h com seu editor de texto
preferido e procure por alguma opção que deseja mudar
4. Compile. Só digite:
make
5. Entre como root (se você não pode fazer isso, leia a seção "Eu não tenho a
senha de root") e instale o Window Maker no seu sistema:
su root
make install
Configurações Específicas
-------------------------
Estas instruções não precisam ser seguidas quando for feito o upgrade do
Window Maker em cima de uma versão antiga, a menos que o arquivo NEWS diga
algo diferente.
Todo usuário no seu sistema que desejar rodar o Window Maker deverá fazer o seguinte:
1. Instalar os arquivos de configuração do Window Maker no diretório home.
Digite:
wmaker.inst
wmaker.inst vai instalar os arquivos de configuração do Window Maker e fazer
com que o X rode o Window Maker quando executado.
É isso!
Você pode digitar "man wmaker" para ver uma ajuda geral sobre configuração
e outras coisas.
Leia o Manual do Usuário para explicações mais profundas sobre o Window Maker.
Você deve dar uma olhada no FAQ também.
Eu não tenho a senha de root
----------------------------
Se você não pode obter privilégios de super-usuário (não pode ser root) você
pode instalar o wmaker no seu diretório home. Para isso, forneça a opção
--prefix quando for rodar o configure, como explicado no passo 2 da seção
Compilando o Window Maker.
Você ainda precisará fornecer a opção --with-appspath, para especificar o
caminho do WPrefs.app. Exemplo:
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Applications
Depois faça com que /home/jshome/bin seja incluído na variável PATH, adicione
/home/jshome/lib na variável de ambiente LD_LIBRARY_PATH e rode bin/wmaker.inst
É claro, substitua /home/jshome com o seu diretório home.
UPGRADE
=======
Se você está fazendo um upgrade de uma versão antiga do Window maker:
1. Configure e compile o Window Maker como sempre
2. Instale o Window Maker (mas não rode o wmaker.inst)
3. Leia o arquivo NEWS e atualize seus arquivos de configuração,
se necessário.
TROUBLESHOOTING
===============
Quando você tiver problemas na configuração (enquanto roda o configure),
tal como não conseguir usar uma biblioteca de gráficos que você acha que tem
instalada, olhe no arquivo config.log para obter dicas sobre o que pode estar
errado.
== Erro ao carregar as fontes, mesmo quando elas existem
Tente reconstruir sem suporte NLS.
== Erro ao configurar
ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
remova a opção --no-reexec do aclocal.m4 e da libPropList/aclocal.m4
e reconfigure.
Também verifique se as versões do autoconf e do automake que você tem
instaladas são:
autoconf 2.13
automake 1.4
libtool 1.3
Note que não deve ser libtool 1.2b, deve ser libtool 1.3.
== Não acha a proplist.h ou libPropList.algumacoisa
Baixe e instale a libPropList dos sites já citados neste arquivo.
== o configure não detecta a libtiff, ou outras bibliotecas gráficas.
Delete o config.cache, depois rode de novo o configure adicionando as
seguintes opções ao configure (e as outras opções que você usa):
--with-libs-from="-L/usr/local/lib"
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
Substitua o caminho para onde estão localizadas as suas bibliotecas gráficas
e os correspondentes arquivos de cabeçalho. Você pode colocar caminhos múltiplos
em qualquer uma dessas opções, como no exemplo do --with-incs-from. Só ponha um
espaço entre eles.
== o configure não detecta libXpm.
* Confira se você possui um vínculo simbólico da libXpm.so.4.9 para libXpm.so
== Segmentation fault na inicialização
* Confira se a versão da libXPM é a 4.7 ou mais atual
* Confira se você tem uma versão atualizada do ~/GNUstep/Defaults/WindowMaker
Se você não tem certeza, tente renomear ~/GNUstep para ~/GNUtmp e depois rode
o wmaker.inst
== "...: your machine is misconfigured. gethostname() returned (none)"
* o hostname da sua máquina está definido incorretamente. Execute um man hostname
para obter informações de como resolver isto.
== O menu do root possui só 2 entradas. ("XTerm" e "Exit...")
* O Window Maker não está achando o cpp (o pré-processador C). Se o seu cpp
não está localizado em /lib/cpp, edite src/config.h e corrija o caminho
no CPP_PATH.
== checking lex output file root... configure: error: cannot find output from
true; giving up
* Leia a seção REQUERIMENTOS deste arquivo.
LOCALES/INTERNACIONALIZAÇÃO
===========================
o Window Maker tem suporte a linguagem nacional. Para ativar esse suporte,
você precisa compilar o Window Maker com parâmetros adicionais.
0 - Você deve Ter o pacote do GNU gettext instalado. Este pode ser obtido
pelo ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
Os passos 1,2 e 3 podem ser pulados se você usa o script Install.
1 - Você deve selecionar as linguagens que deseja suportar. Defina a LINGUAS
para a lista dos locales que você deseja. O Inglês é sempre suportado. Exemplo:
setenv LINGUAS "pt ja de"
na csh
ou
export LINGUAS;LINGUAS="pt ja de"
na sh
A lista dos locales suportados pode ser achado no arquivo po/README.
O inglês é a língua oficial.
Leia o arquivo po/README se você deseja traduzir e manter os arquivos
locales para outras linguagens.
2 - Adicionalmente, se a sua linguagem usa caracteres multi-bytes, tais
como as línguas japonesas e koreanas, você deve definir a opção MultiByteText
para YES nos arquivos ~/GNUstep/Defaults/WMGLOBAL e ~/GNUstep/Defaults/WindowMaker
3 - Configure, compile e instale o Window Maker normalmente.
4 - Para selecionar um locale particular você deve definir a variável de
ambiente LANG para o locale que você quer. Por exemplo, se você quer definir o
locale português, você deve rodar
setenv LANG pt
na csh ou
export LANG; LANG=pt
nas Bourne sh e similares
Nota: Se você tem a variável de ambiente LC_CTYPE definida, você deve
indefiní-la antes de rodar o wmaker.
O Window Maker procura os arquivos de definições de menu na seguinte
ordem (para o português brasileiro, neste caso):
menu.pt_BR
menu.pt
menu
5 - Se você escolheu uma linguagem que usa caracteres multi-bytes, você
deve configurar as fontes adequadamente. Leia a página de manual para o
XcreateFontSet para obter mais detalhes sobre isto. Você deve mudar o arquivo
~/G/D/WindowMaker para as fontes usadas nas barras de título, menus e
outras coisas. Para as fontes usadas nas janelas de diálogo, mude o arquivo
~/G/D/WMGLOBAL. O %d no font names não deve ser removido. Você pode ainda usar
o wsetfont script para esta tarefa. Leia o próprio script para maiores instruções.
Por exemplo, você pode especificar o seguinte no ~/G/D/WindowMaker:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
e no ~/G/D/WMGLOBAL:
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
As duas fontes acima são usadas somente por aplicações que
usem WINGs (o Window Maker e WPrefs.app)
O script wsetfont que é fornecido vai permitir com que você mude as
definições de fonte do modo mais fácil. Dê uma olhada no script para maiores
detalhes sobre o uso.
Traduzido por Ricardo Sartori <sartori@inf.ufsc.br>

View File

@@ -1,601 +0,0 @@
In¹trukcie pre in¹taláciu Window Makera
PODPOROVANÉ PLATFORMY
=====================
(tzn: vraj to na tom niekto skompiloval...)
- Intel GNU/Linux Conectiva 5.9 (beta)
- Intel GNU/Linux Slackware
- Intel GNU/Linux Debian
- Intel GNU/Linux other distributions
- Sparc GNU/Linux RedHat 5.1
- PowerPC GNU/MkLinux
- Alpha GNU/Linux RedHat 5.1
- FreeBSD
- NetBSD
- OpenBSD
- BSDI 4.0
- Solaris 2.5.1, 2.5.2
- Solaris 2.6.0
- Solaris 2.7beta
- SCO Unix
- SGI Irix 5.x, 6.5
- OSF/1
- HP-UX
- AIX 3.2.5
- AIX 4.1.4 / IBM PowerPC
- AIX 4.3.1 / IBM CC compiler
- AIX 4.3.2 / IBM PowerPC
- AIX 5.3
- DEC Alpha/Digital UNIX 4.x
- XFree86 / OS/2
- Corel NetWinder
- SunOS 4.x
- PowerMac / Power MachTen 4.1.1 over MacOS
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
- IBM S/390 running Linux
- iBook running Darwin
Patche na rozbehanie na iných platformách sú vítané.
PO®IADAVKY:
===========
Nasledovný softvér je potrebný pre beh Window Makera:
- X11R6.x
Window Maker mô¾e by» skompilovaný na star¹ích verziách X, ako
X11R5 (Solaris) alebo X11R4 (OpenWindows) ale nebude pracova»
100% korektne. Na takých serveroch nebudú ikony aplikácií a budete
ma» problémy s pou¾ívaním doku. Upgrade klientských kni¾níc (Xlib,
Xt, atï.) pomô¾e, ak u¾ nemô¾ete spravi» upgrade servera.
Nasledovné je potrebné k skompilovaniu Window Makera:
- Základné be¾né veci
Ak chcete kompilova» Window Maker, uistite sa, ¾e máte gcc (alebo
iný ANSI C kompilátor) a hlavièkové súbory iXov. Hlavne pre zaèia-
toèníkov v Linuxe: musíte nain¹talova» v¹etky X-devel balíky a gcc.
Inak nebudete schopní skompilova» ¾iadny program pre X, teda ani
Window Maker.
- libPropList
Túto kni¾nicu mo¾no nájs» na ftp://ftp.windowmaker.org/pub/libs alebo
ftp://ftp.gnome.org/pub/libPropList. Nain¹talujte ju pred kompiláciou
Window Makera.
- autoconf, automake a libtool
Tieto nástroje NIE sú potrebné, ale ak máte niektoré z nich nain¹talo-
vané, uistite sa, ¾e V©ETKY sú presne nasledovné verzie:
autoconf 2.54
automake 1.4
libtool 1.4.2
Ak máte odli¹né verzie, odin¹talujte ich alebo ich doèasne premenujte.
Ak neprogramujete, nebudete ich potrebova» a teda ich mô¾ete
odin¹talova».
- lex (alebo flex) a yacc (alebo bison)
Tieto sú vyu¾ívané z libPropList. Lex v skutoènosti nie je nutný,
lebo jeho výstupný súbor je prítomný, ale buï ja alebo automake je
hlupák, lebo configuraèný skript pre libPropList sa jednoducho
ukonèí z neznámych dôvodov ak lex nie je prítomný.
NEPOVINNÉ:
==========
Tieto kni¾nice nie sú nutné pre beh Window Makera, ale sú podporované
v prípade, ¾e ich chcete pou¾íva». Èísla verzií sú tie, ktoré som pou¾il
ja (teda urèite fungujú), ale aj iné verzie mô¾u pracova» správne.
- libXPM 4.7 alebo nov¹ia
Star¹ie verzie nemusia fungova»!!!
Dostupné na ftp://sunsite.unc.edu/pub/Linux/libs/X/
Podpora XPM je aj vstavaná, ale nenaèíta obrázky v
ne¹tandardných kódovaniach.
- libpng 0.96 alebo nov¹ia a zlib
Pre podporu obrázkov PNG.
http://www.cdrom.com/pub/png/
- libtiff 3.4 alebo nov¹ia
Pre podporu obrázkov TIFF.
ftp://ftp.sgi.com/graphics/tiff
- libjpeg 6.0.1 alebo nov¹ia
Pre podporu obrázkov JPEG.
http://www.ijg.org/
- libgif 2.2 alebo libungif
Pre podporu obrázkov GIF.
ftp://prtr-13.ucsc.edu/pub/libungif/
- GNU xgettext
Ak chcete pou¾íva» prelo¾ené hlásenia, potrebujete GNU gettext.
Iné verzie gettext nie sú kompatibilné a nebudú fungova».
Stiahnite si GNU verziu z ftp://ftp.gnu.org
MO®NOSTI CONFIGURE:
===================
Tieto mo¾nosti mô¾u by» dané skriptu configure ako argumenty za úèelom
povolenia/zakázania urèitých vlastností Window Makera. Príklad:
./configure --enable-kde --enable-gnome
nakonfiguruje Window Maker s podporou KDE a GNOME.
Zoznam v¹etkých mo¾ností vypí¹e príkaz ./configure --help
--with-libs-from
cesty, kde sa majú hµada» kni¾nice. Re»azec -L musí predchádza»
ka¾dú cestu, napr.:
--with-libs-from="-L/opt/libs -L/usr/local/lib"
--with-incs-from
cesty, kde sa majú hµada» hlavièkové súbory. Re»azec -I musí
predchádza» ka¾dú cestu, napr.:
--with-incs-from="-I/opt/headers -I/usr/local/include"
--enable-single-icon
umo¾òuje zrolovanie v¹etký ikon aplikácií WM_CLASS+WM_INSTANCE do
jedinej. Táto vlastnos» nie je podporovaná zo strany vývojárov.
V prípade problémov s òou, kontaktujte autora:
Christopher Seawood <cls@seawood.org>
--disable-shm
zaká¾e pou¾itie roz¹írenia zdieµanej pamäte MIT. Toto trochu spomalí
generovanie textúr, ale v niektorých prípadoch je táto voµba potrebná
kvôli chybe, ktorá spôsobuje nesprávne zobrazovanie ikon a textúr.
--disable-motif
zaká¾e podporu pre pokyny mana¾éra okien wmw
--enable-lite
odstráni veci, ktoré sa u¾ nachádzajú v desktopových prostrediach
ako KDE a GNOME. Odstránené veci sú: zoznam okien, menu aplikácií,
výber viacerých okien. Vedzte, ¾e u¾ nebudete schopní ukonèi»
Window Maker; budete ho musie» zabi» pou¾itím signálu SIGTERM alebo
ho ukonèi» z KDE. Neodporúèa sa povoli» túto vlastnos».
--enable-modelock
podpora pre XKB nastavenie jazyka. Ak neviete, èo to je, pravdepo-
dobne to nepotrebujete. (Slú¾i to na prepínanie rozlo¾enia kláves
pomocou nového tlaèidla na hornom paneli okien.)
--enable-sound
povolí podporu pre modul zvukových efektov
--disable-xpm
zaká¾e podporu pre kni¾nicu XPM aj keï je dostupná na va¹om systéme.
--disable-png
zaká¾e pou¾itie kni¾nice PNG
--disable-tiff
zaká¾e pou¾itie kni¾nice TIFF
--disable-gif
zaká¾e pou¾itie kni¾nice GIF
--disable-jpeg
zaká¾e pou¾itie kni¾nice JPEG
--disable-shape
zaká¾e tvarované okná (pre oclock, xeyes atï.)
POZNÁMKY PRE ©PECIFICKÉ PLATFORMY:
==================================
- DEC/Alpha
Nasledovný mail nie je prelo¾ený, ale hovorí sa v òom, ¾e
_pravdepodobne_ nie je nutné konfigurova» Window Maker na
Alphe s voµbou --disable-shm.
#>>>>>>>>>>>
From: Anton Ivanov <aivanov@eu.level3.net>
To: Marcelo E. Magallon <mmagallo@debian.org>
Subject: Re: Is the WindowMaker package working ok on Alpha?
> Hi,
>
> I was reading some docs on the WindowMaker tarball, and found this:
>
> | - DEC/Alpha machines
> | You might need to pass the --disable-shm flag to configure,
> | like ./configure --disable-shm
>
> is anyone having problems with WindowMaker on Alpha? Can someone
> please test this? Should the flag be passed when building on Alpha?
Disclaimer: alphas under my command have never run X and are least likely to
suddenly start running it anytime soon.
Alpha used to have some ridiculously low amount of shared memory
configured.
So quite a lot of apps used to barf. Namely - cdrecord, mysql server, etc.
Check where is yours at the moment and raise it to a more appropriate
value by either catting to the appropriate /proc entry or changing the
/usr/src/linux/include/asm/shmparam.h.
Otherwise the shared memory on alpha should be fully functional and I
see no reason to disable it. Mine are bumped up to 32 or more on most
machines.
And If I recall correctly the comments in that file are actually
wrong. Value is not bytes, but in machine size word. For alpha *8.
As I said - I do not run X on them so all #include "stdisclaimer.h"
apply.
#<<<<<<<<<<<<
- SCO Unix - spustite configure takto
CFLAGS="-belf -DANSICPP" ./configure
- SunOS, Solaris
Ak máte nain¹alované gcc, spustite configure takto:
CPP_PATH="gcc -E -x c" ./configure
Cpp od Sunu chýbajú niektoré vlastnosti, ktoré Window Maker potrebuje,
a to mô¾e spôsobi» problémy pri parsovaní konfiguraèných súborov.
Je tie¾ mo¾né, ¾e budete musie» pou¾i» --with-libs-from a
--with-incs-from na urèenie ciest k libtiff.
Niekto mi mailoval, ¾e tie¾ /usr/local/lib musí by» prvá cesta v
premennej LD_LIBRARY_PATH, aby to fungovalo.
Ak máte Ultra Creator 3D alebo iný stroj s high-end grafikou,
uistite sa, ¾e spú¹»ate iXy s 24-bitovou farebnou håbkou alebo
mô¾ete ma» problémy s pomie¹anými farbami. Toto je chyba wmakera
a bude opravená.
- GNU/Linux vo v¹eobecnosti
Uistite sa, ¾e máte /usr/local/lib v /etc/ld.so.conf a ¾e ste
po in¹talácii spustili ldconfig.
Odin¹talujte v¹etky balíkované verzie Window Makera pred in¹talovaním
novej verzie.
- RedHat GNU/Linux
Systémy RedHat majú niekoµko nepríjemných problémov. Ak ich pou¾ívate,
dodr¾ujte nasledovné kroky, alebo vám Window Maker nebude fungova»:
* ak máte nain¹alovaný Window Maker, ktorý je dodaný s RedHatom,
pred upgadom ho odin¹talujte;
* uistite sa, ¾e nemáte premenné LANG a LINGUAS nastavené na en_RN;
* uistite sa, ¾e máte /usr/local/bin v premennej PATH;
* uistite sa, ¾e máte /usr/local/lib v /etc/ld.so.conf pred
spustením ldconfig;
* ak máte problémy, v ktorých sa spomína chyba s --no-reexec,
odin¹talujte libtool-1.2b a nain¹talujte libtool-1.3. libtool-1.3
nájdete na ftp.gnu.org. Tie¾ si preèítajte èas» RIE©ENIE PROBLÉMOV.
* uistite sa, ¾e máte symbolický odkaz z /usr/include/X11 na
/usr/X11R6/include/X11 (ak nie, zadajte ln -s /usr/X11R6/include/X11
/usr/include/X11 )
* uistite sa, ¾e /lib/cpp odkazuje na program cpp
Ak máte akékoµvek pochybnosti, prosím, neotáµajte a spojte sa
s u¾ívateµskou podporou RedHatu. Radi vám odpovedia na v¹etky
va¹e otázky týkajúce sa ich systému. Vedia toho o svojom
systéme viac ako my (nepou¾ívame RedHat).
- PowerPC MkLinux
Musíte ma» poslednú verziu Xpmac. Star¹ie verzie majú asi chyby,
ktoré spôsobujú zmrznutie celého systému.
- Debian GNU/Linux
Ak chcete podporu JPEG a TIFF, uistite sa, ¾e máte nain¹talované
libiff-dev a libjpeg-dev.
- SuSE GNU/Linux
Ak ste si nain¹talovali balík Window Makera od SuSE, odin¹talujte
ho pred pokusmi o skompilovanie wmakera, alebo mô¾ete ma» problémy.
- MetroX (neznáma verzia)
MetroX má chybu, ktorá kazí obrázky, ktoré sú nastavené ako pozadie
okien. Ak pou¾ívate MetroX a máte èudné problémy s textúrami,
nepou¾ívajte textúry v horných li¹tách. Alebo pou¾ite iný X server.
IN©TALÁCIA:
===========
Kompilácia Window Makera
------------------------
Pre rýchly ¹tart, zadajte nasledovné príkazy v shelly:
./configure
make
potom sa prihláste ako root a zadajte:
make install
ldconfig
alebo ak chcete z binárnych súborov odstráni» symboly pre debugger a urobi»
ich men¹ie, napí¹te miesto toho
make install-strip
ldconfig
Toto skompiluje a nain¹taluje Window Maker so ¹tandardnými parametrami.
Ak si chcete prispôsobi» nastavenia kompilácie, mo¾ete to urobi» nasledovne:
1. (voliteµne) Pozrite sa na èas» MO®NOSTI CONFIGURE, kde sú
uvedené mo¾nosti. Tie¾ spustite:
./configure --help
ktorý vám vypí¹e kompletný zoznam ostatných mo¾ných nastavení.
2. Spustite configure s nastaveniami, ktoré chcete. Napríklad,
ak chcete pou¾íva» podporu pre KDE, zadajte:
./configure --enable-kde
3. (voliteµne) Otvorte si súbor src/wconfig.h vo svojom obµúbenom
textovom editore a prejdite si ho, èi nenájdete nejaké nastavenia,
ktoré chcete zmeni».
4. Kompilácia. Zadajte len:
make
5. Prihláste sa ako root (ak to nie je mo¾né, èítajte èas» "Nemám
rootove heslo :-( ") a nain¹talujte Window Maker:
su root
make install
Nastavenia ¹pecifické pre u¾ívateµov
------------------------------------
Nemusíte sa dr¾a» týchto in¹trukcií, ak robíte upgrade Window Makera zo
star¹ej verzie, pokiaµ to nie je uvedené v súbore NEWS.
Ka¾dý u¾ívateµ na va¹om systéme, ktorý chce pou¾íva» Window Maker, musí
urobi» nasledovné:
1. Nain¹talova» konfiguraèné súbory Window Makera do svojho
domovského adresára:
wmaker.inst
wmaker.inst nain¹taluje konfiguraèné súbory Window Makera a nastaví
iXy aby sa pri ¹tarte automaticky spustil Window Maker.
To je v¹etko!
Základné informácie o konfigurácii a iných veciach vám poskytne
"man wmaker".
Pre hlb¹í úvod do Window Makera si preèítajte si U¾ívateµký manuál.
Tie¾ sa mô¾te pozrie» na FAQ.
Installing the extras package
-----------------------------
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
You can get the file at ftp://ftp.windowmaker.org. This file is optional
and only have a few icons, and themes. Look for the latest <version-number>
available.
Also there is a WindowMaker-extra.readme to instruct you where that package
should go.
Nemám rootove heslo :(
----------------------
Ak nemáte práva roota, mô¾ete si nain¹talova» Window Maker do svojho
domovského adresára. Na to musíte pou¾i» voµbu --prefix pre configure
v druhom kroku kompilácie Window Makera. Tie¾ musíte pou¾i» voµbu
--with-appspath, pomocou ktorej ¹pecifikujete cestu pre WPrefs.app.
Príklad:
./configure --prefix=/home/jshome --with-appspath=/home/jshome/GNUstep/Applications
Poto pridajte adresár /home/jshome/bin do premennej PATH, /home/jshome/lib
do premennej LD_LIBRARY_PATH a spustite bin/wmaker.inst
Samozrejme, predpokladá sa, ¾e /home/jshome nahradíte va¹im skutoèným
domovským adresárom.
UPGRADE
=======
Ak robíte upgrade zo star¹ej verzie Window Makera:
1. Skofigurujte a skompilujte Window Maker ako v¾dy
2. Nain¹talujte Window Maker (ale nespustite wmaker.inst)
3. Preèítajte si súbor NEWS a ak je to potrebné, upravte
svoje konfiguraèné súbory.
RIE©ENIA PROBLÉMOV
==================
Ak máte problémy poèas konfigurácie (spú¹»ania configure), napríklad
nemo¾nos» pou¾i» grafickú kni¾nicu, o ktorej viete, ¾e ju máte nain¹talovanú,
v súbore config.log nájdete príèinu problému.
== Error with loading fonts, even if they exist.
Skúste kompiláciu bez podpory NLS.
== Error when configuring
ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
Odstáòte voµbu --no-reexec zo súborov aclocal.m4 a libPropList/aclocal.m4
a spustite configure.
Tie¾ sa uistite, ¾e autoconf a automake, ktoré máte nain¹talované, sú v
týchto verziách:
autoconf 2.13
automake 1.4
libtool 1.3
Nesmie to by» libtool 1.2b, ale libtool 1.3, zo stránok GNU.
== Cant find proplist.h or libPropList.something
Stiahnite a nain¹talujte si libPropList zo stránok uvedených
niekde v tomto súbore.
== configure doesn't detect libtiff, or other graphic libraries.
Odstráòte config.cache, spustite configure s pridanými nasledovnými voµbami
(okrem iných, ktoré pou¾ívate):
--with-libs-from="-L/usr/local/lib"
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
Vlo¾te cesty k va¹im grafickým kni¾niciam a zodpovedajúcim hlavièkovým
súborom. Mô¾ete vlo¾i» viac ciest do ka¾dej z týchto volieb, ako je to
uvedené v príklade --with-incs-from. Len ich oddeµte medzerou.
== configure doesn't detect libXpm.
* Skontrolujte, èi máte symbolický odkaz z libXpm.so.4.9 na libXpm.so
== Segmentation fault on startup
* Skontrolujte verziu libXpm, musíte ma» aspoò 4.7
* Skontrolujte, èi máte upravenú verziu ~/GNUstep/Defaults/WindowMaker
Ak si nie ste istí, skúste premenova» ~/GNUstep na ~/GNUtmp a spustite
wmaker.inst
== "...: your machine is misconfigured. gethostname() returned (none)"
* Meno va¹eho poèítaèa je nastavené na nieèo nesprávne, èo zaèína
úvodzovkami. Preèítajte si man hostname a dozviete sa, ako to nastavi».
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker nevie nájs» cpp (C preprocesor). Ak sa vá¹ cpp nenachádza
v /lib/cpp, upravte src/config.h a vlo¾te správnu cestu do CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up
* Preèítajte si èas» PO®IADAVKY v tomto súbore.
MIESTNE NASTAVENIA/INTERNACIONALIZÁCIA
======================================
Window Maker má podporu pre národné jazyky. Aby ste ju povolili, musíte
skompilova» Window Maker s niekoµkými prídavnými parametrami.
0 - Musíte ma» nain¹talovaný balík GNU gettext. Mô¾ete ho nájs» na
adrese ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
Kroky 1 a¾ 3 mô¾ete vynecha», ak pou¾ívate skript Install
1 - Musíte urèi» jazyky, pre ktoré chcete podporu. Nastavte premennú
LINGUAS na zoznam miestnych nastavení, ktoré chcete. Angliètina je
podporovaná v¾dy. Príklad:
setenv LINGUAS "pt ja de"
(csh)
alebo
export LINGUAS;LINGUAS="pt ja de"
(sh)
Zoznam podporovaných miestnych nastavení nájdete v súbore po/README.
Angliètina je implicitným jazykom.
Ak chcete preklada» a udr¾iava» súbory s miestnymi nastaveniami, preèítajte
si súbor po/README.
2 - Naviac, ak vá¹ jazyk pou¾íva multi-byte znaky, napríklad Japonèina
alebo Kórejèina, musíte nastaveniu MultiByteText priradi» YES v súbore
~/GNUstep/Defaults/WMGLOBAL
3 - Konfigurujte, kompilujte a in¹talujte Window Maker ako zvyèajne.
4 - Urèité miesne nastavenia si zvolíte nastavením premennej LANG na
to, ktoré chcete. Napríklad, ak chcete nastavi» slovenské miestne
nastavenia, musíte spusti»
setenv LANG pt
(csh)
export LANG; LANG=pt
(Bourne sh a podobné)
Pozor: Ak máte nastavenú premennú LC_CTYPE, musíte ju zru¹i» pred
spustením wmaker.
Window Maker hµadá súbory s definíciou menu v nasledovnom poradí
(v tomto prípade pre brazílsku portugalèinu):
menu.pt_BR
menu.pt
menu
5 - Ak si zvolíte jazyk, ktorý pou¾íva multi-byte znaky, musíte poriadne
nastavi» svoje fonty. Preèítajte si manuálovú stránku k XCreateFontSet,
kde nájdete viac detailov. Musíte v súbore ~/G/D/WindowMaker upravi» fonty
pre horné li¹ty, menu a iné veci. Pre fonty pou¾ité v dialógových oknách
upravte súbor ~/G/D/WMGLOBAL. Re»azce %d v menách fontov nesmú by»
odstránené. Tie¾ mô¾ete pou¾i» skript wsetfont, ktorý to urobí za vás.
Napríklad mô¾e zada» v súbore ~/G/D/WindowMaker nasledovné:
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
a v ~/G/D/WMGLOBAL:
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
Tieto dva fonty sa pou¾ijú len v aplikáciách, ktoré pou¾ívajú WINGs
(Window Maker a WPrefs.app)
Skript wsetfont vám umo¾ní nastavi» fonty jednoduch¹ím spôsobom. Pozrite
sa priamo do jeho súboru pre bli¾¹ie informácie.

90
MIRRORS
View File

@@ -1,90 +0,0 @@
Window Maker FTP Mirror Sites
=======-=====================
Official Site (USA):
--------------------
ftp://ftp.windowmaker.org/
Australia:
----------
ftp://ftp.goldweb.com.au/pub/WindowMaker/
Contact: Matthew Hawkins <matt@goldweb.com.au>
France:
-------
ftp://ftp.ensm-ales.fr/pub/mirrors/ftp.windowmaker.org
Contact: Laurent PELLISSIER <Laurent.Pellissier@ensm-ales.fr>
Germany:
--------
ftp://ftp.freenews.de/pub/windowmaker/
Contact: Jonas Luster <jonas@cabal.arnooo.de>
United States of America:
-------------------------
ftp://ftp.io.com/pub/mirror/windowmaker/
Contact: Bobby <bobby@mezaway.org>
http://jgo.local.net/cool_downloads/wm/
Contact: Joshua Go <joshuago@usa.net>
ftp://ftp.cybertrails.com/pub/windowmaker/
Contact: Adam Jacob <adam@cybertrails.com>
Provider: Ameth Technologies
http://www.ameth.org/windowmaker/
ftp://ftp.ameth.org/pub/mirrors/ftp.windowmaker.org/
Contact: Chase Phillips <shepard@ameth.org>
Third Party Window Maker Distribution Packages
==============================================
Debian GNU/Linux (deb)
----------------------
Contact: Marcelo Magallon <mmagallo@efis.ucr.ac.cr>
Sites:
http://master.debian.org/~mmagallo/packages/wmaker/
RedHat GNU/Linux (RPM)
----------------------
For Intel:
Contact: Jim Knoble <jmknoble@pobox.com>
Sites:
ftp://ftp.windowmaker.org/pub/beta/compiled/linux/rpms/
ftp://ftp.redhat.com/pub/contrib/SRPMS/
ftp://ftp.redhat.com/pub/contrib/i386/
For Alpha:
Contact: Peter Petrakis <peterpan@wn.net>
Site:
http://math.stcc.mass.edu/petrakis/downloads/X11
HP-UX
-----
Sites:
UK: http://hpux.csc.liv.ac.uk/
Germany: http://hpux.ask.uni-karlsruhe.de/
US (WI): http://hpux.cae.wisc.edu/
France: http://hpux.cict.fr/
Netherlands: http://hpux.tn.tudelft.nl/
Canada: http://hpux.ee.ualberta.ca/
Italy: http://hpux.dsi.unimi.it/
South Africa: http://hpux.petech.ac.za/
Japan: http://hpux.u-aizu.ac.jp/
US (UT): http://hpux.cs.utah.edu/

View File

@@ -1,10 +1,53 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = wrlib WINGs src util po WindowMaker wmlib test WPrefs.app doc\
contrib
AUTOMAKE_OPTIONS =
EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N FAQ.I18N.cs FAQ.I18N.sk \
INSTALL.cs INSTALL.fr INSTALL.es INSTALL.pt INSTALL.sk \
README.definable-cursor README.pt MIRRORS COPYING.WTFPL mkpatch
# libwmfun-0.0.3.tar.gz
BUILT_SOURCES = config-paths.h
DISTCLEANFILES = config-paths.h
config.h: config-paths.h
config-paths.h: Makefile
@echo "Generating $@"
@echo '/* define to the path to cpp */' > $@
@echo '#define CPP_PATH "$(CPP_PATH)"' >> $@
@echo '' >> $@
@echo '/* gettext domain used for menu translations */' >> $@
@if test -z "$(menutextdomain)"; then \
echo '/* #undef MENU_TEXTDOMAIN "$(menutextdomain)" */' >> $@; \
else \
echo '#define MENU_TEXTDOMAIN "$(menutextdomain)"' >> $@; \
fi
@echo '' >> $@
@echo '/* define an extra path for pixmaps */' >> $@
@echo '#define PIXMAPDIR "$(pixmapdir)"' >> $@
@echo '' >> $@
@echo '/* where shared data is stored */' >> $@
@echo '#define PKGDATADIR "$(datadir)/WindowMaker"' >> $@
@echo '' >> $@
@echo '/* where the configuration is stored */' >> $@
@echo '#define SYSCONFDIR "$(sysconfdir)"' >> $@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = wrlib WINGs src util po WindowMaker WPrefs.app doc
EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N INSTALL \
INSTALL-WMAKER README.definable-cursor \
The-perfect-Window-Maker-patch.txt \
README COPYING.WTFPL autogen.sh
if USE_LCOV
coverage-reset:
find . -type f -name '*.gcda' -exec rm -f '{}' ';'
lcov --directory . --zerocounters
coverage:
rm -rf coverage @lcov_output_directory@
-mkdir -p coverage @lcov_output_directory@
lcov --compat-libtool --capture --directory . --output-file coverage/coverage.info
genhtml --output-directory @lcov_output_directory@ coverage/coverage.info
.PHONY: coverage-reset coverage
endif

88
NEWS
View File

@@ -2,6 +2,79 @@
NEWS for veteran Window Maker users
-----------------------------------
--- 0.94.0-crm
New Resizing functionality
--------------------------
You can now use the mouse wheel and modifier keys to resize windows.
MOD+Wheel will resize windows vertically and CTRL+Wheel will resize
windows horizontally. MOD+CTRL+Wheel will resize both at the same time.
The resize step, or increment can be set in WPrefs in the "Window Handling"
page, or in the config file with "ResizeIncrement". If this intrudes into
a specific application's functionality, you can disable it on an application-
by-application basis by setting the "Do not bind mouse clicks" attribute in
"Advanced Options".
New Maximize functionality
--------------------------
Maximus/Maximumize. A new tiled maximization, configured with a keyboard
shortcut. Using it will maximize the window to the greatest area such that it
will not overlap any other window of the same workspace. This can be configured
in WPrefs in the "Keyboard Shortcuts" page, or in the config file with
"MaximusKey".
Left/right maximization. Now wmaker supports maximizing a window to the
left or right half of the screen, making it occupy 50% of the area. This is
useful on widescreen displays where you want to bring up two windows side-by-
side. The shortcut keys for this can be configured in WPrefs in the "Keyboard
Shortcuts" page, or in the config file with "LHMaximizeKey" and "RHMaximizeKey"
History and AutoComplete in the run dialog
------------------------------------------
The "Run..." dialog now autocompletes executables in your path (triggered by
the TAB key) and records the history of past commands (last 500 by default).
It can also complete folder names if you start the complete with a "/"
To use it replace %a with %A in the "Run..." entry in your WMRootMenu file.
See commit 05720d97076ffc1569e5 for more details.
Automatic menu generator (wmgenmenu)
-----------------------------------
There is now a new utility to generate the Window Maker menu automatically,
called wmgenmenu. It searches from a list of pre-defined applications the
ones which exist in your $PATH and adds them to the corresponding submenus
("Internet", "Terminals", "Editors" etc) of your WM menu. It also supports
localization (currently English and German). You can use it like:
$ wmgenmenu > WMRootMenu-new
$ cp WMRootMenu-new $HOME/GNUstep/Defaults/WMRootMenu
and WM will automatically detect the new menu file and use it without
restarting wmaker (made possible by the 'inotify' mechanism)
Automatic detection of menu changes (via inotify)
-------------------------------------------------
Window Maker now uses the 'inotify' mechanism from the linux kernel
to automatically detect changes in the WMRootMenu file. So the
--no-polling option is now gone and Window Maker does not wake up
your CPU unnecessarily (0 wakeups when idle, instead of 4).
So if you edit the WMRootMenu file by hand (or by using 'wmgenmenu'),
there is no need to restart wmaker for the changes to take effect.
DockApp recognition
-------------------
In addition to applications with only Withdrawn windows, Window Maker
will now treat any application with its WM_CLASS res_class set as
"DockApp". This provides an easy workaround for toolkits like gtk+ that
do not allow creation of windows with the initial_state member of
XWMHints set to WithdrawnState.
--- 0.92.0
GNUstep Installation Directory
@@ -23,8 +96,17 @@ the GNUstep path structure.
Also WPrefs now stores internal data in ~/GNUstep/Library/WindowMaker/WPrefs
(it was ~/GNUstep/.AppInfo/WPrefs before)
X Input Methods support in WINGs
--------------------------------
--- 0.91.1
Preliminary support for X Input Methods was added to textfield and text
widgets in WINGs. Input for text in other languages than English should
work now (except for kanji which will most likely not work, even though
it wasn't tested).
Disabling the switch panel
--------------------------
To disable the panel shown during Alt-tabbing, you may put the following in
~/GNUstep/Defaults/WindowMaker
@@ -768,7 +850,7 @@ Themes
Removed all themes from the source tree, and moved them in a separate package.
You can download the new package from the same place as this package:
ftp://ftp.windowmaker.org/pub/beta/srcs/
ftp://ftp.windowmaker.info/pub/beta/srcs/
Look after WindowMaker-extra-<version-number>.tar.gz
Also WindowMaker-extra pack include the old WindowMaker-data.tar.gz which only
contained icons.
@@ -863,7 +945,7 @@ libPropList
WARNING!!! libPropList was removed from the Window Maker distribution
and is being distributed separately. If you dont have it installed yet,
get it from ftp.windowmaker.org/pub/libs and install before building
get it from ftp.windowmaker.info/pub/libs and install before building
Window Maker.

228
README
View File

@@ -4,8 +4,7 @@
GNU Window Maker
X11 Window Manager
<http://windowmaker.org>
<ftp://ftp.windowmaker.org>
<http://windowmaker.org>
by
@@ -41,26 +40,25 @@
Description
===========
Window Maker is the GNU window manager for the X Window System. It was
designed to emulate the look and feel of part of the NEXTSTEP(tm) GUI. It's
supposed to be relatively fast and small, feature rich, easy to configure and
easy to use, with a simple and elegant appearance borrowed from NEXTSTEP(tm).
Window Maker is the GNU window manager for the X Window System. It was designed
to emulate the look and feel of part of the NEXTSTEP(tm) GUI. It's supposed to
be relatively fast and small, feature rich, easy to configure and easy to use,
with a simple and elegant appearance borrowed from NEXTSTEP(tm).
Window Maker was designed keeping integration with GNUstep in mind and is the
"official" window manager for it. It is also part of the GNU project
(www.gnu.org) Read more about GNUstep further on this file.
Hints (information given by applications to integrate well with the window
manager) for Motif(tm) and NETWM are also supported (NETWM is used by KDE
and GNOME, so they are automatically supported as a result).
So you can replace any of the window managers for these environments
with Window Maker while keeping most, if not all, of the native window manager
functionality.
Hints (information given by applications to integrate well with the window
manager) for Motif(tm) and NETWM are also supported (NETWM is used by KDE and
GNOME, so they are automatically supported as a result). So you can replace any
of the window managers for these environments with Window Maker while keeping
most, if not all, of the native window manager functionality.
Window Maker was previously called WindowMaker.
Window Maker has no connection with Windowmaker, the software for
making windows and doors.
Window Maker has no connection with Windowmaker, the software for making windows
and doors.
Documentation
@@ -72,8 +70,8 @@ Read before asking.
in the directories.
* INSTALL has installation instructions and some troubleshooting tips.
You're meant to read it before installing. it was not written just to
fill up space in the package...
You're meant to read it before installing. it was not written just to fill up
space in the package.
* FAQ: Frequently Asked Questions. READ IT!!! FAQ.I18N is for
internationalization related questions.
@@ -81,14 +79,10 @@ internationalization related questions.
* NEWS: list user visible changes from the previous version. Read it if
you are upgrading.
* MIRRORS: some alternative places where you can get Window Maker,
including platform specific packages of Window Maker.
* BUGFORM: use it to send bug reports. Please do use it.
* ChangeLog: what changed from the previous version?
* BUGS: list of known bugs
*** Tutorial
@@ -102,8 +96,6 @@ http://www.linuxfocus.org/~georges.t/
The Window Maker User's Guide can be downloaded from the official ftp
or web sites.
It can also be viewed in HTML format in:
http://people.delphi.com/crc3419/WMUserGuide/index.htm
The User Guide explains how to use Window Maker, the configuration files
and options.
@@ -119,29 +111,29 @@ Directories & Files in the Source Tree
======================================
* Install is a script for configuring and compiling Window Maker in a easy
way (not that the normal way is difficult, but...).
way (not that the normal way is difficult, but...).
* AUTHORS: the credits
* TODO: plans for the future
* contrib/ has some contributed patches that are not supported by Window Maker
because they conflict with design filosophies of the developers or some
other reason.
because they conflict with design philosophies of the developers or some other
reason.
* util/ has various utility programs.
* WPrefs.app/ is the configuration program.
* src/wconfig.h has compile time options you can change to select some
options/features and other stuff.
options/features and other stuff.
* WINGs/ NEXTSTEP lookalike widget library
* wrlib/ image processing library
* po/ has message catalogs wich are the translated versions of the messages
displayed by Window Maker.
displayed by Window Maker.
* docklib-x.x.tar.gz a library for writing dockapps
@@ -150,114 +142,98 @@ HELP ME!!!
==========
There is a mailing list for discussing Window Maker at
wm-user@windowmaker.org To subscribe to it, send a message containing:
subscribe
in the subject of the message to wm-user-request@windowmaker.org
wmaker-user@lists.windowmaker.org To subscribe to it, send a message to
wmaker-user-subscribe@lists.windowmaker.info
If you got a problem, ask there (after reading the docs, of course). The
people there is more likely to be able to answer your questions than we are.
For bug reports use the BUGFORM.
If you got a problem, ask there (after reading the docs, of course). The people
there is more likely to be able to answer your questions than we are. For bug
reports use the BUGFORM.
If you have a problem with a precompiled version of Window Maker
(rpm, deb etc), first ask the person who made the package.
If you have a problem with a precompiled version of Window Maker (rpm, deb etc),
first ask the person who made the package.
IMPORTANT NOTE: when asking for help (in the mailing list or to the
developerts, directly) *always* send information about the system you are
using. You can use the system information section at the end of BUGFORM as a
guideline. Another thing: please don't send HTML mail.
IMPORTANT NOTE: when asking for help (in the mailing list or to the developerts,
directly) *always* send information about the system you are using. You can use
the system information section at the end of BUGFORM as a guideline. Another
thing: please don't send HTML mail.
There is also a #windowmaker IRC channel at openprojects. To join there,
connect your irc client to irc.openprojects.net, irc.linux.com or some other
server of that network.
There is also a #windowmaker IRC channel at freenode. To join there, connect
your irc client to irc.freenode.net. irc.windowmaker.org will direct you to the
correct IRC network.
GNUstep
=======
GNUstep is a complete object-oriented development system, based on the
OpenStep specification released by NeXT(tm) (now Apple(tm)) and Sun(tm). It
will provide everything one needs to produce cross-platform, object-oriented,
graphical (and non-graphical) applications; providing among other things,
base system libraries, a high-level GUI application framework that uses a
Display PostScript(tm)-like imaging model (DGS), objects for accessing
relational databases, distributed objects and a graphical development
environment, with tools like interface modeller, a project management system
(project center) and other tools.
GNUstep is a complete object-oriented development system, based on the OpenStep
specification released by NeXT(tm) (now Apple(tm)) and Sun(tm). It will provide
everything one needs to produce cross-platform, object-oriented, graphical (and
non-graphical) applications; providing among other things, base system
libraries, a high-level GUI application framework that uses a Display
PostScript(tm)-like imaging model (DGS), objects for accessing relational
databases, distributed objects and a graphical development environment, with
tools like interface modeller, a project management system (project center) and
other tools.
The GNUstep development system will be used to create a user environment,
with everything needed for a complete graphical user interface, such as a
file viewer, text editors and other applications. Note that the user
environment (or "desktop environment") is only a small part of the whole
GNUstep project and therefore it does not "compete" with other projects like
KDE or GNOME, simply because they are completely different things.
The GNUstep development system will be used to create a user environment, with
everything needed for a complete graphical user interface, such as a file
viewer, text editors and other applications. Note that the user environment (or
"desktop environment") is only a small part of the whole GNUstep project and
therefore it does not "compete" with other projects like KDE or GNOME, simply
because they are completely different things.
For more information on the GNUstep project, visit: http://www.gnustep.org
and http://gnustep.current.nu
Running multiple instances of Window Maker
==========================================
It is not a good idea to run more than one instance of Window Maker
from the same user (so that wmaker will use the same configuration
files) at the same time. You might get unexpected behaviour when Window Maker
updates it's configuration files.
from the same user (so that wmaker will use the same configuration files) at the
same time. You might get unexpected behaviour when Window Maker updates it's
configuration files.
If you really desire to do this, try running Window Maker with the
command line option --static so that it will not update or change
any of the configuration files.
Sound support
=============
Sound is supported for Linux and FreeBSD systems with the use of a
separately distributed module called WSoundServer. There is also a graphical
configuration tool for setting up your sounds called WSoundPrefs.
You can download these at:
http://shadowmere.student.utwente.nl/
Note that you must compile Window Maker with the --enable-sound configure
flag and set the DisableSound option to NO.
If you really desire to do this, try running Window Maker with the command line
option --static so that it will not update or change any of the configuration
files.
Performance Tuning
==================
If you want to diminish Window Maker's memory usage and improve performance,
while keeping a nice appearance and good functionality, follow the items
bellow:
while keeping a nice appearance and good functionality, follow the items bellow:
- use solid textures for everything, mainly titlebars and menus. If you
want a nice looking desktop, use the Traditional style.
- use solid textures for everything, mainly titlebars and menus. If you want a
nice looking desktop, use the Traditional style.
- turn NewStyle and Superfluous off
- do not bind many shortcuts in the menu and keep only the essential items
in the menu
- do not bind many shortcuts in the menu and keep only the essential items in
the menu
- turn on DisableClip
- edit wconfig.h and disable the NUMLOCK_HACK and the features you
don't use anyway (keep in mind that some of the #defines might not
work, as they are not fully supported). Make sure to always keep
NumLock and ScrollLock turned off.
- edit wconfig.h and disable the NUMLOCK_HACK and the features you don't use
anyway (keep in mind that some of the #defines might not work, as they are not
fully supported). Make sure to always keep NumLock and ScrollLock turned off.
- turn on DisableAnimations. You can also #undefine ANIMATIONS in wconfig.h
- strip down the default IconPath and PixmapPath entries to contain only
the paths that you really have in your system.
- do not use large images in the root background
- remove support for image formats you don't use
- to reduce memory usage, disable the icon cache, by setting the RIMAGE_CACHE
environment variable to 0. If you want to increase performance at the cost
of memory usage, set it's value to a value like the number of different
icons you use. Also, disable anti-aliased text support in ~/GNUstep/Defaults/WMGLOBAL.
environment variable to 0. If you want to increase performance at the cost of
memory usage, set it's value to a value like the number of different icons you
use. Also, disable anti-aliased text support in ~/GNUstep/Defaults/WMGLOBAL.
Keyboard Mouse Control
======================
Many people ask about adding keyboard control of mouse, like in fvwm,
but Window Maker will not have such feature. The XKB extension supports
mouse simulation from the keyboard, in a much more powerfull fashion than
any simulation done by a window manager.
Many people ask about adding keyboard control of mouse, like in fvwm, but Window
Maker will not have such feature. The XKB extension supports mouse simulation
from the keyboard, in a much more powerfull fashion than any simulation done by
a window manager.
To enable it, hit the Control+Shift+NumLock or Shift+NumLock key combination.
To enable it, hit the Control+Shift+NumLock or Shift+NumLock key combination.
You should hear the speaker beeping. To disable it, do the same thing.
To control the mouse the numeric keypad is used as follows:
@@ -283,28 +259,27 @@ milleage may vary.
How to make a gdb backtrace
===========================
Backtraces can help us fix bugs that make Window Maker crash. If you
find a bug that crashes Window Maker, please send a backtrace with your
bug report.
Backtraces can help us fix bugs that make Window Maker crash. If you find a bug
that crashes Window Maker, please send a backtrace with your bug report.
To make a usefull backtrace, you need a core file with debugging
information produced by Window Maker when it crashes. It should
have been installed without stripping too.
To make a usefull backtrace, you need a core file with debugging information
produced by Window Maker when it crashes. It should have been installed without
stripping too.
To compile wmaker with debugging information:
./configure
make CFLAGS=-g
./configure
make CFLAGS=-g
If you get the dialog window telling you that wmaker crashed and
asks you what to do, tell it to "Abort and leave a core file".
If you get the dialog window telling you that wmaker crashed and asks you what
to do, tell it to "Abort and leave a core file".
script
cd src
gdb .libs/wmaker path_to_the_core_file
script
cd src
gdb .libs/wmaker path_to_the_core_file
Then, in the gdb prompt type "bt". Quit from gdb by typing "quit"
and then, in the shell prompt, type "exit".
Then, in the gdb prompt type "bt". Quit from gdb by typing "quit" and then, in
the shell prompt, type "exit".
The file named typescript will contain the backtrace.
@@ -313,20 +288,19 @@ The file named typescript will contain the backtrace.
Copyrights & Disclaimers
========================
Window Maker is copyrighted by Alfredo K. Kojima and is licensed through the
GNU General Public License. Read the COPYING file for the complete license.
Window Maker is copyrighted by Alfredo K. Kojima and is licensed through the GNU
General Public License. Read the COPYING file for the complete license.
The icons that are distributed with this program and were made by Marco van
Hylckama Vlieg, are licensed through the GNU General Public License. Read the
Hylckama Vlieg, are licensed through the GNU General Public License. Read the
COPYING file for the complete license.
The icons listed in COPYING.WTFPL and are distributed in this
program and were made by Banlu Kemiyatorn (]d), are licensed through the
"do What The Fuck you want to Public License". Read the COPYING.WTFPL
file for the complete license.
The icons listed in COPYING.WTFPL and are distributed in this program and were
made by Banlu Kemiyatorn (]d), are licensed through the "do What The Fuck you
want to Public License". Read the COPYING.WTFPL file for the complete license.
NeXT, OpenStep and NEXTSTEP are a trademarks of NeXT Computer, Inc.
All other trademarks are property of their respective owners.
NeXT, OpenStep and NEXTSTEP are a trademarks of NeXT Computer, Inc. All other
trademarks are property of their respective owners.
The authors reserve the right to make changes in the software without prior
notice.
@@ -335,19 +309,19 @@ notice.
Authors
=======
Alfredo K. Kojima <kojima@windowmaker.org>
Dan Pascu <dan@windowmaker.org>
]d <id@windowmaker.org>
Alfredo K. Kojima <kojima@windowmaker.info>
Dan Pascu <dan@windowmaker.info>
]d <id@windowmaker.info>
Please don't ask us questions before reading the documentation (esp. the
FAQ, this file and INSTALL files) and about "cool" things you see in
people's desktop screenshots.
Please don't ask us questions before reading the documentation (esp. the FAQ,
this file and INSTALL files) and about "cool" things you see in people's desktop
screenshots.
The AUTHORS file contains a list of the people who have contributed to the
project. The name of people who have helped with localization (translation)
can be found in po/README and Window Maker/README
project. The name of people who have helped with localization (translation) can
be found in po/README and Window Maker/README
If you have any comments, fixes and bug reports (filled BUGFORMs) send them
to developers@windowmaker.org
to wmaker-dev@lists.windowmaker.org

345
README.es
View File

@@ -1,345 +0,0 @@
GNU Window Maker
X11 Window Manager
<http://windowmaker.org>
<ftp://ftp.windowmaker.org>
por
Alfredo K. Kojima
Dan Pascu
]d
Web/FTP Master
Phillip Smith
¡Felicitaciones! Ha adquirido un dispositivo
excelentísimo que le proporcionará miles de años de uso sin
problemas, si no fuera porque indudablemente lo destruirá a
través de alguna maniobra estúpida típica de consumidor. Por
eso le pedimos por EL AMOR DE DIOS LEA ESTE MANUAL DEL
PROPIETARIO CUIDADOSAMENTE ANTES DE DESEMPAQUETAR EL
DISPOSITIVO. ¿YA LO DESEMPAQUETÓ, NO? LO DESEMPAQUETÓ Y LO
ENCHUFÓ Y LO ENCENDIÓ Y TOQUETEÓ LAS PERILLAS, Y AHORA SU
CHICO, EL MISMO CHICO QUE UNA VEZ METIÓ UNA SALCHICHA EN SU
VIDEOCASETERA Y ACCIONÓ "AVANCE RÁPIDO", ESTE CHICO
TAMBIÉN ESTÁ TUOQUETEANDO LAS PERILLAS, ¿CIERTO? Y RECIÉN
AHORA ESTÁ COMENZANDO A LEER LAS INSTRUCCIONES, ¿¿¿CIERTO???
NOSOTROS PODRÍAMOS SIMPLEMENTE ROMPER ESTOS DISPOSITIVOS EN LA
FÁBRICA ANTES DE DESPACHARLOS, ¿SABE?
-- Dave Barry, "¡Lea Esto Primero!"
Descripción
===========
Window Maker es el gestor de ventanas GNU para el Sistema de Ventanas X. Fue
diseñado para emular la apariencia y funcionalidad de parte del GUI de NEXTSTEP(mr).
Procura ser relativamente rápido y pequeño, rico en características, fácil de configurar
y usar, con una simple y elegante apariencia sacada desde NEXTSTEP(mr).
Window Maker fue diseñado teniendo en mente la integración con GNUstep y por eso
es el gestor de ventanas "oficial". Es también parte del proyecto GNU (www.gnu.org)
. Lea mas sobre GNUstep más adelante en este archivo.
Pistas (información dada por las aplicaciones para integrarse bien con el gestor de
ventanas) para Motif(tm), OPEN LOOK(tm), KDE y GNOME también son soportados.
Entonces puede reemplazar cualquiera de los gestores de ventana para estos entornos
con Window Maker manteniendo la mayoría, si no todo, de la funcionalidad del
gestor de ventanas nativo.
Window Maker antes se llamaba WindowMaker.
Window Maker no tiene relación con Windowmaker, el software para
hacer ventanas y puertas.
Documentación
=============
Lea antes de preguntar.
* Los archivos README distribuidos por todas partes del árbol de fuentes
contienen información relacionada al contenido en los directorios.
* INSTALL tiene instrucciones de instalación y algunos consejos cuando tenga
algún problema. Significa que debería leerlo antes de la instalación.
No fue escrito solo para ocupar espacio en el paquete...
* FAQ: Preguntas Frecuentes. LEALO!!! FAQ.I18N es para
preguntas relacionadas con la internacionalización.
* NEWS: lista los cambios visibles por el usuario desde la versión anterior.
Léalo si está actualizando.
* MIRRORS: algunos lugares alternativos donde puede obtener Window Maker,
incluyendo paquetes de Window Maker específicos para ciertas plataformas.
* BUGFORM: uselo para enviar reportes de errores. Por favor uselo.
* ChangeLog: ¿que cambió desde la versión anterior?
* BUGS: lista de errores conocidos.
*** Tutorial
Hay un tutorial mantenido por Georges Tarbouriech en:
http://www.linuxfocus.org/~georges.t/
*** Guía del Usuario
La Guía del Usuario de Window Maker puede ser bajada desde el ftp oficial
o por sitios web.
Puede también ser vista en formato HTML en:
http://people.delphi.com/crc3419/WMUserGuide/index.htm
La Guía del Usuario explica como usar Window Maker, los archivos de configuración
y opciones.
*** man pages
Tipee "man wmaker" en el prompt del shell para obtener ayuda general sobre Window Maker.
Directorios y Archivos en el Árbol de Fuentes
=============================================
* Install es un script para configurar y compilar Window Maker de una forma
fácil (no es que la forma normal sea difícil, pero...).
* AUTORES: los créditos
* TODO: planes para el futuro.
* contrib/ tiene algunos parches aportados que no están soportados por Window Maker
porque entran en conflicto con la filosofía de diseño de los desarrolladores o por
alguna otra razón.
* util/ tiene varios programas utilitarios.
* WPrefs.app/ es el programa de configuración.
* src/wconfig.h posee opciones de compilación que puede cambiar para
seleccionar algunas opciones/caracteristicas y otras cosas.
* WINGs/ biblioteca widget para imitación de NEXTSTEP.
* wrlib/ biblioteca de procesamiento de imagen.
* po/ posee catálogos de mensajes que son las versiones traducidas de los mensajes
mostrados por Window Maker.
* docklib-x.x.tar.gz es una biblioteca para escribir dockapps.
SOCORRO!!!
==========
Hay una lista de correo para discutir sobre Window Maker en
wm-user@windowmaker.org. Para suscribirse, envie un mensaje que contenga:
subscribe
en el tema del mensaje a wm-user-request@windowmaker.org
Si tiene algun problema, pregunte aquí (después de leer los docs, por supuesto). Es
más probable que las personas de la lista sepan contestar sus preguntas
que nosotros. Para reportes de errores use el BUGFORM.
Si tiene un problema con una versión precompilada de Window Maker
(rpm, deb etc), primero pregunte a la persona que hizo el paquete.
NOTA IMPORTANTE: cuando pida ayuda (en la lista de correo o a los desarrolladores,
directamente) *siempre* envie información sobre el sistema que está usando. Puede
usar la sección de información del sistema al final del BUGFORM como una guía.
Otra cosa: por favor no envie correo HTML.
También hay un canal de IRC #windowmaker en openprojects. Únase aquí,
conecte su cliente de irc a irc.openprojects.net, irc.linux.com o algún otro
servidor de esa red.
GNUstep
=======
GNUStep es un completo sistema de desarrollo orientado a objetos, basado en la
especificación OpenStep liberada por NeXT(tm) (ahora Apple(tm) y Sun(tm)). Ello
proveerá todo lo que se necesita para producir aplicaciones multiplataforma,
orientadas a objetos, gráficas (y no gráficas); suministrando dentro de otras cosas,
bibliotecas base del sistema, una estructura de alto nivel para aplicaciones GUI que
usan un modelo de imagenes de tipo Display PostScript(tm) (DGS), objetos para acceso
a bases de datos relacionales, objetos distribuidos y un entorno de desarrollo gráfico,
con herramientas como un modelador de interfaces, un sistema para administración del
proyecto (central de proyecto) y otras herramientas.
El sistema de desarrollo de GNUStep será usado para crear un entorno de usuario,
con todo lo necesario para una completa interface gráfica de usuario, tal como
un visualizador de archivos, editores de texto y otras aplicaciones. Note que el
entorno de usuario (o "entorno de escritorio") es solo un pequeña parte de todo
el proyecto GNUStep y por lo tanto no "compite" con otros proyectos como KDE o GNOME,
simplemente porque son cosas completamente diferentes.
Para más información sobre el proyecto GNUStep, visite: http://www.gnustep.org y
http://gnustep.current.nu
Ejecutando multiples instancias de Window Maker
===============================================
No es una buena idea eejcutar más de una instancia de Window Maker desde
el mismo usuario (ya que wmaker usará los mismos archivos de configuración)
al mismo tiempo. Podría obtener un comportamiento inesperado cuando Window
Maker actualiza sus archivos de configuración.
Si de verdad desea hacer esto, intente ejecutar Window Maker con la opción
de linea de comando --static ya que así no actualizará o cambiará ninguno de los
archivos de configuración.
Soporte para Sonido
===================
El sonido es soportado por los sistemas Linux y FreeBSD con el uso de
un módulo distribuido separadamente llamado WSoundServer. Hay también
una herramienta de configuracion gráfica para definir sus sonidos llamada
WSoundPref.
Puede bajar esto en:
http://shadowmere.student.utwente.nl/
Note que debe compilar Window Maker con el parámetro --enable-sound
y definir la opción DisableSound a NO.
Ajuste de Rendimiento.
=====================
Si quiere disminuir el uso de memoria por parte de Window Maker y mejorar el
rendimiento, manteniendo una linda apariencia y buena funcionalidad, siga los
items de abajo:
- use texturas sólidas para todo, principalmente barras de título y menúes.
Si quiere un escritorio de aspecto lindo, use el estilo Tradicional.
- Apague NewStyle y Superfluous
- No una muchos atajos al menú y mantenga solo los items esenciales en el menú.
- Active DisableClip
- edite wconfig.h y desactive el NUMLOCK_HACK y lo mismo con las características
que no use (tenga en mente que algunos de los #defines podrían no funcionar,
ya que ellos no están completamente soportados). Asegúrese de mantener siempre
Numlock y ScrollLock apagados.
- Active DisableAnimations. Puede también #undefine ANIMATIONS en wconfig.h
- quite las entradas por defecto IconPath y PixmapPath para contener solo las
rutas que en verdad tiene en su sistema.
- no use imágenes grandes en el fondo raíz.
- quite el soporte para los formatos de imagen que no use.
- para reducir el uso de la memoria, desactive el caché de ícono, definiendo
la variable de entorno RIMAGE_CACHE a 0. Si quiere aumentar el rendimiento
a expensas del uso de la memoria, defina este valor a un valor igual al
número de íconos distintos que use.
Control del Mouse por Teclado
=============================
Muchas personas preguntan sobre agregar control por teclado al mouse, como
en fvwm, pero Window Maker no tendrá tal característica. La extensión XKB
soporta simulación de mouse desde el teclado, de una manera mucho más poderosa
que cualquier otra simulación hecha por un administrador de ventanas.
Para activarlo, presione la combinación de teclas Control+Shift+NumLock o
Shift+NumLock. Debiera escuchar el beep del parlante. Para desactivarlo,
haga lo mismo.
Para controlar el mouse el teclado numérico se usa así:
- 4 (flecha izquierda), 7 (Home), 8 (flecha arriba), 9 (PgUP), 6 (flecha derecha),
3 (PgDn), 2 (flecha abajo) y 1 (Fin) mueve el mouse a la correspondiente
dirección;
- sosteniendo una de las teclas de arriba y luego sosteniendo la tecla 5 moverá
el puntero más rápido;
- / seleccionará el primer botón del mouse (botón izquierdo);
- * seleccionará el segundo botón del mouse (botón del medio);
- - seleccionará el tercer botón del mouse (botón derecho);
- 5 hará un click con el botón actualmente seleccionado del mouse;
- + hará un doble click con el botón actualmente seleccionado;
- 0 (Ins) cliqueará y mantendrá el botón seleccionado actualmente;
- . (Del) liberará el botón seleccionado actualmente que fue anteriormente
cliqueado con la tecla 0 (Ins).
Los valores anteriores de las teclas funcionarán en un servidor X XFree86 3.2
(X11R6.1) pero su alcance puede variar.
Como hacer un gdb backtrace
===========================
Backtraces pueden ayudarnos a arreglar errores que hicieron que Window Maker falle.
Si encuentra un bug que hace fallar a Window Maker, por favor envie un backtrace con su
reporte de error.
Para hacer un backtrace útil, necesita un archivo core con información de depuración
producida por Window Maker cuando falló. Debería haber sido instalado sin stripping también.
Para compilar wmaker con información de depuración:
./configure
make CFLAGS=-g
Si obtiene el cuadro de diálogo que le dice que wmaker falló y le
pregunta que hacer, respóndale "Abortar y dejar un archivo core"
script
cd src
gdb .libs/wmaker path_to_the_core_file
Luego, en el prompt gdb escriba "bt". Salga de gdb escribiendo "quit"
y luego, en el prompt del shell, scriba "exit"
El archivo llamado typescript contendrá el backtrace.
Derechos de Autor y Descargo de Responsabilidad
===============================================
Window Maker está registrado por Alfredo K. Kojima y está licensiado por la
Licensia Pública General GNU. Lea el archivo COPYING para leer la licensia
completa.
Los íconos que son distribuidos con este programa y fueron hechos por Marco
van Hylckama Vlieg, están licenciados por la Licencia Pública General GNU.
Lea el archivo COPYING para leer la licencia completa.
Los íconos listados en COPYING.WTFPL y son distribuidos en este programa
fueron hechos por Banlu Kemiyatorn (]d), están licenciados por la
"do What The Fuck you want to Public License". Lea el archivo COPYING.WTFPL
para leer la licencia completa.
NeXT, OpenStep y NEXTSTEP son marcas registradas de NeXT Computer, Inc.
Todas las otras marcas registradas son propiedad de sus respectivos dueños.
Los autores se reservan el derecho de hacer cambios en el software sin previo
aviso.
Autores
=======
Alfredo K. Kojima <kojima@windowmaker.org>
Dan Pascu <dan@windowmaker.org>
]d <id@windowmaker.org>
Por favor no nos haga preguntas antes de leer la documentación (especialmente
la FAQ, este archivo y los archivos INSTALL) y sobre cosas "cool" que ve en
las capturas de pantalla del escritorio de las personas.
El archivo AUTHORS contiene una lista de las personas que han contribuido
con el proyecto. El nombre de las personas que han ayudado con localization
(traducción) se puede encontrar en po/README y Window Maker/README
Si tiene algún comentario, arreglos y reportes de errores (complete BUGFORMs)
y enviémelos a developers@windowmaker.org
traducido por Efraín Maximiliano Palermo <max_drake2001@yahoo.com.ar>

351
README.pt
View File

@@ -1,351 +0,0 @@
GNU Window Maker
Gerenciador de Janelas X11
<http://windowmaker.org>
<ftp://ftp.windowmaker.org>
por
Alfredo K. Kojima
Dan Pascu
Matthew Hawkins
]d
Web/FTP Master
Phillip Smith
Parabéns! Você acabou de adquirir um dispositivo muito
bom que lhe proporcionaria milhares de anos de uso sem problemas,
exceto por que, você, com vai certeza destruí-lo com algum procedimento
idiota típico dos consumidores. Por isso nós pedimos POR FAVOR,
PELO AMOR DE DEUS LEIA O MANUAL DO DONO COM MUITA ATENÇÃO ANTES
DE DESEMBRULHAR O DISPOSITIVO. VOCÊ JÁ O DESEMPACOTOU, NÃO FOI?
VOCÊ DESEMPACOTOU-O, CONECTOU-O, LIGOU-O E ENCHEU-O DE COISAS,
E AGORA A SUA CRIANÇA, A MESMA CRIANÇA QUE UMA VEZ ENFIOU UMA
SALSICHA NO SEU VIDEOCASSETE E APERTOU NO "FAST FORWARD", ESTA
CRIANÇA ESTÁ BRINCANDO COM OS BOTÕES TAMBÉM CERTO? E SÓ AGORA VOCÊ
ESTÁ COMEÇANDO A LER AS INSTRUÇÕES CERTO??? NÓS PODEMOS ENTÃO QUEBRAR
ESTES DISPOSITIVOS NA FÁBRICA ANTES DE DESPACHÁ-LOS, VOCÊ
SABIA DISSO?
-- Dave Barry, "Read This First!"
Descrição
=========
O Window Maker é o gerenciador de janelas GNU para o X Window System. Ele foi
desenvolvido para emular o visual e a sensação de parte da GUI NEXTSTEP(tm).
Procura ser relativamente rápido e pequeno, rico em opções, fácil de
configurar e usar, com uma aparência simples e elegante emprestada do
NEXTSTEP(tm).
O Window Maker foi projetado tendo em mente a integração com o GNUStep e
é o gerenciador de janelas "oficial" dele. É ainda parte do projeto GNU
(www.gnu.org).
Leia mais sobre o GNUstep neste arquivo.
Hints (informações dadas pelas aplicações para que se integrem bem com o
gerenciador de janelas) para Motif(tm), OPEN LOOK(tm), KDE e GNOME também
são suportados. Logo, você pode substituir os gerenciadores de janela desses
ambientes pelo Window Maker e manter muito, senão toda a funcionalidade do
gerenciador de janelas nativo.
O Window Maker antes se chamava WindowMaker.
O Window Maker não tem relação com o Windowmaker, o software para construção
de janelas e portas.
Documentação
============
Leia antes de perguntar.
* Os arquivos README distribuídos por toda a árvore dos fontes contêm
informações relacionadas ao conteúdo dos diretórios.
* O INSTALL possui instruções para instalação e algumas dicas quando há
algum problema. Você deveria lê-lo antes da instalação. Ele não foi escrito
somente para ocupar espaço no pacote...
* FAQ: Frequently Asked Questions. LEIA! O FAQ.I18N é sobre questões
relacionadas à internacionalização.
* NEWS: lista as mudanças de uma versão para outra e que são visíveis ao
usuário. Leia-o se você estiver fazendo uma atualização.
* MIRRORS: alguns locais alternativos onde você pode pegar o Window Maker,
incluindo pacotes do Window Maker específicos para certas plataformas.
* BUGFORM: use-o para enviar relatos de bug. Use-o por favor.
* ChangeLog: o que foi mudado a partir da última versão?
* BUGS: lista dos bugs conhecidos
*** Guia do Usuário
O Guia do Usuário Window Maker pode ser baixado do ftp oficial ou por
sites web. Pode ser visto ainda no formato HTML no:
http://people.delphi.com/crc3419/WMUserGuide/index.htm
O Guia do Usuário explica como usar o Window Maker, fala sobre os
arquivos de configuração e as opções.
*** man pages
Digite "man wmaker" no prompt da shell para obter uma ajuda geral sobre
o Window Maker.
Diretórios & Arquivos na Árvore dos Fontes
==========================================
* O Install é um script para configurar e compilar o Window Maker de
um modo fácil (não que o modo normal seja difícil, mas...).
* AUTHORS: os créditos
* TODO: planos para o futuro
* O contrib/ possui alguns patches enviados e que não foram suportados
pelo Window Maker por entrarem em conflito com a filosofia de projeto dos
desenvolvedores ou por algum outro motivo.
* O util/ possui vários programas utilitários.
* O WPrefs.app/ é o programa de configuração.
* O src/wconfig.h possui opções de compilação que você pode mudar para
selecionar algumas opções/aspectos e outras coisas mais.
* O WINGs/ é a biblioteca de widget NEXTSTEP lookalike
* A wrlib/ é a biblioteca de processamento de imagens
* O po/ possui catálogos de mensagens, que são versões traduzidas das
mensagens mostradas pelo Window Maker
* A docklib-x.x.tar.gz é a biblioteca para desenvolvimento de dockapps
SOCORRO!!!
==========
Há uma lista de discussão para debate de questões sobre o Window Maker
no wm-user@windowmaker.org. Para inscrever-se, mande uma mensagem
contendo:
subscribe
no campo de assunto da mensagem para wm-user-request@windowmaker.org
Se você tiver algum problema, pergunte lá (somente depois de ter lido os
documentos, é claro). As pessoas da lista estão mais preparadas para
resolver o seu problema do que nós. Para relatar BUGS, use o BUGFORM.
Se você tiver problemas com uma versão pré-compilada do Window
Maker (rpm, deb etc), primeiro questione a pessoa que criou o pacote.
NOTA IMPORTANTE: quando for pedir ajuda (seja na lista de discussão ou
diretamente aos desenvolvedores) *sempre* envie informações sobre o sistema
que você está usando. Você pode usar a seção system information no final
do BUGFORM como guia. Outra coisa: não mande mensagens em HTML.
Há ainda o canal de IRC #windowmaker na EFNET. Para entrar lá, conecte
seu cliente de irc no irc.concentric.net, irc.prison.net ou outro
servidor dessa rede.
GNUstep
=======
O GNUstep é um completo sistema de desenvolvimento orientado a objetos,
baseado na especificação OpenStep lançada pela NeXT(tm) (agora Apple(tm) e
Sun(tm)). Ele irá fornecer tudo que é necessário para desenvolver aplicações
orientadas a objetos, gráficas (e não gráficas), cross-platform; fornecendo,
dentre outras coisas, bibliotecas bases do sistema, uma estrutura de alto
nível para aplicações GUI que usa um modelo de imagens do tipo Display
PostScript(tm), objetos para acesso a bancos de dados relacional, objetos
distribuídos e um ambiente de desenvolvimento gráfico, com ferramentas como
um modelador de interfaces, um projeto de gerenciamento de sistema (central
de projetos) e outras ferramentas.
O sistema de desenvolvimento GNUstep será usado para criar um ambiente
de usuário, com tudo necessário para uma interface gráfica, tais como
visualizador de arquivos, editores de texto e outras aplicações. Note que o
ambiente do usuário (ou "ambiente desktop") é somente uma pequena parte de
todo o projeto GNUstep e não "compete" com projetos como o KDE e o GNOME,
simplesmente por que eles são coisas completamente diferentes.
Para mais informação sobre o projeto GNUstep, visite http://www.gnustep.org
e http://gnustep.current.nu
Executando múltiplas instâncias do Window Maker
===============================================
Não é uma boa idéia rodar mais de uma instância do Window Maker sob
um mesmo usuário ao mesmo tempo (já que o wmaker usa os mesmos arquivos
de configuração). Você pode obter comportamentos inesperados quando o
Window Maker atualizar os seus arquivos de configuração.
Suporte para som
================
O Som é suportado nos sistemas Linux e FreeBSD com o uso de módulos
distribuídos separadamente. Você pode baixá-los no:
http://www.frontiernet.net/~southgat/wmsound
Observe que você deve compilar o Window Maker usando o configure com a
flag --enable-sound e definindo a opção DisableSound para NO.
Ajuste da Performance
====================
Se você deseja diminuir o uso de memória pelo Window Maker, aumentar a
performance, e ainda manter uma boa aparência e funcionalidade, siga os
itens abaixo:
- use texturas sólidas para tudo, barras de títulos e menus. Se você quer
um desktop com um belo visual, use o estilo "Traditional".
- desligue o "NewStyle" e o "Superfluous"
- não vincule muitos atalhos ao seu menu e guarde somente coisas essenciais
no menu
- ative o "DisableClip"
- edite o wconfig.h e desative o NUMLOCK_HACK e as opções que você não
usa mesmo (tenha em mente que alguns dos #defines podem não funcionar,
já que eles não estão completamente suportados). Certifique-se de sempre
manter o NumLock e o ScrollLock desligados.
- ligue a opção "DisableAnimations". Você pode também usar o #undefine
ANIMATIONS no arquivo config.h
- verifique as entradas padrão "IconPath" e "PixmapPath" para que contenham
somente os paths que você realmente possua no seu sistema.
- não use imagens grandes no seu background root
- remova o suporte para formatos de imagens que você não usa
- para reduzir o uso de memória, desative o cache de ícones, definindo a
variável de ambiente RIMAGE_CACHE para 0. Se você deseja melhorar o
desempenho perdendo só um pouco de memória, defina essa variável para
o valor correspondente ao número de ícones que você usa.
Controle de Mouse pelo Teclado
==============================
Muitas pessoas perguntam sobre adicionar o controle do mouse pelo teclado,
como no fvwm, mas o Window Maker não possui tal opção. A extensão XKB
suporta a simulação do mouse pelo teclado, de uma maneira muito mais
poderosa do que qualquer outra simulação realizada por um gerenciador de
janelas.
Para ativá-la, aperte a combinação Control+Shift+NumLock ou Shift+NumLock.
Você deve então ouvir um beep. Para desativá-la, faça a mesma coisa.
Para controlar com o mouse, use as seguintes teclas do keypad:
- 4 (seta esquerda), 7 (Home), 8 (seta para cima), 9 (PgUp), 6 (seta direita),
3 (PgDn), 2 (seta para baixo) e 1 (End) move o mouse para as direções
correspondentes;
- segurar as teclas acima e depois segurar a tecla 5 vai fazer o ponteiro
se mover mais rápido;
- / vai selecionar o primeiro botão do mouse (botão esquerdo);
- * vai selecionar o segundo botão do mouse (botão do meio);
- - vai selecionar o terceiro botão do mouse (botão direito);
- 5 vai fazer um clique com o botão do mouse que foi selecionado;
- + vai fazer um duplo-clique com o botão do mouse que foi selecionado;
- 0 (Ins) vai clicar e segurar o botão do mouse selecionado;
- . (Del) vai liberar o botão do mouse selecionado que foi previamente
clicado com a tecla 0 (Ins).
Os valores das teclas acima funcionam com um servidor X XFree86 3.2 (X11R6.1)
mas nosso alcance pode variar.
Como fazer um backtrace com o gdb
=================================
Os backtraces nos ajudam a arrumar bugs que fazem com que o Window Maker
trave. Se você achar um bug que trave o Window Maker, por favor envie o
backtrace com o relato do bug.
Para fazer um backtrace útil, você precisa de um arquivo core
com informações de depuração produzidas pelo Window Maker quando ele
travar. O padrão do Window Maker é iniciar um outro gerenciador
de janelas quando ele travar, o que não gerará um arquivo core. Você
precisa editar o arquivo src/wconfig.h *depois* de ter rodado o configure
e mudar a linha que se parece com o seguinte:
#undef NO_EMERGENCY_AUTORESTART
para:
#define NO_EMERGENCY_AUTORESTART
Depois, no diretório src, digite:
make clean
make CFLAGS=-g
make install
e espere o Window Maker ser instalado.
Depois de instalado o Window Maker, inicie o X e reproduza o bug fazendo
com que o Window Maker trave. Quando ele travar, vá até o diretório
onde você compilou o wmaker e digite o seguinte comando na sua shell:
script
cd src
gdb .libs/wmaker path_ao_arquivo_core
Depois, no prompt do gdb, digite "bt". Saia do gdb digitando "quit"
e depois no prompt da shell, digite "exit".
O arquivo chamado typescript conterá o backtrace.
Direitos Autorais & Disclaimers
===============================
O Window Maker é registrado por Alfredo K. Kojima e é licenciado pela Licença
Pública Geral GNU. Leia o arquivo COPYING para ler a licença completa.
Os ícones que são distribuídos com esse programa foram criados por Marco
van Hylckama Vlieg são licenciados pela OpenContent License. Leia o
arquivo COPYING.OPL para a licença completa.
NeXT, OpenStep e NEXTSTEP são marcas da NeXT Computer, Inc.
Todas as outras marcas são propriedade dos respectivos donos.
Os autores se reservam no direito de fazer alterações no software sem
qualquer aviso prévio.
Autores
=======
Alfredo K. Kojima <kojima@windowmaker.org>
Dan Pascu <dan@windowmaker.org>
]d <id@windowmaker.org>
Por favor não nos perguntem coisas antes de ler a documentação (o FAQ,
este arquivo e os arquivos INSTALL), ou sobre coisas "legais" que você
viu em screenshots de desktops.
O arquivo AUTHORS contem uma lista de pessoas que contribuíram com o projeto.
O nome das pessoas que ajudaram com a tradução pode ser achado no po/README e
Window Maker/README
Se você tem algum comentário, correção ou deseja relatar bugs (junto com
o BUGFORM) mande-os para developers@windowmaker.org
Traduzido por: Ricardo Sartori <sartori@inf.ufsc.br>

6
TODO
View File

@@ -62,3 +62,9 @@ sample implementation (twm?) it might be supported. Maybe dtwm supports
it? I dont know...
After 1.0.0 is released
=======================
- rework/redesign the appicon/dock/clip concept
- maybe rewrite the main code in obj-c or c++
- major clean up in theming/texturing stuff

View File

@@ -0,0 +1,153 @@
____________
Introduction
------------
These notes are meant to help you in the process of making and submitting
patches to the git repository of wmaker-crm.
It assumes you have 'git' correctly installed and you have set the most
basic configuration options via 'git config'. See the end of this file
for an example .gitconfig.
To clone the wmaker-crm repository you can do:
git clone git://repo.or.cz/wmaker-crm.git
__________________________
Producing a patch with git
--------------------------
You have the wmaker source and you want to write a patch in order to fix
a bug or improve something. A possible workflow is the following.
# Optional: Create a new branch (to be safe in case you screw up)
git checkout -b fixbug
Now you fix the bug...
# Check what you did, review etc
git diff
# if it looks good, commit your changes
git commit -a
Git will open the editor set in your .gitconfig and you'll have to write a
commit message. Writing a good message is as important as the source code
modifications you've just made! See "Writing the commit log" for advice.
# Prepare the patch to submit to the mailing-list.
# (use HEAD~2 if you want patches for the last 2 commits etc)
git format-patch HEAD~1
______________________
Writing the commit log
----------------------
You had a motivation to write your patch, you studied the sources and you
found a way to do what you wanted to do. This whole process takes time and
other people will not want to invest that time to rediscover what you've
already found.
So the main reason for the commit message is to explain to other people what
you did, _why_ and _how_. And you must assume that the person you must explain
these things to will not be as familiar with the code you just modified as you
are right after writing the patch -- and that includes yourself in a year or
so. Be verbose in all the steps below.
The good commit log will start with the reason for writing the patch.
For example, if you use wmaker in some way and you expect that X happens but
you get Y, you should say that very clearly. Sometimes that's enough for other
more experienced people to know how to solve your issue. They will be able to
judge your patch better if they know what you wanted to do -- sometimes there
can be a better way to fix it.
Then you should explain why the wmaker source leads to Y and not to X.
Technicall stuff can be expected at this point, e.g. "upon doing xyz in function
foobar(), wmaker sets the variable foo to 'y' instead of setting it to 'x', and
that will lead to blabla happening in function foobar_squared()...".
And finally you explain how you fixed it.
"You have to set foo to 'x', because then when the function foobar_squared() is
called it will do X instead of Y because..."
At this point other people will have a clear understanding of what you did with
minimal effort. And that leads to better patch reviews.
Furthermore, the above reasons should also tell you that you must not do
more than one thing in the same patch. Again:
"Each patch must do one thing and one thing only."
If your patch does too much of unrelated stuff, it makes reviewing a nightmare
and long-term mantainance much worse (think about a patch which introduces a
regression in the middle of many other nice improvements, and now you have to
get rid of the regression without removing the improvements -- 'git revert'
will not help you here).
If you find yourself having troubles to write what you did in the commit
message, perhaps you did too much. In this case you should split your patch
into smaller unrelated pieces and produce a patch series. Unfortunately it's
more work for you, but it's much better for wmaker.
_____________________________________
Sending the patch to the mailing list
-------------------------------------
Send your patches to:
wmaker-dev@lists.windowmaker.org
Please do not send patches to any individual developer unless you have a very
good reason to avoid more people being able to comment (and improve) on your
patches.
Sending the patch _properly_ is not as trivial as you might think. Some mail
clients convert TABs to spaces or word wrap long lines automatically, which
will result in your patch being rejected as it will not apply with 'git apply'.
Ideally your patch should contain a very good commit message that explains
why you wrote the patch in the first place (see "Writing the commit log").
In this case you can simply send the file(s) created in the 'git format-patch'
step above as the sole content of your email to the mailing list. All your
reasons and explanations will be in the commit log, and your email will look
like:
**********************************
From: someone@someplace
Subject: [PATCH] Fix something
The commit message.
The diff itself.
**********************************
Read the file email-clients.txt in the topdir of the wmaker-crm repository
to be adviced on how to tweak your email client to avoid common pitfalls.
___________________
Example .gitconfig
-------------------
[user]
name = Erwin Schrodinger
email = schrodinger@gmail.com
[core]
editor = xjed
[status]
showUntrackedFiles = no
[color]
branch = auto
status = auto
diff = auto
ui = auto
[apply]
whitespace = fix

View File

@@ -1,4 +0,0 @@
Makefile Makefile.in
get-wings-flags get-wutil-flags
.libs *.pc
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,3 +1,21 @@
Changes since wmaker 0.92.0:
............................
- updated the XDND code in to work with GDK based applications.
WINGs based applications should now work with both KDE and GNOME
applications (Sylvain Reynal <sreynal@nerim.net>)
- better check for the XDND protocol version when interoperating with other
applications. As it seems xdnd version 3 (which WINGs supports) and newer
are not backward compatible with xdnd version 1 and 2. This is why WINGs
applications cannot interoperate with GNUstep applications (which uses
xdnd version 2). Xdnd version 4 and 5 are backwards compatible with
version 3 though. (Sylvain Reynal <sreynal@nerim.net>)
- removed dependency on rgb.txt from X11 and issues with locating it on the
filesystem for different systems/distributions.
- Removed dependency on rgb.txt (from X11) and issues with locating it on the
filesystem for different systems/distributions.
Changes since wmaker 0.80.1:
............................

View File

@@ -1,2 +0,0 @@
Makefile Makefile.in
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,6 +1,6 @@
## automake input file for WINGs - Documentation
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
EXTRA_DIST = README.connection
EXTRA_DIST =

View File

@@ -1,51 +0,0 @@
Methods of handling WMConnectionDidDieNotification notification events
(same for WMConnectionDidTimeoutNotification)
----------------------------------------------------------------------
Once your program got this notification (you need to install an observer for
it), there are some ways to handle it:
1. Make your observer enqueue a new notification in the ASAP queue, and the
observer for this new notification (it can be the same function if you
arrange to distinguish between the two cases), should remove the connection.
You can also close the connection before enqueuing the new notification to
the ASAP queue, but is not strictly necessarily, since it will be closed
when the observer for the new enqueued notification will be called and you
will call the close/remove function there. This is just to make sure your
connection will be silent, and won't generate new events until you reach
that point.
This is by far the best method, since it will assure you that if you
enqueue more than one notification to remove the same connection, they will
be coalesced, and called only once.
2. In your observer, put the died/closed connection in an array or bag, and
destroy all the connections present in the array/bag, in your main loop,
after you call the WHandleEvents()/WMHandleEvent(). Also closing the
connection can be done before putting the connection in the array/bag, but
is optional as noted above. In this case you need to make sure you don't
put in the array/bag the same connection more than once, in case the
DieNotification is sent more that once to you. This is automagically solved
by method 1.
3. In case it's your only connection, and you plan to exit if it was closed or
died, then you can safely close/remove it, and exit. As long as you no
longer access it, there is no problem.
4. Make you observer remove the connection. Then make sure that after that
point your code no longer tries to access that connection (this usually
means until your code gets back to the main loop). This is almost always
very hard to achive and subject to hidden errors. I do not recommend this
way of handling the died notification. It is ugly and very complicated to
handle if the program is in a very deeply nested function when it finds out
that the connection died. If you use it and get plenty of SIGSEGVs then you
know why. This method was not presented here to be used, but to show what
should be avoided in dealing with the died notification, in case someone
gets the idea to try it this way.
Note: read/write operations means to use our read/write functions (like
WMGetMessage()/WMSendMessage()), not the C library ones read()/write().
Note2: removing a connection is done by WMDestroyConnection(), while
WMCloseConnection() only closes the socket, and removed any pending
queues and timers on the connection.

View File

@@ -1,5 +0,0 @@
Makefile Makefile.in
connect server fontl puzzle UserTime.plist
colorpick
.libs
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,32 +1,40 @@
## automake input file for WINGs - Examples
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
noinst_PROGRAMS = connect server fontl puzzle colorpick
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@
colorpick_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
colorpick_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
puzzle_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
puzzle_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
connect_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
connect_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.la
connect_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
@NETLIBS@ @INTLIBS@
connect_LDADD = $(top_builddir)/WINGs/libWUtil.la @LIBRARY_SEARCH_PATH@ @INTLIBS@
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.la
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
@NETLIBS@ @INTLIBS@
server_LDADD = $(top_builddir)/WINGs/libWUtil.la @LIBRARY_SEARCH_PATH@ @INTLIBS@
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
LIBTOOL = $(QUIET) $(SHELL) $(top_builddir)/libtool $(LIBTOOL_ARG)
.c.o:
$(QUIET)$(COMPILE) -c $<
.c.obj:
$(QUIET)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
$(QUIET)$(LTCOMPILE) -c -o $@ $<

View File

@@ -3,40 +3,37 @@
#include <stdio.h>
#include <WINGs/WINGs.h>
void showSelectedColor(void *self, void *cdata)
{
WMColorPanel *panel= (WMColorPanel*)self;
WMColorPanel *panel = (WMColorPanel *) self;
printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
printf("Selected Color: %s\n", WMGetColorRGBDescription(WMGetColorPanelColor(panel)));
}
int main(int argc, char **argv)
{
Display *dpy;
WMScreen *scr;
Display *dpy;
WMScreen *scr;
WMInitializeApplication("wmcolorpick", &argc, argv);
WMInitializeApplication("wmcolorpick", &argc, argv);
dpy = XOpenDisplay("");
if (!dpy) {
printf("could not open display\n");
exit(1);
}
dpy = XOpenDisplay("");
if (!dpy) {
printf("could not open display\n");
exit(1);
}
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
{
WMColorPanel *panel= WMGetColorPanel(scr);
{
WMColorPanel *panel = WMGetColorPanel(scr);
WMSetColorPanelAction(panel, showSelectedColor, NULL);
WMSetColorPanelAction(panel, showSelectedColor, NULL);
WMShowColorPanel(panel);
}
WMShowColorPanel(panel);
}
WMScreenMainLoop(scr);
WMScreenMainLoop(scr);
return 0;
return 0;
}

View File

@@ -1,198 +0,0 @@
/*
* WINGs connect.c: example how to create a network client using WMConnection
*
* Copyright (c) 1999-2003 Dan Pascu
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <WINGs/WINGs.h>
static int initialized = 0;
static void didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr);
static void connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr);
static void didInitialize(ConnectionDelegate *self, WMConnection *cPtr);
static ConnectionDelegate socketDelegate = {
NULL, /* data */
NULL, /* canResumeSending */
NULL, /* didCatchException */
connectionDidDie, /* didDie */
didInitialize, /* didInitialize */
didReceiveInput, /* didReceiveInput */
NULL /* didTimeout */
};
void
wAbort(Bool foo)
{
exit(1);
}
static char*
getMessage(WMConnection *cPtr)
{
char *buffer;
WMData *aData;
int length;
aData = WMGetConnectionAvailableData(cPtr);
if (!aData)
return NULL;
if ((length=WMGetDataLength(aData))==0) {
WMReleaseData(aData);
return NULL;
}
buffer = (char*)wmalloc(length+1);
WMGetDataBytes(aData, buffer);
buffer[length]= '\0';
WMReleaseData(aData);
return buffer;
}
static void
inputHandler(int fd, int mask, void *clientData)
{
WMConnection *cPtr = (WMConnection*)clientData;
WMData *aData;
char buf[4096];
int n;
if (!initialized)
return;
n = read(fd, buf, 4096);
if (n>0) {
aData = WMCreateDataWithBytes(buf, n);
WMSendConnectionData(cPtr, aData);
WMReleaseData(aData);
}
}
static void
didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr)
{
char *buffer;
buffer = getMessage(cPtr);
if (!buffer) {
fprintf(stderr, "Connection closed by peer.\n");
exit(0);
}
printf("%s", buffer);
wfree(buffer);
}
static void
connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr)
{
WMCloseConnection(cPtr);
fprintf(stderr, "Connection closed by peer.\n");
exit(0);
}
static void
didInitialize(ConnectionDelegate *self, WMConnection *cPtr)
{
int state = WMGetConnectionState(cPtr);
WMHost *host;
if (state == WCConnected) {
host = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
fprintf(stderr, "connected to '%s:%s'\n",
host?WMGetHostName(host):WMGetConnectionAddress(cPtr),
WMGetConnectionService(cPtr));
initialized = 1;
if (host)
WMReleaseHost(host);
return;
} else {
wsyserrorwithcode(WCErrorCode, "Unable to connect");
exit(1);
}
}
int
main(int argc, char **argv)
{
char *ProgName, *host, *port;
int i;
WMConnection *sPtr;
wsetabort(wAbort);
WMInitializeApplication("connect", &argc, argv);
ProgName = strrchr(argv[0],'/');
if (!ProgName)
ProgName = argv[0];
else
ProgName++;
host = NULL;
port = "34567";
if (argc>1) {
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "--help")==0 || strcmp(argv[i], "-h")==0) {
printf("usage: %s [host [port]]\n\n", ProgName);
exit(0);
} else {
if (!host)
host = argv[i];
else
port = argv[i];
}
}
}
printf("Trying to make connection to '%s:%s'\n",
host?host:"localhost", port);
sPtr = WMCreateConnectionToAddressAndNotify(host, port, NULL);
if (!sPtr) {
wfatal("could not create connection. exiting");
exit(1);
}
WMSetConnectionDelegate(sPtr, &socketDelegate);
/* watch what user types and send it over the connection */
WMAddInputHandler(0, WIReadMask, inputHandler, sPtr);
while (1) {
WHandleEvents();
}
return 0;
}

View File

@@ -13,92 +13,85 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <WINGs/WINGs.h>
#include <WINGs/WUtil.h>
void
wAbort()
void wAbort()
{
exit(0);
exit(0);
}
void show(WMWidget *self, void *data)
void show(WMWidget * self, void *data)
{
char buf[60];
void *d;
WMLabel *l = (WMLabel*)data;
d = WMGetHangedData(self);
sprintf(buf, "%i - 0x%x - 0%o", (int)d, (int)d, (int)d);
WMSetLabelText(l, buf);
char buf[60];
void *d;
WMLabel *l = (WMLabel *) data;
d = WMGetHangedData(self);
sprintf(buf, "%i - 0x%x - 0%o", (int)d, (int)d, (int)d);
WMSetLabelText(l, buf);
}
void quit(WMWidget *self, void *data)
void quit(WMWidget * self, void *data)
{
exit(0);
exit(0);
}
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
Display *dpy;
WMWindow *win;
WMScreen *scr;
WMButton *lab, *l0=NULL;
WMLabel *pos;
int x, y, c;
char buf[20];
Display *dpy;
WMWindow *win;
WMScreen *scr;
WMButton *lab, *l0 = NULL;
WMLabel *pos;
int x, y, c;
char buf[20];
WMInitializeApplication("FontView", &argc, argv);
WMInitializeApplication("FontView", &argc, argv);
dpy = XOpenDisplay("");
if (!dpy) {
wfatal("cant open display");
exit(0);
}
dpy = XOpenDisplay("");
if (!dpy) {
wfatal("cant open display");
exit(0);
}
scr = WMCreateSimpleApplicationScreen(dpy);
scr = WMCreateSimpleApplicationScreen(dpy);
win = WMCreateWindow(scr, "main");
WMResizeWidget(win, 20*33, 20+20*9);
WMSetWindowTitle(win, "Font Chars");
WMSetWindowCloseAction(win, quit, NULL);
pos = WMCreateLabel(win);
WMResizeWidget(pos, 20*33, 20);
WMMoveWidget(pos, 10, 5);
win = WMCreateWindow(scr, "main");
WMResizeWidget(win, 20 * 33, 20 + 20 * 9);
WMSetWindowTitle(win, "Font Chars");
WMSetWindowCloseAction(win, quit, NULL);
pos = WMCreateLabel(win);
WMResizeWidget(pos, 20 * 33, 20);
WMMoveWidget(pos, 10, 5);
c = 0;
for (y=0; y<8; y++) {
for (x=0; x<32; x++, c++) {
lab = WMCreateCustomButton(win, WBBStateLightMask);
WMResizeWidget(lab, 20, 20);
WMMoveWidget(lab, 10+x*20, 30+y*20);
sprintf(buf, "%c", c);
WMSetButtonText(lab, buf);
WMSetButtonAction(lab, show, pos);
WMHangData(lab, (void*)c);
if (c>0) {
WMGroupButtons(l0, lab);
} else {
l0 = lab;
}
}
}
WMRealizeWidget(win);
WMMapSubwidgets(win);
WMMapWidget(win);
WMScreenMainLoop(scr);
return 0;
c = 0;
for (y = 0; y < 8; y++) {
for (x = 0; x < 32; x++, c++) {
lab = WMCreateCustomButton(win, WBBStateLightMask);
WMResizeWidget(lab, 20, 20);
WMMoveWidget(lab, 10 + x * 20, 30 + y * 20);
sprintf(buf, "%c", c);
WMSetButtonText(lab, buf);
WMSetButtonAction(lab, show, pos);
WMHangData(lab, (void *)(uintptr_t) c);
if (c > 0) {
WMGroupButtons(l0, lab);
} else {
l0 = lab;
}
}
}
WMRealizeWidget(win);
WMMapSubwidgets(win);
WMMapWidget(win);
WMScreenMainLoop(scr);
return 0;
}

View File

@@ -1,18 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <WINGs/WINGs.h>
#include <stdint.h>
#define MAX_SIZE 10*10
WMWindow *win;
WMButton *Button[MAX_SIZE];
char Map[MAX_SIZE];
signed char Map[MAX_SIZE];
int Size = 4;
int MoveCount;
@@ -20,226 +16,218 @@ int MoveCount;
int WinSize = 120;
Bool
CheckWin(void)
Bool CheckWin(void)
{
int i;
int i;
for (i = 0; i < Size*Size-1; i++) {
if (Map[i] != i)
return False;
}
for (i = 0; i < Size * Size - 1; i++) {
if (Map[i] != i)
return False;
}
return True;
return True;
}
void
MoveButton(int button, int x, int y)
void MoveButton(int button, int x, int y)
{
WMMoveWidget(Button[button], x*(WinSize/Size), y*(WinSize/Size));
WMMoveWidget(Button[button], x * (WinSize / Size), y * (WinSize / Size));
}
Bool
SlideButton(int button)
Bool SlideButton(int button)
{
int x=0, y=0, done = 0;
int x = 0, y = 0, done = 0;
/* locate the button */
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x,y) == button) {
done = 1;
break;
}
}
if (done)
break;
}
/* locate the button */
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x, y) == button) {
done = 1;
break;
}
}
if (done)
break;
}
if (x > 0 && MAP(x-1, y) < 0) {
MAP(x,y) = -1;
MoveButton(button, x-1, y);
MAP(x-1,y) = button;
} else if (x < Size-1 && MAP(x+1, y) < 0) {
MAP(x,y) = -1;
MoveButton(button, x+1, y);
MAP(x+1,y) = button;
} else if (y > 0 && MAP(x, y-1) < 0) {
MAP(x,y) = -1;
MoveButton(button, x, y-1);
MAP(x,y-1) = button;
} else if (y < Size-1 && MAP(x, y+1) < 0) {
MAP(x,y) = -1;
MoveButton(button, x, y+1);
MAP(x,y+1) = button;
} else {
return False;
}
return True;
if (x > 0 && MAP(x - 1, y) < 0) {
MAP(x, y) = -1;
MoveButton(button, x - 1, y);
MAP(x - 1, y) = button;
} else if (x < Size - 1 && MAP(x + 1, y) < 0) {
MAP(x, y) = -1;
MoveButton(button, x + 1, y);
MAP(x + 1, y) = button;
} else if (y > 0 && MAP(x, y - 1) < 0) {
MAP(x, y) = -1;
MoveButton(button, x, y - 1);
MAP(x, y - 1) = button;
} else if (y < Size - 1 && MAP(x, y + 1) < 0) {
MAP(x, y) = -1;
MoveButton(button, x, y + 1);
MAP(x, y + 1) = button;
} else {
return False;
}
return True;
}
#define SWAP(a,b) {int tmp; tmp=a; a=b; b=tmp;}
void ResetGame(void)
{
int i, x, y, ox, oy;
int i, x, y, ox, oy;
MoveCount = 0;
MoveCount = 0;
for (i = 0; i < Size * Size - 1; i++) {
Map[i] = i;
}
Map[i] = -1;
ox = x = Size - 1;
oy = y = Size - 1;
for (i = 0; i < 1000; i++) {
int ok;
ok = 1;
switch (rand() % 4) {
case 0:
if (x > 0)
x--;
else
ok = 0;
break;
case 2:
if (x < Size - 1)
x++;
else
ok = 0;
break;
case 1:
if (y > 0)
y--;
else
ok = 0;
break;
case 3:
if (y < Size - 1)
y++;
else
ok = 0;
break;
}
if (ok) {
MoveButton(MAP(x, y), ox, oy);
for (i = 0; i < Size*Size-1; i++) {
Map[i] = i;
}
Map[i] = -1;
ox = x = Size-1;
oy = y = Size-1;
for (i = 0; i < 1000; i++) {
int ok;
ok = 1;
switch (rand()%4) {
case 0:
if (x > 0) x--; else ok = 0;
break;
case 2:
if (x < Size-1) x++; else ok = 0;
break;
case 1:
if (y > 0) y--; else ok = 0;
break;
case 3:
if (y < Size-1) y++; else ok = 0;
break;
}
if (ok) {
MoveButton(MAP(x,y), ox, oy);
SWAP(MAP(ox, oy), MAP(x, y));
SWAP(MAP(ox, oy), MAP(x, y));
while (XPending(WMScreenDisplay(WMWidgetScreen(win)))) {
XEvent ev;
WMNextEvent(WMScreenDisplay(WMWidgetScreen(win)), &ev);
WMHandleEvent(&ev);
}
ox = x;
oy = y;
}
}
while (XPending(WMScreenDisplay(WMWidgetScreen(win)))) {
XEvent ev;
WMNextEvent(WMScreenDisplay(WMWidgetScreen(win)), &ev);
WMHandleEvent(&ev);
}
ox = x;
oy = y;
}
}
}
void buttonClick(WMWidget *w, void *ptr)
void buttonClick(WMWidget * w, void *ptr)
{
char buffer[300];
char buffer[300];
if (SlideButton((int)ptr)) {
MoveCount++;
if (SlideButton((uintptr_t)ptr)) {
MoveCount++;
if (CheckWin()) {
sprintf(buffer, "You finished the game in %i moves.", MoveCount);
if (CheckWin()) {
sprintf(buffer, "You finished the game in %i moves.", MoveCount);
if (WMRunAlertPanel(WMWidgetScreen(w), win, "You Won!", buffer,
"Wee!", "Gah! Lemme retry!", NULL) == WAPRDefault) {
exit(0);
}
if (WMRunAlertPanel(WMWidgetScreen(w), win, "You Won!", buffer,
"Wee!", "Gah! Lemme retry!", NULL) == WAPRDefault) {
exit(0);
}
ResetGame();
}
}
ResetGame();
}
}
}
static void resizeObserver(void *self, WMNotification *notif)
static void resizeObserver(void *self, WMNotification * notif)
{
WMSize size = WMGetViewSize(WMWidgetView(win));
int x, y;
WMSize size = WMGetViewSize(WMWidgetView(win));
int x, y;
WinSize = size.width;
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x,y) >= 0) {
WMResizeWidget(Button[(int)MAP(x,y)],
WinSize/Size, WinSize/Size);
WMMoveWidget(Button[(int)MAP(x,y)],
x*(WinSize/Size), y*(WinSize/Size));
}
}
}
WinSize = size.width;
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x, y) >= 0) {
WMResizeWidget(Button[(int)MAP(x, y)], WinSize / Size, WinSize / Size);
WMMoveWidget(Button[(int)MAP(x, y)], x * (WinSize / Size), y * (WinSize / Size));
}
}
}
}
int main(int argc, char **argv)
{
Display *dpy;
WMScreen *scr;
int x, y, i;
Display *dpy;
WMScreen *scr;
int x, y, i;
WMInitializeApplication("Puzzle", &argc, argv);
WMInitializeApplication("Puzzle", &argc, argv);
dpy = XOpenDisplay("");
if (!dpy) {
printf("could not open display\n");
exit(1);
}
dpy = XOpenDisplay("");
if (!dpy) {
printf("could not open display\n");
exit(1);
}
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
win = WMCreateWindow(scr, "puzzle");
WMResizeWidget(win, WinSize, WinSize);
WMSetWindowTitle(win, "zuPzel");
WMSetWindowMinSize(win, 80, 80);
WMSetWindowAspectRatio(win, 2, 2, 2, 2);
WMSetWindowResizeIncrements(win, Size, Size);
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
WMAddNotificationObserver(resizeObserver, NULL, WMViewSizeDidChangeNotification, WMWidgetView(win));
win = WMCreateWindow(scr, "puzzle");
WMResizeWidget(win, WinSize, WinSize);
WMSetWindowTitle(win, "zuPzel");
WMSetWindowMinSize(win, 80, 80);
WMSetWindowAspectRatio(win, 2, 2, 2, 2);
WMSetWindowResizeIncrements(win, Size, Size);
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
WMAddNotificationObserver(resizeObserver, NULL,
WMViewSizeDidChangeNotification,
WMWidgetView(win));
for (i = y = 0; y < Size && i < Size * Size - 1; y++) {
for (x = 0; x < Size && i < Size * Size - 1; x++) {
char buf[32];
WMColor *color;
RColor col;
RHSVColor hsv;
hsv.hue = i * 360 / (Size * Size - 1);
hsv.saturation = 120;
hsv.value = 200;
RHSVtoRGB(&hsv, &col);
for (i = y = 0; y < Size && i < Size*Size-1; y++) {
for (x = 0; x < Size && i < Size*Size-1; x++) {
char buf[32];
WMColor *color;
RColor col;
RHSVColor hsv;
color = WMCreateRGBColor(scr, col.red << 8, col.green << 8, col.blue << 8, False);
hsv.hue = i*360/(Size*Size-1);
hsv.saturation = 120;
hsv.value = 200;
MAP(x, y) = i;
Button[i] = WMCreateButton(win, WBTMomentaryLight);
WMSetWidgetBackgroundColor(Button[i], color);
WMReleaseColor(color);
WMSetButtonAction(Button[i], buttonClick, (void *)(uintptr_t) i);
WMResizeWidget(Button[i], WinSize / Size, WinSize / Size);
WMMoveWidget(Button[i], x * (WinSize / Size), y * (WinSize / Size));
sprintf(buf, "%i", i + 1);
WMSetButtonText(Button[i], buf);
WMSetButtonTextAlignment(Button[i], WACenter);
i++;
}
}
RHSVtoRGB(&hsv, &col);
WMMapSubwidgets(win);
WMMapWidget(win);
WMRealizeWidget(win);
color = WMCreateRGBColor(scr, col.red<<8, col.green<<8,
col.blue<<8, False);
ResetGame();
MAP(x,y) = i;
Button[i] = WMCreateButton(win, WBTMomentaryLight);
WMSetWidgetBackgroundColor(Button[i], color);
WMReleaseColor(color);
WMSetButtonAction(Button[i], buttonClick, (void*)i);
WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
sprintf(buf, "%i", i+1);
WMSetButtonText(Button[i], buf);
WMSetButtonTextAlignment(Button[i], WACenter);
i++;
}
}
WMScreenMainLoop(scr);
WMMapSubwidgets(win);
WMMapWidget(win);
WMRealizeWidget(win);
ResetGame();
WMScreenMainLoop(scr);
return 0;
return 0;
}

View File

@@ -1,740 +0,0 @@
/*
* WINGs server.c: example how to create a network server using WMConnection
*
* Copyright (c) 2001-2003 Dan Pascu
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <WINGs/WINGs.h>
#define _(P) P
#define MAXCMD_SIZE 512
char *SEConnectionShouldBeRemovedNotification = "SEConnectionShouldBeRemovedNotification";
static void didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr);
static void connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr);
static void connectionDidTimeout(ConnectionDelegate *self, WMConnection *cPtr);
extern char *SEConnectionShouldBeRemovedNotification;
static WMUserDefaults *timeDB = NULL;
static char *ServerAddress = NULL;
static char *ServerPort = NULL;
static WMArray *allowedHostList = NULL;
static WMArray *clientConnections = NULL;
static WMConnection *serverPtr = NULL;
static ConnectionDelegate socketDelegate = {
NULL, /* client data */
NULL, /* canResumeSending */
NULL, /* didCatchException */
connectionDidDie, /* didDie */
NULL, /* didInitialize */
didReceiveInput, /* didReceiveInput */
connectionDidTimeout /* didTimeout */
};
void
wAbort(Bool foo)
{
exit(1);
}
static void
printHelp(char *progname)
{
printf(_("usage: %s [options]\n\n"), progname);
puts(_(" --help print this message"));
puts(_(" --listen [address:]port only listen on the specified address/port"));
puts(_(" --allow host1[,host2...] only allow connections from listed hosts\n"));
puts(_(" By default server listens on all interfaces and port 34567, unless"
" something\nelse is specified with the --listen option. If address is"
" omitted or the keyword\n'Any' is used, it will listen on all interfaces else"
" only on the specified one.\n\nFor example --listen localhost: will"
" listen on the default port 34567, but only\non connections comming"
" in through the loopback interface.\n\n Also by default the server"
" listens to incoming connections from any host,\nunless a list of"
" hosts is given with the --allow option, in which case it will\nreject"
" connections not comming from those hosts.\nThe list of hosts is comma"
" separated and should NOT contain ANY spaces."));
}
static void
enqueueConnectionForRemoval(WMConnection *cPtr)
{
WMNotification *notif;
/*don't release notif here. it will be released by queue after processing */
notif = WMCreateNotification(SEConnectionShouldBeRemovedNotification,
cPtr, NULL);
WMEnqueueNotification(WMGetDefaultNotificationQueue(), notif, WMPostASAP);
}
static int
sendMessage(WMConnection *cPtr, char *message)
{
WMData *aData;
int res;
if (WMGetConnectionState(cPtr)!=WCConnected)
return -1;
aData = WMCreateDataWithBytes(message, strlen(message));
res = WMSendConnectionData(cPtr, aData);
WMReleaseData(aData);
return res;
}
static Bool
enqueueMessage(WMConnection *cPtr, char *message)
{
WMData *aData;
Bool res;
if (WMGetConnectionState(cPtr)!=WCConnected)
return False;
aData = WMCreateDataWithBytes(message, strlen(message));
res = WMEnqueueConnectionData(cPtr, aData);
WMReleaseData(aData);
return res;
}
static unsigned char*
findDelimiter(unsigned char *data, unsigned const char *endPtr)
{
wassertrv(data < endPtr, NULL);
while (data<endPtr && *data!='\n' && *data!='\r' && *data!=';' && *data!='\0')
data++;
if (data < endPtr)
return data;
return NULL;
}
static WMArray*
getAvailableMessages(WMConnection *cPtr)
{
char *ptr, *crtPos, *buffer;
const char *bytes, *endPtr;
WMData *aData, *receivedData, *holdData;
WMRange range;
WMArray *messages;
int length;
receivedData = WMGetConnectionAvailableData(cPtr);
if (!receivedData)
return NULL;
if ((length=WMGetDataLength(receivedData))==0) {
WMReleaseData(receivedData);
return NULL;
}
holdData = (WMData*)WMGetConnectionClientData(cPtr);
if (holdData) {
WMAppendData(holdData, receivedData);
WMReleaseData(receivedData);
WMSetConnectionClientData(cPtr, NULL);
aData = holdData;
} else {
aData = receivedData;
}
length = WMGetDataLength(aData);
bytes = (char*)WMDataBytes(aData);
endPtr = bytes + length;
messages = WMCreateArrayWithDestructor(1, wfree);
crtPos = (char*)bytes;
while (crtPos<endPtr && (ptr = findDelimiter(crtPos, endPtr))!=NULL) {
range.position = (crtPos - bytes);
range.count = (ptr - crtPos);
if (range.count > MAXCMD_SIZE) {
/* Hmmm... The message is too long. Possibly that someone is
* flooding us, or there is a dumb client which do not know
* who is talking to. */
sendMessage(cPtr, "Command too long\n\r");
WMFreeArray(messages);
WMReleaseData(aData);
WMCloseConnection(cPtr);
enqueueConnectionForRemoval(cPtr);
return NULL;
}
buffer = wmalloc(range.count+1);
WMGetDataBytesWithRange(aData, buffer, range);
buffer[range.count] = '\0';
WMAddToArray(messages, buffer);
crtPos = ptr;
while (crtPos<endPtr && (*crtPos=='\n' || *crtPos=='\r' ||
*crtPos=='\t' || *crtPos=='\0' ||
*crtPos==';' || *crtPos==' ')) {
crtPos++;
}
}
if (crtPos<endPtr) {
range.position = (crtPos - bytes);
range.count = (endPtr - crtPos);
if (range.count > MAXCMD_SIZE) {
/* Flooooooding!!!! */
sendMessage(cPtr, "Message too long\n\r");
WMFreeArray(messages);
WMReleaseData(aData);
WMCloseConnection(cPtr);
enqueueConnectionForRemoval(cPtr);
return NULL;
}
holdData = WMGetSubdataWithRange(aData, range);
WMSetConnectionClientData(cPtr, holdData);
}
WMReleaseData(aData);
if (WMGetArrayItemCount(messages)==0) {
WMFreeArray(messages);
messages = NULL;
}
return messages;
}
static void
complainAboutBadArgs(WMConnection *cPtr, char *cmdName, char *badArgs)
{
char *buf = wmalloc(strlen(cmdName) + strlen(badArgs) + 100);
sprintf(buf, _("Invalid parameters '%s' for command %s. Use HELP for"
" a list of commands.\n"), badArgs, cmdName);
sendMessage(cPtr, buf);
wfree(buf);
}
static void
sendUpdateMessage(WMConnection *cPtr, char *id, int time)
{
char *buf = wmalloc(strlen(id) + 100);
sprintf(buf, "%s has %i minutes left\n", id, time);
sendMessage(cPtr, buf);
wfree(buf);
}
static void
showId(WMConnection *cPtr)
{
sendMessage(cPtr, "Server example based on WMConnection\n");
}
static void
showHelp(WMConnection *cPtr)
{
char *buf = wmalloc(strlen(WMGetApplicationName()) + 16);
sprintf(buf, _("%s commands:\n\n"), WMGetApplicationName());
enqueueMessage(cPtr, _("\n"));
enqueueMessage(cPtr, buf);
enqueueMessage(cPtr, _("GET <id>\t- return time left (in minutes) "
"for user with id <id>\n"));
enqueueMessage(cPtr, _("SET <id> <time>\t- set time limit to <time> "
"minutes for user with id <id>\n"));
enqueueMessage(cPtr, _("ADD <id> <time>\t- add <time> minutes "
"for user with id <id>\n"));
enqueueMessage(cPtr, _("SUB <id> <time>\t- subtract <time> minutes "
"for user with id <id>\n"));
enqueueMessage(cPtr, _("REMOVE <id>\t- remove time limitations for "
"user with id <id>\n"));
enqueueMessage(cPtr, _("LIST\t\t- list all users and their "
"corresponding time limit\n"));
enqueueMessage(cPtr, _("ID\t\t- returns the Time Manager "
"identification string\n"));
enqueueMessage(cPtr, _("EXIT\t\t- exits session\n"));
enqueueMessage(cPtr, _("QUIT\t\t- exits session\n"));
enqueueMessage(cPtr, _("HELP\t\t- show this message\n\n"));
/* Just flush the queue we made before */
WMFlushConnection(cPtr);
wfree(buf);
}
static void
listUsers(WMConnection *cPtr)
{
WMPropList *userList;
char *id;
int i, time;
userList = WMGetUDKeys(timeDB);
for (i=0; i<WMGetPropListItemCount(userList); i++) {
id = WMGetFromPLString(WMGetFromPLArray(userList, i));
time = WMGetUDIntegerForKey(timeDB, id);
sendUpdateMessage(cPtr, id, time);
}
WMReleasePropList(userList);
}
static void
setTimeForUser(WMConnection *cPtr, char *cmdArgs)
{
char *id;
int i, time;
id = wmalloc(strlen(cmdArgs));
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
complainAboutBadArgs(cPtr, "SET", cmdArgs);
wfree(id);
return;
}
if (time<0)
time = 0;
WMSetUDIntegerForKey(timeDB, time, id);
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
cPtr = WMGetFromArray(clientConnections, i);
sendUpdateMessage(cPtr, id, time);
}
wfree(id);
}
static void
addTimeToUser(WMConnection *cPtr, char *cmdArgs)
{
char *id;
int i, time, newTime;
id = wmalloc(strlen(cmdArgs));
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
complainAboutBadArgs(cPtr, "ADD", cmdArgs);
wfree(id);
return;
}
newTime = WMGetUDIntegerForKey(timeDB, id) + time;
if (newTime<0)
newTime = 0;
WMSetUDIntegerForKey(timeDB, newTime, id);
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
cPtr = WMGetFromArray(clientConnections, i);
sendUpdateMessage(cPtr, id, newTime);
}
wfree(id);
}
static void
subTimeFromUser(WMConnection *cPtr, char *cmdArgs)
{
char *id;
int i, time, newTime;
id = wmalloc(strlen(cmdArgs));
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
complainAboutBadArgs(cPtr, "SUB", cmdArgs);
wfree(id);
return;
}
newTime = WMGetUDIntegerForKey(timeDB, id) - time;
if (newTime<0)
newTime = 0;
WMSetUDIntegerForKey(timeDB, newTime, id);
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
cPtr = WMGetFromArray(clientConnections, i);
sendUpdateMessage(cPtr, id, newTime);
}
wfree(id);
}
static void
removeTimeForUser(WMConnection *cPtr, char *cmdArgs)
{
char *ptr;
int i;
if (cmdArgs[0]=='\0') {
sendMessage(cPtr, _("Missing parameter for command REMOVE."
" Use HELP for a list of commands.\n"));
return;
}
ptr = cmdArgs;
while (*ptr && *ptr!=' ' && *ptr!='\t')
ptr++;
*ptr = '\0';
WMRemoveUDObjectForKey(timeDB, cmdArgs);
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
cPtr = WMGetFromArray(clientConnections, i);
sendUpdateMessage(cPtr, cmdArgs, -1);
}
}
static void
getTimeForUser(WMConnection *cPtr, char *cmdArgs)
{
char *ptr;
int time;
if (cmdArgs[0]=='\0') {
sendMessage(cPtr, _("Missing parameter for command GET."
" Use HELP for a list of commands.\n"));
return;
}
ptr = cmdArgs;
while (*ptr && *ptr!=' ' && *ptr!='\t')
ptr++;
*ptr = '\0';
if (WMGetUDObjectForKey(timeDB, cmdArgs)!=NULL)
time = WMGetUDIntegerForKey(timeDB, cmdArgs);
else
time = -1;
sendUpdateMessage(cPtr, cmdArgs, time);
}
static void
handleConnection(WMConnection *cPtr)
{
char *command, *ptr, *cmdArgs, *buffer;
WMArray *commands;
int i;
commands = getAvailableMessages(cPtr);
if (!commands)
return;
for (i=0; i<WMGetArrayItemCount(commands); i++) {
command = WMGetFromArray(commands, i);
while (*command && (*command==' ' || *command=='\t'))
command++;
ptr = command;
while(*ptr && *ptr!=' ' && *ptr!='\t')
ptr++;
if (*ptr) {
*ptr = '\0';
ptr++;
}
while (*ptr && (*ptr==' ' || *ptr=='\t'))
ptr++;
cmdArgs = ptr;
fprintf(stderr, "Command: '%s', args: '%s'\n", command, cmdArgs);
if (strcasecmp(command, "quit")==0 || strcasecmp(command, "exit")==0) {
sendMessage(cPtr, "Bye\n");
WMCloseConnection(cPtr);
enqueueConnectionForRemoval(cPtr);
WMFreeArray(commands);
return;
} else if (strcasecmp(command, "id")==0) {
showId(cPtr);
} else if (strcasecmp(command, "help")==0) {
showHelp(cPtr);
} else if (strcasecmp(command, "list")==0) {
listUsers(cPtr);
} else if (strcasecmp(command, "set")==0) {
setTimeForUser(cPtr, cmdArgs);
} else if (strcasecmp(command, "add")==0) {
addTimeToUser(cPtr, cmdArgs);
} else if (strcasecmp(command, "sub")==0) {
subTimeFromUser(cPtr, cmdArgs);
} else if (strcasecmp(command, "remove")==0) {
removeTimeForUser(cPtr, cmdArgs);
} else if (strcasecmp(command, "get")==0) {
getTimeForUser(cPtr, cmdArgs);
} else {
buffer = wmalloc(strlen(command) + 100);
sprintf(buffer, _("Unknown command '%s'. Try HELP for"
" a list of commands.\n"), command);
sendMessage(cPtr, buffer);
wfree(buffer);
}
}
WMFreeArray(commands);
}
static Bool
isAllowedToConnect(WMConnection *cPtr)
{
WMHost *hPtr;
int i;
if (allowedHostList == NULL)
return True; /* No list. Allow all by default */
hPtr = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
for (i=0; i<WMGetArrayItemCount(allowedHostList); i++) {
if (WMIsHostEqualToHost(hPtr, WMGetFromArray(allowedHostList, i))) {
WMReleaseHost(hPtr);
return True;
}
}
WMReleaseHost(hPtr);
return False;
}
static void
didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr)
{
if (cPtr == serverPtr) {
WMConnection *newPtr = WMAcceptConnection(cPtr);
if (newPtr) {
if (isAllowedToConnect(newPtr)) {
WMSetConnectionDelegate(newPtr, &socketDelegate);
WMSetConnectionSendTimeout(newPtr, 120);
WMAddToArray(clientConnections, newPtr);
} else {
sendMessage(newPtr, "Sorry, you are not allowed to connect.\n");
WMDestroyConnection(newPtr);
}
}
} else {
/* Data arriving on an already-connected socket */
handleConnection(cPtr);
}
}
static void
connectionDidTimeout(ConnectionDelegate *self, WMConnection *cPtr)
{
WMHost *hPtr;
if (cPtr == serverPtr) {
wfatal(_("The server listening socket did timeout. Exiting."));
exit(1);
}
hPtr = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
wwarning(_("Connection with %s did timeout. Closing connection."),
WMGetHostName(hPtr));
WMReleaseHost(hPtr);
enqueueConnectionForRemoval(cPtr);
}
static void
connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr)
{
if (cPtr == serverPtr) {
/* trouble. server listening port itself died!!! */
wfatal(_("The server listening socket died. Exiting."));
exit(1);
}
enqueueConnectionForRemoval(cPtr);
}
static void
removeConnection(void *observer, WMNotification *notification)
{
WMConnection *cPtr = (WMConnection*)WMGetNotificationObject(notification);
WMData *data;
WMRemoveFromArray(clientConnections, cPtr);
if ((data = (WMData*)WMGetConnectionClientData(cPtr))!=NULL)
WMReleaseData(data);
WMDestroyConnection(cPtr);
}
static void
updatedDomain(void *observer, WMNotification *notification)
{
wmessage("defaults domain file changed on disk. synchronizing.");
}
#if 0
static Bool
isDifferent(char *str1, char *str2)
{
if ((!str1 && !str2) || (str1 && str2 && strcmp(str1, str2)==0))
return False;
return True;
}
#endif
int
main(int argc, char **argv)
{
int i;
wsetabort(wAbort);
WMInitializeApplication("server", &argc, argv);
if (argc>1) {
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "--help")==0) {
printHelp(argv[0]);
exit(0);
} else if (strcmp(argv[i], "--listen")==0) {
char *p;
if ((p = strchr(argv[++i], ':')) != NULL) {
*p = 0;
ServerAddress = wstrdup(argv[i]);
ServerPort = wstrdup(p+1);
*p = ':';
if (ServerAddress[0] == 0) {
wfree(ServerAddress);
ServerAddress = NULL;
}
if (ServerPort[0] == 0) {
wfree(ServerPort);
ServerPort = "34567";
}
} else if (argv[i][0]!=0) {
ServerPort = argv[i];
}
} else if (strcmp(argv[i], "--allow")==0) {
char *p, *ptr;
int done;
WMHost *hPtr;
ptr = argv[++i];
done = 0;
while (!done) {
if ((p = strchr(ptr, ',')) != NULL) {
*p = 0;
}
if (*ptr != 0) {
hPtr = WMGetHostWithName(ptr);
if (hPtr) {
if (!allowedHostList)
allowedHostList = WMCreateArray(4);
WMAddToArray(allowedHostList, hPtr);
} else {
wwarning(_("Unknown host '%s'. Ignored."), ptr);
}
}
if (p!=NULL) {
*p = ',';
ptr = p+1;
} else {
done = 1;
}
}
} else {
printf(_("%s: invalid argument '%s'\n"), argv[0], argv[i]);
printf(_("Try '%s --help' for more information\n"), argv[0]);
exit(1);
}
}
}
timeDB = WMGetDefaultsFromPath("./UserTime.plist");
WMAddNotificationObserver(updatedDomain, NULL,
WMUserDefaultsDidChangeNotification, NULL);
clientConnections = WMCreateArray(4);
/* A NULL ServerAddress means to listen on any address the host has.
* Else if ServerAddress points to a specific address (like "localhost",
* "host.domain.com" or "192.168.1.1"), then it will only listen on that
* interface and ignore incoming connections on the others. */
if (ServerAddress && strcasecmp(ServerAddress, "Any")==0)
ServerAddress = NULL;
if (ServerPort==NULL)
ServerPort = "34567";
printf("Server will listen on '%s:%s'\n", ServerAddress?ServerAddress:"Any",
ServerPort);
printf("This server will allow connections from:");
if (allowedHostList) {
int i;
char *hName;
for (i=0; i<WMGetArrayItemCount(allowedHostList); i++) {
hName = WMGetHostName(WMGetFromArray(allowedHostList, i));
printf("%s'%s'", i==0?" ":", ", hName);
}
printf(".\n");
} else {
printf(" any host.\n");
}
serverPtr = WMCreateConnectionAsServerAtAddress(ServerAddress, ServerPort,
NULL);
if (!serverPtr) {
wfatal("could not create server on `%s:%s`. Exiting.",
ServerAddress ? ServerAddress : "localhost", ServerPort);
exit(1);
}
WMSetConnectionDelegate(serverPtr, &socketDelegate);
WMAddNotificationObserver(removeConnection, NULL,
SEConnectionShouldBeRemovedNotification, NULL);
while (1) {
/* The ASAP notification queue is called at the end of WHandleEvents()
* There's where died connections we get while running through
* WHandleEvents() get removed. */
WHandleEvents();
}
return 0;
}

View File

@@ -1,4 +0,0 @@
Makefile Makefile.in
.libs
test
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,8 +1,6 @@
## automake input file for WINGs
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
# is this a kluge? if so, how should i do it?
includedir = @includedir@/WINGs
@@ -10,25 +8,23 @@ includedir = @includedir@/WINGs
include_HEADERS = wtableview.h wtabledelegates.h
lib_LIBRARIES = libExtraWINGs.a
lib_LTLIBRARIES = libExtraWINGs.la
noinst_PROGRAMS = test
EXTRA_DIST =
libExtraWINGs_a_SOURCES = \
libExtraWINGs_la_SOURCES = \
wtableview.c \
wtabledelegates.c \
wtableview.h \
wtabledelegates.h
AM_CFLAGS = @NOSTRICTALIASING@
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)

View File

@@ -1,140 +1,124 @@
#include <WINGs/WINGs.h>
#include <stdio.h>
#include <stdint.h>
#include "wtableview.h"
#include "wtabledelegates.h"
static char *col1[20] = { 0 };
static char *col1[20] = {0};
static int col2[20];
static char *options[] = {
"Option1",
"Option2",
"Option3",
"Option4",
"Option5"
"Option1",
"Option2",
"Option3",
"Option4",
"Option5"
};
int
numberOfRows(WMTableViewDelegate *self, WMTableView *table)
int numberOfRows(WMTableViewDelegate * self, WMTableView * table)
{
return 20;
return 20;
}
void*
valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
void *valueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row)
{
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column);*/
int i;
if (col1[0] == 0) {
for (i = 0; i < 20; i++) {
char buf[128];
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column); */
int i;
if (col1[0] == 0) {
for (i = 0; i < 20; i++) {
char buf[128];
sprintf(buf, "Test row %i", i);
sprintf(buf, "Test row %i", i);
col1[i] = wstrdup(buf);
col2[i] = 0;
}
}
if ((int)WMGetTableColumnId(column) == 1)
return col1[row];
else
return (void*)col2[row];
col1[i] = wstrdup(buf);
col2[i] = 0;
}
}
if ((uintptr_t)WMGetTableColumnId(column) == 1)
return col1[row];
else
return (void *)(uintptr_t) col2[row];
}
void
setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row,
void *data)
void setValueForCell(WMTableViewDelegate * self, WMTableColumn * column, int row, void *data)
{
if ((int)WMGetTableColumnId(column) == 1)
col1[row] = data;
else
col2[row] = (int)data;
if ((uintptr_t)WMGetTableColumnId(column) == 1)
col1[row] = data;
else
col2[row] = (uintptr_t) data;
}
static WMTableViewDelegate delegate = {
NULL,
numberOfRows,
valueForCell,
setValueForCell
NULL,
numberOfRows,
valueForCell,
setValueForCell
};
void
clickedTable(WMWidget *w, void *self)
void clickedTable(WMWidget * w, void *self)
{
int row = WMGetTableViewClickedRow((WMTableView*)self);
int row = WMGetTableViewClickedRow((WMTableView *) self);
WMEditTableViewRow(self, row);
WMEditTableViewRow(self, row);
}
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
WMScreen *scr;
WMWindow *win;
WMTableView *table;
WMTableColumn *col;
WMTableColumnDelegate *colDeleg;
WMScreen *scr;
WMWindow *win;
WMTableView *table;
WMTableColumn *col;
WMTableColumnDelegate *colDeleg;
WMInitializeApplication("test", &argc, argv);
WMInitializeApplication("test", &argc, argv);
scr = WMOpenScreen(NULL);
scr = WMOpenScreen(NULL);
XSynchronize(WMScreenDisplay(scr), 1);
XSynchronize(WMScreenDisplay(scr), 1);
win = WMCreateWindow(scr, "eweq");
WMResizeWidget(win, 400, 200);
WMMapWidget(win);
win = WMCreateWindow(scr, "eweq");
WMResizeWidget(win, 400, 200);
WMMapWidget(win);
table = WMCreateTableView(win);
WMSetTableViewHasHorizontalScroller(table, 0);
WMSetViewExpandsToParent(WMWidgetView(table), 10, 10, 10, 10);
WMSetTableViewBackgroundColor(table, WMWhiteColor(scr));
/*WMSetTableViewGridColor(table, WMGrayColor(scr));*/
WMSetTableViewHeaderHeight(table, 20);
WMSetTableViewDelegate(table, &delegate);
WMSetTableViewAction(table, clickedTable, table);
table = WMCreateTableView(win);
WMSetTableViewHasHorizontalScroller(table, 0);
WMSetViewExpandsToParent(WMWidgetView(table), 10, 10, 10, 10);
WMSetTableViewBackgroundColor(table, WMWhiteColor(scr));
/*WMSetTableViewGridColor(table, WMGrayColor(scr)); */
WMSetTableViewHeaderHeight(table, 20);
WMSetTableViewDelegate(table, &delegate);
WMSetTableViewAction(table, clickedTable, table);
colDeleg = WTCreateStringEditorDelegate(table);
colDeleg = WTCreateStringEditorDelegate(table);
col = WMCreateTableColumn("Group");
WMSetTableColumnWidth(col, 180);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void*)1);
col = WMCreateTableColumn("Group");
WMSetTableColumnWidth(col, 180);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void *)1);
colDeleg = WTCreateEnumSelectorDelegate(table);
WTSetEnumSelectorOptions(colDeleg, options, 5);
colDeleg = WTCreateEnumSelectorDelegate(table);
WTSetEnumSelectorOptions(colDeleg, options, 5);
col = WMCreateTableColumn("Package");
WMSetTableColumnWidth(col, 140);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void*)2);
col = WMCreateTableColumn("Package");
WMSetTableColumnWidth(col, 140);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void *)2);
colDeleg = WTCreateBooleanSwitchDelegate(table);
colDeleg = WTCreateBooleanSwitchDelegate(table);
col = WMCreateTableColumn("Bool");
WMSetTableColumnWidth(col, 50);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void*)2);
col = WMCreateTableColumn("Bool");
WMSetTableColumnWidth(col, 50);
WMAddTableViewColumn(table, col);
WMSetTableColumnDelegate(col, colDeleg);
WMSetTableColumnId(col, (void *)2);
WMMapWidget(table);
WMRealizeWidget(win);
WMScreenMainLoop(scr);
WMMapWidget(table);
WMRealizeWidget(win);
WMScreenMainLoop(scr);
return 0;
return 0;
}

View File

@@ -1,5 +1,5 @@
#include <stdint.h>
#include <WINGs/WINGsP.h>
#include "wtableview.h"
@@ -7,632 +7,516 @@
#include "wtabledelegates.h"
typedef struct {
WMTableView *table;
WMFont *font;
GC gc;
GC selGC;
WMColor *textColor;
WMTableView *table;
WMFont *font;
GC gc;
GC selGC;
WMColor *textColor;
} StringData;
typedef struct {
WMTableView *table;
GC selGc;
WMTableView *table;
GC selGc;
} PixmapData;
typedef struct {
WMTextField *widget;
WMTableView *table;
WMFont *font;
GC gc;
GC selGC;
WMColor *textColor;
WMTextField *widget;
WMTableView *table;
WMFont *font;
GC gc;
GC selGC;
WMColor *textColor;
} StringEditorData;
typedef struct {
WMPopUpButton *widget;
WMTableView *table;
WMFont *font;
char **options;
int count;
GC gc;
GC selGC;
WMColor *textColor;
WMPopUpButton *widget;
WMTableView *table;
WMFont *font;
char **options;
int count;
GC gc;
GC selGC;
WMColor *textColor;
} EnumSelectorData;
typedef struct {
WMButton *widget;
WMTableView *table;
Bool state;
GC gc;
GC selGC;
WMButton *widget;
WMTableView *table;
Bool state;
GC gc;
GC selGC;
} BooleanSwitchData;
static char *SelectionColor = "#bbbbcc";
static void
stringDraw(WMScreen *scr, Drawable d, GC gc, GC sgc, WMColor *textColor,
WMFont *font, void *data, WMRect rect, Bool selected)
stringDraw(WMScreen * scr, Drawable d, GC gc, GC sgc, WMColor * textColor,
WMFont * font, void *data, WMRect rect, Bool selected)
{
int x, y;
XRectangle rects[1];
Display *dpy = WMScreenDisplay(scr);
int x, y;
XRectangle rects[1];
Display *dpy = WMScreenDisplay(scr);
x = rect.pos.x + 5;
y = rect.pos.y + (rect.size.height - WMFontHeight(font))/2;
x = rect.pos.x + 5;
y = rect.pos.y + (rect.size.height - WMFontHeight(font)) / 2;
rects[0].x = rect.pos.x+1;
rects[0].y = rect.pos.y+1;
rects[0].width = rect.size.width-1;
rects[0].height = rect.size.height-1;
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
rects[0].x = rect.pos.x + 1;
rects[0].y = rect.pos.y + 1;
rects[0].width = rect.size.width - 1;
rects[0].height = rect.size.height - 1;
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
if (!selected) {
XFillRectangles(dpy, d, gc, rects, 1);
if (!selected) {
XFillRectangles(dpy, d, gc, rects, 1);
WMDrawString(scr, d, textColor, font, x, y,
data, strlen(data));
} else {
XFillRectangles(dpy, d, sgc, rects, 1);
WMDrawString(scr, d, textColor, font, x, y, data, strlen(data));
} else {
XFillRectangles(dpy, d, sgc, rects, 1);
WMDrawString(scr, d, textColor, font, x, y,
data, strlen(data));
}
WMDrawString(scr, d, textColor, font, x, y, data, strlen(data));
}
XSetClipMask(dpy, gc, None);
XSetClipMask(dpy, gc, None);
}
static void
pixmapDraw(WMScreen *scr, Drawable d, GC gc, GC sgc, WMPixmap *pixmap,
WMRect rect, Bool selected)
static void pixmapDraw(WMScreen * scr, Drawable d, GC gc, GC sgc, WMPixmap * pixmap, WMRect rect, Bool selected)
{
int x, y;
XRectangle rects[1];
Display *dpy = WMScreenDisplay(scr);
WMSize size;
int x, y;
XRectangle rects[1];
Display *dpy = WMScreenDisplay(scr);
WMSize size;
rects[0].x = rect.pos.x+1;
rects[0].y = rect.pos.y+1;
rects[0].width = rect.size.width-1;
rects[0].height = rect.size.height-1;
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
rects[0].x = rect.pos.x + 1;
rects[0].y = rect.pos.y + 1;
rects[0].width = rect.size.width - 1;
rects[0].height = rect.size.height - 1;
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
if (!selected) {
XFillRectangles(dpy, d, gc, rects, 1);
if (!selected) {
XFillRectangles(dpy, d, gc, rects, 1);
if (pixmap) {
size = WMGetPixmapSize(pixmap);
x = rect.pos.x + (rect.size.width - size.width) / 2;
y = rect.pos.y + (rect.size.height - size.height) / 2;
if (pixmap) {
size = WMGetPixmapSize(pixmap);
x = rect.pos.x + (rect.size.width - size.width) / 2;
y = rect.pos.y + (rect.size.height - size.height) / 2;
WMDrawPixmap(pixmap, d, x, y);
}
} else {
XFillRectangles(dpy, d, sgc, rects, 1);
WMDrawPixmap(pixmap, d, x, y);
}
} else {
XFillRectangles(dpy, d, sgc, rects, 1);
if (pixmap) {
size = WMGetPixmapSize(pixmap);
x = rect.pos.x + (rect.size.width - size.width) / 2;
y = rect.pos.y + (rect.size.height - size.height) / 2;
if (pixmap) {
size = WMGetPixmapSize(pixmap);
x = rect.pos.x + (rect.size.width - size.width) / 2;
y = rect.pos.y + (rect.size.height - size.height) / 2;
WMDrawPixmap(pixmap, d, x, y);
}
}
WMDrawPixmap(pixmap, d, x, y);
}
}
XSetClipMask(dpy, gc, None);
XSetClipMask(dpy, gc, None);
}
/* ---------------------------------------------------------------------- */
static void
SECellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void SECellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringEditorData *strdata = (StringEditorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringEditorData *strdata = (StringEditorData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
False);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row), WMTableViewRectForCell(table, column, row), False);
}
static void
selectedSECellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedSECellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringEditorData *strdata = (StringEditorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringEditorData *strdata = (StringEditorData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
True);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row), WMTableViewRectForCell(table, column, row), True);
}
static void
beginSECellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void beginSECellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
StringEditorData *strdata = (StringEditorData*)self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
void *data = WMTableViewDataForCell(strdata->table, column, row);
StringEditorData *strdata = (StringEditorData *) self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
void *data = WMTableViewDataForCell(strdata->table, column, row);
WMSetTextFieldText(strdata->widget, (char*)data);
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
WMResizeWidget(strdata->widget, rect.size.width+1, rect.size.height+1);
WMSetTextFieldText(strdata->widget, (char *)data);
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
WMResizeWidget(strdata->widget, rect.size.width + 1, rect.size.height + 1);
WMMapWidget(strdata->widget);
WMMapWidget(strdata->widget);
}
static void
endSECellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void endSECellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
StringEditorData *strdata = (StringEditorData*)self->data;
char *text;
StringEditorData *strdata = (StringEditorData *) self->data;
char *text;
WMUnmapWidget(strdata->widget);
WMUnmapWidget(strdata->widget);
text = WMGetTextFieldText(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void*)text);
text = WMGetTextFieldText(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void *)text);
}
WMTableColumnDelegate*
WTCreateStringEditorDelegate(WMTableView *parent)
WMTableColumnDelegate *WTCreateStringEditorDelegate(WMTableView * parent)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringEditorData *data = wmalloc(sizeof(StringEditorData));
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringEditorData *data = wmalloc(sizeof(StringEditorData));
data->widget = WMCreateTextField(parent);
W_ReparentView(WMWidgetView(data->widget),
WMGetTableViewDocumentView(parent),
0, 0);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
data->widget = WMCreateTextField(parent);
W_ReparentView(WMWidgetView(data->widget), WMGetTableViewDocumentView(parent), 0, 0);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
delegate->data = data;
delegate->drawCell = SECellPainter;
delegate->drawSelectedCell = selectedSECellPainter;
delegate->beginCellEdit = beginSECellEdit;
delegate->endCellEdit = endSECellEdit;
delegate->data = data;
delegate->drawCell = SECellPainter;
delegate->drawSelectedCell = selectedSECellPainter;
delegate->beginCellEdit = beginSECellEdit;
delegate->endCellEdit = endSECellEdit;
return delegate;
return delegate;
}
/* ---------------------------------------------------------------------- */
static void
ESCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void ESCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row);
EnumSelectorData *strdata = (EnumSelectorData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
uintptr_t i = (uintptr_t)WMTableViewDataForCell(table, column, row);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
strdata->options[i],
WMTableViewRectForCell(table, column, row),
False);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
strdata->options[i], WMTableViewRectForCell(table, column, row), False);
}
static void
selectedESCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedESCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row);
EnumSelectorData *strdata = (EnumSelectorData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
uintptr_t i = (uintptr_t)WMTableViewDataForCell(table, column, row);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
strdata->options[i],
WMTableViewRectForCell(table, column, row),
True);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
strdata->options[i], WMTableViewRectForCell(table, column, row), True);
}
static void
beginESCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void beginESCellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
int data = (int)WMTableViewDataForCell(strdata->table, column, row);
EnumSelectorData *strdata = (EnumSelectorData *) self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
uintptr_t data = (uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
wassertr(data < strdata->count);
wassertr(data < strdata->count);
WMSetPopUpButtonSelectedItem(strdata->widget, data);
WMSetPopUpButtonSelectedItem(strdata->widget, data);
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
WMResizeWidget(strdata->widget, rect.size.width, rect.size.height+1);
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
WMResizeWidget(strdata->widget, rect.size.width, rect.size.height + 1);
WMMapWidget(strdata->widget);
WMMapWidget(strdata->widget);
}
static void
endESCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void endESCellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
int option;
EnumSelectorData *strdata = (EnumSelectorData *) self->data;
int option;
WMUnmapWidget(strdata->widget);
WMUnmapWidget(strdata->widget);
option = WMGetPopUpButtonSelectedItem(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void*)option);
option = WMGetPopUpButtonSelectedItem(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void *)(uintptr_t) option);
}
WMTableColumnDelegate*
WTCreateEnumSelectorDelegate(WMTableView *parent)
WMTableColumnDelegate *WTCreateEnumSelectorDelegate(WMTableView * parent)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
EnumSelectorData *data = wmalloc(sizeof(EnumSelectorData));
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
EnumSelectorData *data = wmalloc(sizeof(EnumSelectorData));
data->widget = WMCreatePopUpButton(parent);
W_ReparentView(WMWidgetView(data->widget),
WMGetTableViewDocumentView(parent),
0, 0);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
data->count = 0;
data->options = NULL;
data->widget = WMCreatePopUpButton(parent);
W_ReparentView(WMWidgetView(data->widget), WMGetTableViewDocumentView(parent), 0, 0);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
data->count = 0;
data->options = NULL;
delegate->data = data;
delegate->drawCell = ESCellPainter;
delegate->drawSelectedCell = selectedESCellPainter;
delegate->beginCellEdit = beginESCellEdit;
delegate->endCellEdit = endESCellEdit;
delegate->data = data;
delegate->drawCell = ESCellPainter;
delegate->drawSelectedCell = selectedESCellPainter;
delegate->beginCellEdit = beginESCellEdit;
delegate->endCellEdit = endESCellEdit;
return delegate;
return delegate;
}
void
WTSetEnumSelectorOptions(WMTableColumnDelegate *delegate, char **options,
int count)
void WTSetEnumSelectorOptions(WMTableColumnDelegate * delegate, char **options, int count)
{
EnumSelectorData *data = (EnumSelectorData*)delegate->data;
int i;
EnumSelectorData *data = (EnumSelectorData *) delegate->data;
int i;
for (i = 0;
i < WMGetPopUpButtonNumberOfItems(data->widget);
i++) {
WMRemovePopUpButtonItem(data->widget, 0);
}
for (i = 0; i < WMGetPopUpButtonNumberOfItems(data->widget); i++) {
WMRemovePopUpButtonItem(data->widget, 0);
}
data->options = options;
data->count = count;
data->options = options;
data->count = count;
for (i = 0; i < count; i++) {
WMAddPopUpButtonItem(data->widget, options[i]);
}
for (i = 0; i < count; i++) {
WMAddPopUpButtonItem(data->widget, options[i]);
}
}
/* ---------------------------------------------------------------------- */
static void
BSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void BSCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table);
BooleanSwitchData *strdata = (BooleanSwitchData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
uintptr_t i = (uintptr_t)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table);
if (i) {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
WMTableViewRectForCell(table, column, row), False);
} else {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, NULL,
WMTableViewRectForCell(table, column, row), False);
}
if (i) {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
WMTableViewRectForCell(table, column, row), False);
} else {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, NULL, WMTableViewRectForCell(table, column, row), False);
}
}
static void
selectedBSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedBSCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
int i = (int)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table);
BooleanSwitchData *strdata = (BooleanSwitchData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
uintptr_t i = (uintptr_t)WMTableViewDataForCell(table, column, row);
WMScreen *scr = WMWidgetScreen(table);
if (i) {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
WMTableViewRectForCell(table, column, row), True);
} else {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, NULL,
WMTableViewRectForCell(table, column, row), True);
}
if (i) {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
WMTableViewRectForCell(table, column, row), True);
} else {
pixmapDraw(scr, d,
strdata->gc, strdata->selGC, NULL, WMTableViewRectForCell(table, column, row), True);
}
}
static void
beginBSCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void beginBSCellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
int data = (int)WMTableViewDataForCell(strdata->table, column, row);
BooleanSwitchData *strdata = (BooleanSwitchData *) self->data;
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
uintptr_t data = (uintptr_t)WMTableViewDataForCell(strdata->table, column, row);
WMSetButtonSelected(strdata->widget, data);
WMMoveWidget(strdata->widget, rect.pos.x+1, rect.pos.y+1);
WMResizeWidget(strdata->widget, rect.size.width-1, rect.size.height-1);
WMSetButtonSelected(strdata->widget, data);
WMMoveWidget(strdata->widget, rect.pos.x + 1, rect.pos.y + 1);
WMResizeWidget(strdata->widget, rect.size.width - 1, rect.size.height - 1);
WMMapWidget(strdata->widget);
WMMapWidget(strdata->widget);
}
static void
endBSCellEdit(WMTableColumnDelegate *self, WMTableColumn *column, int row)
static void endBSCellEdit(WMTableColumnDelegate * self, WMTableColumn * column, int row)
{
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
int value;
BooleanSwitchData *strdata = (BooleanSwitchData *) self->data;
int value;
value = WMGetButtonSelected(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void*)value);
WMUnmapWidget(strdata->widget);
value = WMGetButtonSelected(strdata->widget);
WMSetTableViewDataForCell(strdata->table, column, row, (void *)(uintptr_t) value);
WMUnmapWidget(strdata->widget);
}
WMTableColumnDelegate*
WTCreateBooleanSwitchDelegate(WMTableView *parent)
WMTableColumnDelegate *WTCreateBooleanSwitchDelegate(WMTableView * parent)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
BooleanSwitchData *data = wmalloc(sizeof(BooleanSwitchData));
WMColor *color;
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
BooleanSwitchData *data = wmalloc(sizeof(BooleanSwitchData));
WMColor *color;
data->widget = WMCreateSwitchButton(parent);
W_ReparentView(WMWidgetView(data->widget),
WMGetTableViewDocumentView(parent),
0, 0);
WMSetButtonText(data->widget, NULL);
WMSetButtonImagePosition(data->widget, WIPImageOnly);
WMSetButtonImage(data->widget, NULL);
WMSetButtonAltImage(data->widget, WMGetSystemPixmap(scr, WSICheckMark));
data->widget = WMCreateSwitchButton(parent);
W_ReparentView(WMWidgetView(data->widget), WMGetTableViewDocumentView(parent), 0, 0);
WMSetButtonText(data->widget, NULL);
WMSetButtonImagePosition(data->widget, WIPImageOnly);
WMSetButtonImage(data->widget, NULL);
WMSetButtonAltImage(data->widget, WMGetSystemPixmap(scr, WSICheckMark));
data->table = parent;
color = WMCreateNamedColor(scr, SelectionColor, False);
WMSetWidgetBackgroundColor(data->widget, color);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(color);
data->table = parent;
color = WMCreateNamedColor(scr, SelectionColor, False);
WMSetWidgetBackgroundColor(data->widget, color);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(color);
delegate->data = data;
delegate->drawCell = BSCellPainter;
delegate->drawSelectedCell = selectedBSCellPainter;
delegate->beginCellEdit = beginBSCellEdit;
delegate->endCellEdit = endBSCellEdit;
delegate->data = data;
delegate->drawCell = BSCellPainter;
delegate->drawSelectedCell = selectedBSCellPainter;
delegate->beginCellEdit = beginBSCellEdit;
delegate->endCellEdit = endBSCellEdit;
return delegate;
return delegate;
}
/* ---------------------------------------------------------------------- */
static void
SCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void SCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringData *strdata = (StringData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringData *strdata = (StringData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
False);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row), WMTableViewRectForCell(table, column, row), False);
}
static void
selectedSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedSCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringData *strdata = (StringData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringData *strdata = (StringData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
True);
stringDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC, strdata->textColor, strdata->font,
WMTableViewDataForCell(table, column, row), WMTableViewRectForCell(table, column, row), True);
}
WMTableColumnDelegate*
WTCreateStringDelegate(WMTableView *parent)
WMTableColumnDelegate *WTCreateStringDelegate(WMTableView * parent)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringData *data = wmalloc(sizeof(StringData));
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringData *data = wmalloc(sizeof(StringData));
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
delegate->data = data;
delegate->drawCell = SCellPainter;
delegate->drawSelectedCell = selectedSCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
delegate->data = data;
delegate->drawCell = SCellPainter;
delegate->drawSelectedCell = selectedSCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
return delegate;
return delegate;
}
/* ---------------------------------------------------------------------- */
static void
PCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void PCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringData *strdata = (StringData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringData *strdata = (StringData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
pixmapDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC,
(WMPixmap*)WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
False);
pixmapDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC,
(WMPixmap *) WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row), False);
}
static void
selectedPCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedPCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
StringData *strdata = (StringData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
StringData *strdata = (StringData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
pixmapDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC,
(WMPixmap*)WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row),
True);
pixmapDraw(WMWidgetScreen(table), d,
strdata->gc, strdata->selGC,
(WMPixmap *) WMTableViewDataForCell(table, column, row),
WMTableViewRectForCell(table, column, row), True);
}
WMTableColumnDelegate*
WTCreatePixmapDelegate(WMTableView *table)
WMTableColumnDelegate *WTCreatePixmapDelegate(WMTableView * table)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(table);
StringData *data = wmalloc(sizeof(StringData));
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(table);
StringData *data = wmalloc(sizeof(StringData));
data->table = table;
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->table = table;
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
delegate->data = data;
delegate->drawCell = PCellPainter;
delegate->drawSelectedCell = selectedPCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
delegate->data = data;
delegate->drawCell = PCellPainter;
delegate->drawSelectedCell = selectedPCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
return delegate;
return delegate;
}
/* ---------------------------------------------------------------------- */
static void
drawPSCell(WMTableColumnDelegate *self, Drawable d, WMTableColumn *column,
int row, Bool selected)
static void drawPSCell(WMTableColumnDelegate * self, Drawable d, WMTableColumn * column, int row, Bool selected)
{
StringData *strdata = (StringData*)self->data;
WMTableView *table = WMGetTableColumnTableView(column);
void **data;
WMPixmap *pix;
char *str;
WMRect rect;
WMSize size;
StringData *strdata = (StringData *) self->data;
WMTableView *table = WMGetTableColumnTableView(column);
void **data;
WMPixmap *pix;
char *str;
WMRect rect;
WMSize size;
data = WMTableViewDataForCell(table, column, row);
data = WMTableViewDataForCell(table, column, row);
str = (char*)data[0];
pix = (WMPixmap*)data[1];
str = (char *)data[0];
pix = (WMPixmap *) data[1];
rect = WMTableViewRectForCell(table, column, row);
rect = WMTableViewRectForCell(table, column, row);
if (pix) {
int owidth = rect.size.width;
if (pix) {
int owidth = rect.size.width;
size = WMGetPixmapSize(pix);
rect.size.width = size.width;
size = WMGetPixmapSize(pix);
rect.size.width = size.width;
pixmapDraw(WMWidgetScreen(table),
WMViewXID(WMGetTableViewDocumentView(table)),
strdata->gc, strdata->selGC, pix, rect,
selected);
pixmapDraw(WMWidgetScreen(table),
WMViewXID(WMGetTableViewDocumentView(table)),
strdata->gc, strdata->selGC, pix, rect, selected);
rect.pos.x += size.width-1;
rect.size.width = owidth-size.width+1;
}
rect.pos.x += size.width - 1;
rect.size.width = owidth - size.width + 1;
}
stringDraw(WMWidgetScreen(table), d, strdata->gc, strdata->selGC,
strdata->textColor, strdata->font, str, rect, selected);
stringDraw(WMWidgetScreen(table), d, strdata->gc, strdata->selGC,
strdata->textColor, strdata->font, str, rect, selected);
}
static void
PSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void PSCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
drawPSCell(self, d, column, row, False);
drawPSCell(self, d, column, row, False);
}
static void
selectedPSCellPainter(WMTableColumnDelegate *self, WMTableColumn *column,
int row, Drawable d)
static void selectedPSCellPainter(WMTableColumnDelegate * self, WMTableColumn * column, int row, Drawable d)
{
drawPSCell(self, d, column, row, True);
drawPSCell(self, d, column, row, True);
}
WMTableColumnDelegate*
WTCreatePixmapStringDelegate(WMTableView *parent)
WMTableColumnDelegate *WTCreatePixmapStringDelegate(WMTableView * parent)
{
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringData *data = wmalloc(sizeof(StringData));
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
WMScreen *scr = WMWidgetScreen(parent);
StringData *data = wmalloc(sizeof(StringData));
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
data->table = parent;
data->font = WMSystemFontOfSize(scr, 12);
data->gc = WMColorGC(WMWhiteColor(scr));
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
data->textColor = WMBlackColor(scr);
delegate->data = data;
delegate->drawCell = PSCellPainter;
delegate->drawSelectedCell = selectedPSCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
delegate->data = data;
delegate->drawCell = PSCellPainter;
delegate->drawSelectedCell = selectedPSCellPainter;
delegate->beginCellEdit = NULL;
delegate->endCellEdit = NULL;
return delegate;
return delegate;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,32 @@
## automake input file for WINGs
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
SUBDIRS = WINGs . po Documentation Resources Examples Extras Tests
SUBDIRS = WINGs . po Documentation Resources
#libWINGs_la_LDFLAGS = -version-info 1:1:0
libWINGs_la_LDFLAGS = -version-info @WINGS_VERSION@
libWUtil_la_LDFLAGS = -version-info @WUTIL_VERSION@
bin_SCRIPTS = get-wings-flags get-wutil-flags
lib_LIBRARIES = libWINGs.a libWUtil.a
lib_LTLIBRARIES = libWUtil.la libWINGs.la
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @INTLIBS@
LDADD= libWUtil.la libWINGs.la $(top_builddir)/wrlib/libwraster.la @INTLIBS@
libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFTLIBS@ @FCLIBS@ @LIBM@
libWUtil_la_LIBADD = @LIBBSD@
EXTRA_DIST = BUGS python/Makefile python/README python/WINGs.i \
python/WINGs.py python/setup.py python/test.py
EXTRA_DIST = BUGS make-rgb Examples Extras Tests get-wings-flags.in get-wutil-flags.in
# wbutton.c
libWINGs_a_SOURCES = \
array.c \
bagtree.c \
libWINGs_la_SOURCES = \
configuration.c \
connection.c \
data.c \
dragcommon.c \
dragdestination.c \
dragsource.c \
error.c \
findfile.c \
handlers.c \
hashtable.c \
host.c \
international.c \
memory.c \
misc.c \
notification.c \
proplist.c \
rgb.h \
selection.c \
snprintf.c \
string.c \
tree.c \
userdefaults.c \
usleep.c \
wapplication.c \
wappresource.c \
wballoon.c \
wbox.c \
@@ -82,23 +62,18 @@ libWINGs_a_SOURCES = \
wview.c \
wwindow.c
libWUtil_a_SOURCES = \
libWUtil_la_SOURCES = \
array.c \
bagtree.c \
connection.c \
data.c \
error.c \
findfile.c \
handlers.c \
hashtable.c \
host.c \
international.c \
memory.c \
misc.c \
notification.c \
proplist.c \
snprintf.c \
string.c \
tree.c \
userdefaults.c \
@@ -108,25 +83,41 @@ libWUtil_a_SOURCES = \
wutil.c
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
AM_CFLAGS = @NOSTRICTALIASING@
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\" -DRESOURCE_PATH=\"$(datadir)/WINGs\" -DDEBUG
AM_CFLAGS =
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DDEBUG
@XFTFLAGS@ @HEADER_SEARCH_PATH@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = WINGs.pc
wcolorpanel.o: wcolorpanel.c
$(COMPILE) -c -DRGBTXT="\"@X_LIBRARY_PATH@/X11/rgb.txt\"" $<
DISTCLEANFILES = $(pkgconfig_DATA) get-wings-flags get-wutil-flags
DISTCLEANFILES = WINGs.pc
WINGs.pc: Makefile
@echo "Generating $@"
@echo 'Name: WINGs' > $@
@echo 'Description: Small widget set with the NeXTStep(TM) look and feel' >> $@
@echo 'Version: $(VERSION)' >> $@
@echo 'Requires: wrlib' >> $@
@echo 'Libs: $(lib_search_path) -lWINGs' >> $@
@echo 'Libs.private: $(XFTLIBS) $(XLIBS) -lm $(INTLIBS)' >> $@
@echo 'Cflags: $(inc_search_path)' >> $@
get-wings-flags: get-wings-flags.in Makefile
@echo "Generating $@"
@$(SED) -e 's#$${inc_search_path}#$(inc_search_path)#;' \
-e 's#$${lib_search_path}#$(lib_search_path)#;' \
-e 's#$${GFXLIBS}#$(GFXLIBS)#;' \
-e 's#$${XFTLIBS}#$(XFTLIBS)#;' \
-e 's#$${INTLIBS}#$(INTLIBS)#;' \
-e 's#$${XLIBS}#$(XLIBS)#;' < $(dir $<@)get-wings-flags.in > $@
@chmod 755 $@
get-wutil-flags: get-wutil-flags.in Makefile
@echo "Generating $@"
@$(SED) -e 's#$${includedir}#$(includedir)#;' \
-e 's#$${libdir}#$(libdir)#;' \
-e 's#$${INTLIBS}#$(INTLIBS)#;' < $(dir $<@)get-wutil-flags.in > $@
@chmod 755 $@
install-exec-local:
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)/pkgconfig
@list='WINGs.pc'; for p in $$list; do \
if test -f $$p; then \
echo "$(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/pkgconfig/"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/pkgconfig/; \
else :; fi; \
done

View File

@@ -1,3 +1,160 @@
** API and ABI modifications since wmaker 0.92.0
** libWINGs **
<WINGsP.h>
struct W_DragDestinationInfo: new members added SIZE CHANGE
<WINGs.h>
WMGetTextFieldCursorPosition ADDED
WC_Matrix REMOVED from enum.
WMCreateProgressIndicator REMOVED
WMSetProgressIndicatorMinValue REMOVED
WMSetProgressIndicatorMaxValue REMOVED
WMSetProgressIndicatorValue REMOVED
WMGetProgressIndicatorMinValue REMOVED
WMGetProgressIndicatorMaxValue REMOVED
WMGetProgressIndicatorValue REMOVED
typedef struct W_Ruler WMRuler REMOVED
typedef struct WMRulerMargins REMOVED
WMAppendTextBlock REMOVED
WMAppendTextStream REMOVED
WMCreateRuler REMOVED
WMCreateTextBlockWithObject REMOVED
WMCreateTextBlockWithPixmap REMOVED
WMCreateTextBlockWithText REMOVED
WMCreateTextForDocumentType REMOVED
WMDestroyTextBlock REMOVED
WMFindInTextStream REMOVED
WMFreezeText REMOVED
WMGetGrabbedRulerMargin REMOVED
WMGetReleasedRulerMargin REMOVED
WMGetRulerMargins REMOVED
WMGetRulerOffset REMOVED
WMGetTextBlockProperties REMOVED
WMGetTextDefaultColor REMOVED
WMGetTextDefaultFont REMOVED
WMGetTextEditable REMOVED
WMGetTextIgnoresNewline REMOVED
WMGetTextInsertType REMOVED
WMGetTextObjects REMOVED
WMGetTextRulerShown REMOVED
WMGetTextSelectedObjects REMOVED
WMGetTextSelectedStream REMOVED
WMGetTextSelectionColor REMOVED
WMGetTextSelectionFont REMOVED
WMGetTextSelectionUnderlined REMOVED
WMGetTextStream REMOVED
WMGetTextUsesMonoFont REMOVED
WMIsMarginEqualToMargin REMOVED
WMPageText REMOVED
WMPrependTextBlock REMOVED
WMPrependTextStream REMOVED
WMRemoveTextBlock REMOVED
WMReplaceTextSelection REMOVED
WMScrollText REMOVED
WMSetRulerMargins REMOVED
WMSetRulerMoveAction REMOVED
WMSetRulerOffset REMOVED
WMSetRulerReleaseAction REMOVED
WMSetTextAlignment REMOVED
WMSetTextBackgroundColor REMOVED
WMSetTextBackgroundPixmap REMOVED
WMSetTextBlockProperties REMOVED
WMSetTextDefaultColor REMOVED
WMSetTextDefaultFont REMOVED
WMSetTextDelegate REMOVED
WMSetTextEditable REMOVED
WMSetTextForegroundColor REMOVED
WMSetTextHasHorizontalScroller REMOVED
WMSetTextHasRuler REMOVED
WMSetTextHasVerticalScroller REMOVED
WMSetTextIgnoresNewline REMOVED
WMSetTextIndentNewLines REMOVED
WMSetTextRelief REMOVED
WMSetTextSelectionColor REMOVED
WMSetTextSelectionFont REMOVED
WMSetTextSelectionUnderlined REMOVED
WMSetTextUsesMonoFont REMOVED
WMShowTextRuler REMOVED
WMThawText REMOVED
WMRefreshText REMOVED
WMCreateText REMOVED
WMClearText REMOVED
** libWutil **
enum WMConnectionState REMOVED
enum WMConnectionTimeoutState REMOVED
struct ConnectionDelegate REMOVED
__wmessage ADDED
wstrerror REMOVED
wmessage converted from function to wrapper macro
wwarning converted from function to wrapper macro
wfatal converted from function to wrapper macro
wsyserror converted from function to wrapper macro
wsyserror REMOVED (use werror instead)
werror macro ADDED (replaces wsyserror)
wsyserrorwithcode removed
wmkdirhier ADDED
wrmdirhier ADDED
wmalloc0 REMOVED
wnew REMOVED
wnew0 REMOVED
wstrlcpy ADDED
wstrlcat ADDED
WMPushInArray REMOVED
WMWritePropListToFile NUMBER OF FUNCTION ARGUMENTS CHANGED
WMGetCurrentHost
WMGetHostWithName
WMGetHostWithAddress
WMRetainHost
WMReleaseHost
WMSetHostCacheEnabled
WMIsHostCacheEnabled
WMFlushHostCache
WMIsHostEqualToHost
WMGetHostName
WMGetHostNames
WMGetHostAddress
WMCreateConnectionAsServerAtAddress REMOVED
WMCreateConnectionToAddress REMOVED
WMCreateConnectionToAddressAndNotify REMOVED
WMCloseConnection REMOVED
WMDestroyConnection REMOVED
WMConnection* WMAcceptConnection REMOVED
WMGetConnectionAvailableData REMOVED
WMSendConnectionData REMOVED
WMEnqueueConnectionData REMOVED
WMFlushConnection REMOVED
WMSetConnectionDelegate REMOVED
WMGetConnectionService REMOVED
WMGetConnectionProtocol REMOVED
WMSetConnectionNonBlocking REMOVED
WMSetConnectionCloseOnExec REMOVED
WMSetConnectionShutdownOnClose REMOVED
WMGetConnectionClientData REMOVED
WMSetConnectionClientData REMOVED
WMGetConnectionFlags REMOVED
WMSetConnectionFlags REMOVED
WMGetConnectionSocket REMOVED
WMGetConnectionState REMOVED
WMGetConnectionTimeoutState REMOVED
WMGetConnectionUnsentData REMOVED
WMGetConnectionQueuedData REMOVED
WMSetConnectionDefaultTimeout REMOVED
WMSetConnectionOpenTimeout REMOVED
WMSetConnectionSendTimeout REMOVED
WMTreeWalkProc ADDED
WMTreeWalk ADDED
wshellquote ADDED
----------------------------------------------------
*** Mon Oct 14 19:42:42 EEST 2002 - Dan
Double buffering

View File

@@ -5,7 +5,7 @@
Alfredo Kengi Kojima
kojima@windowmaker.org
kojima@windowmaker.info
WINGs is a small widget set with the N*XTSTEP look and feel. It's API
@@ -26,7 +26,7 @@ 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.org) In fact, it's primary role is to
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

View File

@@ -1,2 +0,0 @@
Makefile Makefile.in
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,4 +0,0 @@
Makefile Makefile.in
testtext testcolorpanel testmywidget wmfile wmquery wtest
.libs
.psrc .inslog2 tca.map tca.log pchdir *.rpt

View File

@@ -1,16 +1,17 @@
## automake input file for WINGs - Tests
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/WINGs/libWUtil.la \
@XFTLIBS@ @INTLIBS@
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
@@ -18,5 +19,4 @@ EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ \
-DDEBUG

View File

@@ -7,7 +7,6 @@
*
*/
/*
*
* Include the WINGs private data header.
@@ -25,29 +24,23 @@
* Define the widget "class"
*/
typedef struct W_MyWidget {
/* these two fields must be present in all your widgets in this
* exact position */
W_Class widgetClass;
WMView *view;
/* these two fields must be present in all your widgets in this
* exact position */
W_Class widgetClass;
WMView *view;
/* put your stuff here */
char *text;
/* put your stuff here */
char *text;
} _MyWidget;
/* some forward declarations */
static void destroyMyWidget(_MyWidget *mPtr);
static void paintMyWidget(_MyWidget *mPtr);
static void handleEvents(XEvent *event, void *data);
static void handleActionEvents(XEvent *event, void *data);
static void destroyMyWidget(_MyWidget * mPtr);
static void paintMyWidget(_MyWidget * mPtr);
static void handleEvents(XEvent * event, void *data);
static void handleActionEvents(XEvent * event, void *data);
/*
* Delegates
@@ -55,173 +48,150 @@ static void handleActionEvents(XEvent *event, void *data);
* You won't need to use this most of the time.
*/
static W_ViewDelegate _MyWidgetDelegate = {
NULL,
NULL,
NULL,
NULL,
NULL
NULL,
NULL,
NULL,
NULL,
NULL
};
/* our widget class ID */
static W_Class myWidgetClass = 0;
/*
* Initializer for our widget. Must be called before creating any
* instances of the widget.
*/
W_Class
InitMyWidget(WMScreen *scr)
W_Class InitMyWidget(WMScreen * scr)
{
/* register our widget with WINGs and get our widget class ID */
if (!myWidgetClass) {
myWidgetClass = W_RegisterUserWidget();
}
/* register our widget with WINGs and get our widget class ID */
if (!myWidgetClass) {
myWidgetClass = W_RegisterUserWidget();
}
return myWidgetClass;
return myWidgetClass;
}
/*
* Our widget fabrication plant.
*/
MyWidget*
CreateMyWidget(WMWidget *parent)
MyWidget *CreateMyWidget(WMWidget * parent)
{
MyWidget *mPtr;
MyWidget *mPtr;
/* allocate some storage for our new widget instance */
mPtr = wmalloc(sizeof(MyWidget));
/* initialize it */
memset(mPtr, 0, sizeof(MyWidget));
/* allocate some storage for our new widget instance */
mPtr = wmalloc(sizeof(MyWidget));
/* initialize it */
memset(mPtr, 0, sizeof(MyWidget));
/* set the class ID */
mPtr->widgetClass = myWidgetClass;
/* set the class ID */
mPtr->widgetClass = myWidgetClass;
/*
* Create the view for our widget.
* Note: the Window for the view is only created after the view is
* realized with W_RealizeView()
*
* Consider the returned view as read-only.
*/
mPtr->view = W_CreateView(W_VIEW(parent));
if (!mPtr->view) {
wfree(mPtr);
return NULL;
}
/* always do this */
mPtr->view->self = mPtr;
/*
* Create the view for our widget.
* Note: the Window for the view is only created after the view is
* realized with W_RealizeView()
*
* Consider the returned view as read-only.
*/
mPtr->view = W_CreateView(W_VIEW(parent));
if (!mPtr->view) {
wfree(mPtr);
return NULL;
}
/* always do this */
mPtr->view->self = mPtr;
/* setup the delegates for the view */
mPtr->view->delegate = &_MyWidgetDelegate;
/* setup the delegates for the view */
mPtr->view->delegate = &_MyWidgetDelegate;
/*
* Intercept some events for our widget, so that we can handle them.
*/
WMCreateEventHandler(mPtr->view, ExposureMask /* this allows us to know when we should paint */
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, mPtr);
/*
* Intercept some events for our widget, so that we can handle them.
*/
WMCreateEventHandler(mPtr->view, ExposureMask /* this allows us to know when we should paint */
| StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, mPtr);
/*
* Intercept some other events. This could be merged with the above
* call, but we separate for more organization.
*/
WMCreateEventHandler(mPtr->view, ButtonPressMask,handleActionEvents, mPtr);
/*
* Intercept some other events. This could be merged with the above
* call, but we separate for more organization.
*/
WMCreateEventHandler(mPtr->view, ButtonPressMask, handleActionEvents, mPtr);
return mPtr;
return mPtr;
}
/*
* Paint our widget contents.
*/
static void
paintMyWidget(_MyWidget *mPtr)
static void paintMyWidget(_MyWidget * mPtr)
{
W_Screen *scr = mPtr->view->screen;
WMColor *color;
W_Screen *scr = mPtr->view->screen;
WMColor *color;
if (mPtr->text) {
if (mPtr->text) {
color = WMWhiteColor(scr);
color = WMWhiteColor(scr);
W_PaintText(mPtr->view, mPtr->view->window, scr->normalFont, 0, 0,
mPtr->view->size.width, WACenter, color, False, mPtr->text, strlen(mPtr->text));
W_PaintText(mPtr->view, mPtr->view->window, scr->normalFont, 0, 0,
mPtr->view->size.width, WACenter, color,
False, mPtr->text, strlen(mPtr->text));
WMReleaseColor(color);
}
WMReleaseColor(color);
}
}
static void
handleEvents(XEvent *event, void *data)
static void handleEvents(XEvent * event, void *data)
{
_MyWidget *mPtr = (_MyWidget*)data;
_MyWidget *mPtr = (_MyWidget *) data;
switch (event->type) {
case Expose:
if (event->xexpose.count != 0)
break;
paintMyWidget(mPtr);
break;
switch (event->type) {
case Expose:
if (event->xexpose.count!=0)
break;
paintMyWidget(mPtr);
break;
case DestroyNotify:
destroyMyWidget(mPtr);
break;
case DestroyNotify:
destroyMyWidget(mPtr);
break;
}
}
}
static void
handleActionEvents(XEvent *event, void *data)
static void handleActionEvents(XEvent * event, void *data)
{
_MyWidget *mPtr = (_MyWidget*)data;
_MyWidget *mPtr = (_MyWidget *) data;
switch (event->type) {
case ButtonPress:
XBell(mPtr->view->screen->display, 100);
XBell(mPtr->view->screen->display, 100);
break;
}
switch (event->type) {
case ButtonPress:
XBell(mPtr->view->screen->display, 100);
XBell(mPtr->view->screen->display, 100);
break;
}
}
void
SetMyWidgetText(MyWidget *mPtr, char *text)
void SetMyWidgetText(MyWidget * mPtr, char *text)
{
CHECK_CLASS(mPtr, myWidgetClass);
CHECK_CLASS(mPtr, myWidgetClass);
if (mPtr->text)
wfree(mPtr->text);
if (mPtr->text)
wfree(mPtr->text);
mPtr->text = wstrdup(text);
mPtr->text = wstrdup(text);
if (W_VIEW_MAPPED(mPtr->view)) {
paintMyWidget(mPtr);
}
if (W_VIEW_MAPPED(mPtr->view)) {
paintMyWidget(mPtr);
}
}
static void
destroyMyWidget(_MyWidget *mPtr)
static void destroyMyWidget(_MyWidget * mPtr)
{
/*
* Free all data we allocated for our widget.
*/
/*
* Free all data we allocated for our widget.
*/
if (mPtr->text)
wfree(mPtr->text);
if (mPtr->text)
wfree(mPtr->text);
wfree(mPtr);
wfree(mPtr);
}

View File

@@ -1,52 +1,46 @@
#include <WINGs/WINGs.h>
#include <stdlib.h>
#include "mywidget.h"
void
wAbort()
void wAbort()
{
exit(1);
exit(1);
}
int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMWindow *win;
MyWidget *thing;
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMWindow *win;
MyWidget *thing;
WMInitializeApplication("Test", &argc, argv);
WMInitializeApplication("Test", &argc, argv);
if (!dpy) {
wfatal("could not open display");
exit(1);
}
if (!dpy) {
wfatal("could not open display");
exit(1);
}
scr = WMCreateSimpleApplicationScreen(dpy);
scr = WMCreateSimpleApplicationScreen(dpy);
/* init our widget */
InitMyWidget(scr);
/* init our widget */
InitMyWidget(scr);
win = WMCreateWindow(scr, "test");
WMResizeWidget(win, 150, 50);
win = WMCreateWindow(scr, "test");
WMResizeWidget(win, 150, 50);
thing = CreateMyWidget(win);
SetMyWidgetText(thing, "The Test");
WMResizeWidget(thing, 100, 20);
WMMoveWidget(thing, 10, 10);
thing = CreateMyWidget(win);
SetMyWidgetText(thing, "The Test");
WMResizeWidget(thing, 100, 20);
WMMoveWidget(thing, 10, 10);
WMRealizeWidget(win);
WMMapSubwidgets(win);
WMMapWidget(win);
WMRealizeWidget(win);
WMMapSubwidgets(win);
WMMapWidget(win);
WMScreenMainLoop(scr);
WMScreenMainLoop(scr);
return 0;
return 0;
}

View File

@@ -3,8 +3,8 @@
<Img src=wm.png></b><p>
<b>GNU Window Maker</B><br>
<i>X11 Window Manager</i><p>
<u>http://windowmaker.org<br>
ftp.windowmaker.org</u></font><Br>
<u>http://windowmaker.info<br>
ftp.windowmaker.info</u></font><Br>
</center>
<b><i>Window Maker</b>

View File

@@ -11,8 +11,6 @@
-----------------------------------------------------------------------
*/
#include <WINGs/WINGs.h>
#include <unistd.h>
@@ -21,36 +19,28 @@
#include "logo.xpm"
void
wAbort()
void wAbort()
{
exit(1);
exit(1);
}
char *ProgName;
void usage(void)
{
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -s\t\tSave panel (default open panel)\n"
" -i <str>\tInitial directory (default /)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style file selection panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -s\t\tSave panel (default open panel)\n"
" -i <str>\tInitial directory (default /)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style file selection panel.\n"
"\n" "version:\n" "\t%s\n", ProgName, ProgName, __DATE__);
exit(0);
}
#define OPEN_PANEL_TYPE 0
@@ -58,69 +48,65 @@ void usage(void)
int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image;*/
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
WMOpenPanel *oPanel;
WMSavePanel *sPanel;
/* RImage *image; */
char *title = NULL;
char *initial = "/";
int ch;
int panelType = OPEN_PANEL_TYPE;
extern char *optarg;
extern int optind;
if (!dpy) {
puts("could not open display");
exit(1);
}
if (!dpy) {
puts("could not open display");
exit(1);
}
WMInitializeApplication("WMFile", &argc, argv);
WMInitializeApplication("WMFile", &argc, argv);
ProgName = argv[0];
ProgName = argv[0];
while((ch = getopt(argc, argv, "si:ht:")) != -1)
switch(ch)
{
case 's':
panelType = SAVE_PANEL_TYPE;
break;
case 'i':
initial = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
while ((ch = getopt(argc, argv, "si:ht:")) != -1)
switch (ch) {
case 's':
panelType = SAVE_PANEL_TYPE;
break;
case 'i':
initial = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
for(; optind <argc; optind++)
usage();
for (; optind < argc; optind++)
usage();
scr = WMCreateSimpleApplicationScreen(dpy);
scr = WMCreateSimpleApplicationScreen(dpy);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
} else {
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title*/ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
}
return 0;
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
if (panelType == SAVE_PANEL_TYPE) {
sPanel = WMGetSavePanel(scr);
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
/*title */ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(sPanel));
else
printf("\n");
} else {
oPanel = WMGetOpenPanel(scr);
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
/*title */ NULL, NULL) == True)
printf("%s\n", WMGetFilePanelFileName(oPanel));
else
printf("\n");
}
return 0;
}

View File

@@ -3,7 +3,6 @@
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
*/
#include <WINGs/WINGs.h>
#include <unistd.h>
@@ -12,92 +11,80 @@
#include "logo.xpm"
void
wAbort()
void wAbort()
{
exit(1);
exit(1);
}
char *ProgName;
void
usage(void)
void usage(void)
{
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -i <str>\tInitial entry contents (default none)\n"
" -p <str>\tPrompt message (default none)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style input panel.\n"
"\n"
"version:\n"
"\t%s\n"
,ProgName,ProgName,__DATE__
);
exit(0);
fprintf(stderr,
"usage:\n"
"\t%s [-options]\n"
"\n"
"options:\n"
" -i <str>\tInitial entry contents (default none)\n"
" -p <str>\tPrompt message (default none)\n"
" -t <str>\tQuery window title (default none)\n"
"\n"
"information:\n"
"\t%s pops up a WindowMaker style input panel.\n"
"\n" "version:\n" "\t%s\n", ProgName, ProgName, __DATE__);
exit(0);
}
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
char *title = NULL;
char *prompt = NULL;
char *initial = NULL;
char *result = NULL;
int ch;
extern char *optarg;
extern int optind;
Display *dpy = XOpenDisplay("");
WMScreen *scr;
WMPixmap *pixmap;
char *title = NULL;
char *prompt = NULL;
char *initial = NULL;
char *result = NULL;
int ch;
extern char *optarg;
extern int optind;
WMInitializeApplication("WMQuery", &argc, argv);
WMInitializeApplication("WMQuery", &argc, argv);
ProgName = argv[0];
ProgName = argv[0];
if (!dpy) {
puts("could not open display");
exit(1);
}
if (!dpy) {
puts("could not open display");
exit(1);
}
while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
switch(ch)
{
case 'i':
initial = optarg;
break;
case 'p':
prompt = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
while ((ch = getopt(argc, argv, "i:hp:t:")) != -1)
switch (ch) {
case 'i':
initial = optarg;
break;
case 'p':
prompt = optarg;
break;
case 't':
title = optarg;
break;
default:
usage();
}
for(; optind <argc; optind++)
usage();
for (; optind < argc; optind++)
usage();
scr = WMCreateSimpleApplicationScreen(dpy);
scr = WMCreateSimpleApplicationScreen(dpy);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
WMSetApplicationIconPixmap(scr, pixmap);
WMReleasePixmap(pixmap);
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
printf("%s\n", result);
else
printf("\n");
return 0;
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
printf("%s\n", result);
else
printf("\n");
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
Makefile Makefile.in

View File

@@ -1,9 +1,8 @@
## automake input file for WINGs - Headers subdir
AUTOMAKE_OPTIONS = no-dependencies
AUTOMAKE_OPTIONS =
# is this a kluge? if so, how should i do it?
includedir = @includedir@/WINGs
include_HEADERS = WINGs.h WUtil.h WINGsP.h proplist-compat.h
include_HEADERS = WINGs.h WUtil.h WINGsP.h

View File

@@ -590,7 +590,7 @@ typedef struct W_DragDestinationProcs {
} WMDragDestinationProcs;
/* ...................................................................... */
/* ---[ WINGs/wmisc.c ]--------------------------------------------------- */
WMPoint wmkpoint(int x, int y);
@@ -604,7 +604,7 @@ WMRect wmkrect(int x, int y, unsigned int width, unsigned int height);
#define wmkpoint(x, y) (WMPoint){(x), (y)}
#endif
/* ....................................................................... */
/* ---[ WINGs/wapplication.c ]-------------------------------------------- */
@@ -613,11 +613,12 @@ void WMInitializeApplication(char *applicationName, int *argc, char **argv);
void WMSetResourcePath(char *path);
/* don't free the returned string */
char* WMGetApplicationName();
char* WMGetApplicationName(void);
/* Try to locate resource file. ext may be NULL */
char* WMPathForResourceOfType(char *resource, char *ext);
/* ---[ WINGs/widgets.c ]------------------------------------------------- */
WMScreen* WMOpenScreen(const char *display);
@@ -640,7 +641,9 @@ Display* WMScreenDisplay(WMScreen *scr);
int WMScreenDepth(WMScreen *scr);
void WMSetFocusToWidget(WMWidget *widget);
/* ---[ WINGs/wappresource.c ]-------------------------------------------- */
void WMSetApplicationIconImage(WMScreen *app, RImage *image);
@@ -655,7 +658,7 @@ WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color);
void WMSetApplicationIconWindow(WMScreen *scr, Window window);
void WMSetFocusToWidget(WMWidget *widget);
/* ---[ WINGs/wevent.c ]-------------------------------------------------- */
WMEventHook* WMHookEventHandler(WMEventHook *handler);
@@ -677,8 +680,12 @@ void WMNextEvent(Display *dpy, XEvent *event);
void WMMaskEvent(Display *dpy, long mask, XEvent *event);
void WMSetViewNextResponder(WMView *view, WMView *responder);
/* ....................................................................... */
void WMRelayToNextResponder(WMView *view, XEvent *event);
/* ---[ WINGs/selection.c ]----------------------------------------------- */
Bool WMCreateSelectionHandler(WMView *view, Atom selection, Time timestamp,
@@ -693,7 +700,7 @@ Bool WMRequestSelection(WMView *view, Atom selection, Atom target,
extern char *WMSelectionOwnerDidChangeNotification;
/* ....................................................................... */
/* ---[ WINGs/dragcommon.c ]---------------------------------------------- */
WMArray* WMCreateDragOperationArray(int initialSize);
@@ -704,6 +711,8 @@ WMDragOperationType WMGetDragOperationItemType(WMDragOperationItem* item);
char* WMGetDragOperationItemText(WMDragOperationItem* item);
/* ---[ WINGs/dragsource.c ]---------------------------------------------- */
void WMSetViewDragImage(WMView* view, WMPixmap *dragImage);
void WMReleaseViewDragImage(WMView* view);
@@ -724,18 +733,18 @@ void WMSetViewDraggable(WMView *view, WMDragSourceProcs *procs, WMPixmap *dragIm
void WMUnsetViewDraggable(WMView *view);
/* ---[ WINGs/dragdestination.c ]----------------------------------------- */
void WMRegisterViewForDraggedTypes(WMView *view, WMArray *acceptedTypes);
void WMUnregisterViewDraggedTypes(WMView *view);
void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
/* ....................................................................... */
/* ---[ WINGs/wfont.c ]--------------------------------------------------- */
Bool WMIsAntialiasingEnabled(WMScreen *scrPtr);
/* ....................................................................... */
WMFont* WMCreateFont(WMScreen *scrPtr, char *fontName);
WMFont* WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style);
@@ -760,7 +769,16 @@ WMFont* WMSystemFontOfSize(WMScreen *scrPtr, int size);
WMFont* WMBoldSystemFontOfSize(WMScreen *scrPtr, int size);
/* ....................................................................... */
void WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int x, int y, char *text, int length);
void WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color,
WMColor *background, WMFont *font, int x, int y,
char *text, int length);
int WMWidthOfString(WMFont *font, char *text, int length);
/* ---[ WINGs/wpixmap.c ]------------------------------------------------- */
WMPixmap* WMRetainPixmap(WMPixmap *pixmap);
@@ -796,7 +814,7 @@ Pixmap WMGetPixmapMaskXID(WMPixmap *pixmap);
WMPixmap* WMGetSystemPixmap(WMScreen *scr, int image);
/* ....................................................................... */
/* ---[ WINGs/wcolor.c ]-------------------------------------------------- */
WMColor* WMDarkGrayColor(WMScreen *scr);
@@ -844,21 +862,7 @@ unsigned short WMGetColorAlpha(WMColor *color);
char* WMGetColorRGBDescription(WMColor *color);
/* ....................................................................... */
void WMDrawString(WMScreen *scr, Drawable d, WMColor *color, WMFont *font,
int x, int y, char *text, int length);
void WMDrawImageString(WMScreen *scr, Drawable d, WMColor *color,
WMColor *background, WMFont *font, int x, int y,
char *text, int length);
int WMWidthOfString(WMFont *font, char *text, int length);
/* ....................................................................... */
/* ---[ WINGs/widgets.c ]------------------------------------------------- */
WMScreen* WMWidgetScreen(WMWidget *w);
@@ -904,10 +908,12 @@ unsigned int WMWidgetHeight(WMWidget *w);
Window WMWidgetXID(WMWidget *w);
Window WMViewXID(WMView *view);
void WMRedisplayWidget(WMWidget *w);
/* ---[ WINGs/wview.c ]--------------------------------------------------- */
Window WMViewXID(WMView *view);
void WMSetViewNotifySizeChanges(WMView *view, Bool flag);
void WMSetViewExpandsToParent(WMView *view, int topOffs, int leftOffs,
@@ -921,10 +927,6 @@ WMPoint WMGetViewScreenPosition(WMView *view);
WMWidget* WMWidgetOfView(WMView *view);
void WMSetViewNextResponder(WMView *view, WMView *responder);
void WMRelayToNextResponder(WMView *view, XEvent *event);
/* notifications */
extern char *WMViewSizeDidChangeNotification;
@@ -932,8 +934,7 @@ extern char *WMViewFocusDidChangeNotification;
extern char *WMViewRealizedNotification;
/* ....................................................................... */
/* ---[ WINGs/wballoon.c ]------------------------------------------------ */
void WMSetBalloonTextForView(char *text, WMView *view);
@@ -948,7 +949,7 @@ void WMSetBalloonDelay(WMScreen *scr, int delay);
void WMSetBalloonEnabled(WMScreen *scr, Bool flag);
/* ....................................................................... */
/* ---[ WINGs/wwindow.c ]------------------------------------------------- */
WMWindow* WMCreateWindow(WMScreen *screen, char *name);
@@ -992,7 +993,7 @@ void WMSetWindowDocumentEdited(WMWindow *win, Bool flag);
void WMCloseWindow(WMWindow *win);
/* ....................................................................... */
/* ---[ WINGs/wbutton.c ]------------------------------------------------- */
void WMSetButtonAction(WMButton *bPtr, WMAction *action, void *clientData);
@@ -1056,7 +1057,7 @@ void WMSetButtonContinuous(WMButton *bPtr, Bool flag);
void WMSetButtonPeriodicDelay(WMButton *bPtr, float delay, float interval);
/* ....................................................................... */
/* ---[ WINGs/wlabel.c ]-------------------------------------------------- */
WMLabel* WMCreateLabel(WMWidget *parent);
@@ -1082,7 +1083,7 @@ void WMSetLabelFont(WMLabel *lPtr, WMFont *font);
void WMSetLabelTextColor(WMLabel *lPtr, WMColor *color);
/* ....................................................................... */
/* ---[ WINGs/wframe.c ]-------------------------------------------------- */
WMFrame* WMCreateFrame(WMWidget *parent);
@@ -1092,7 +1093,7 @@ void WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief);
void WMSetFrameTitle(WMFrame *fPtr, char *title);
/* ....................................................................... */
/* ---[ WINGs/wtextfield.c ]---------------------------------------------- */
WMTextField* WMCreateTextField(WMWidget *parent);
@@ -1125,6 +1126,8 @@ void WMSelectTextFieldRange(WMTextField *tPtr, WMRange range);
void WMSetTextFieldCursorPosition(WMTextField *tPtr, unsigned int position);
unsigned WMGetTextFieldCursorPosition(WMTextField *tPtr);
void WMSetTextFieldNextTextField(WMTextField *tPtr, WMTextField *next);
void WMSetTextFieldPrevTextField(WMTextField *tPtr, WMTextField *prev);
@@ -1137,7 +1140,7 @@ extern char *WMTextDidChangeNotification;
extern char *WMTextDidBeginEditingNotification;
extern char *WMTextDidEndEditingNotification;
/* ....................................................................... */
/* ---[ WINGs/wscroller.c ]----------------------------------------------- */
WMScroller* WMCreateScroller(WMWidget *parent);
@@ -1157,7 +1160,7 @@ void WMSetScrollerArrowsPosition(WMScroller *sPtr,
extern char *WMScrollerDidScrollNotification;
/* ....................................................................... */
/* ---[ WINGs/wlist.c ]--------------------------------------------------- */
WMList* WMCreateList(WMWidget *parent);
@@ -1237,7 +1240,7 @@ Bool WMListAllowsEmptySelection(WMList *lPtr);
extern char *WMListDidScrollNotification;
extern char *WMListSelectionDidChangeNotification;
/* ....................................................................... */
/* ---[ WINGs/wbrowser.c ]------------------------------------------------ */
WMBrowser* WMCreateBrowser(WMWidget *parent);
@@ -1305,7 +1308,7 @@ Bool WMBrowserAllowsEmptySelection(WMBrowser *bPtr);
void WMSetBrowserHasScroller(WMBrowser *bPtr, int hasScroller);
/* ....................................................................... */
/* ---[ WINGs/wmenuitem.c ]----------------------------------------------- */
Bool WMMenuItemIsSeparator(WMMenuItem *item);
@@ -1368,7 +1371,7 @@ WMMenu* WMGetMenuItemSubmenu(WMMenuItem *item);
Bool WMGetMenuItemHasSubmenu(WMMenuItem *item);
*/
/* ....................................................................... */
/* ---[ WINGs/wpopupbutton.c ]-------------------------------------------- */
WMPopUpButton* WMCreatePopUpButton(WMWidget *parent);
@@ -1405,24 +1408,7 @@ void WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag);
Bool WMGetPopUpButtonEnabled(WMPopUpButton *bPtr);
/* ....................................................................... */
WMProgressIndicator* WMCreateProgressIndicator(WMWidget *parent);
void WMSetProgressIndicatorMinValue(WMProgressIndicator *progressindicator, int value);
void WMSetProgressIndicatorMaxValue(WMProgressIndicator *progressindicator, int value);
void WMSetProgressIndicatorValue(WMProgressIndicator *progressindicator, int value);
int WMGetProgressIndicatorMinValue(WMProgressIndicator *progressindicator);
int WMGetProgressIndicatorMaxValue(WMProgressIndicator *progressindicator);
int WMGetProgressIndicatorValue(WMProgressIndicator *progressindicator);
/* ....................................................................... */
/* ---[ WINGs/wcolorpanel.c ]--------------------------------------------- */
WMColorPanel* WMGetColorPanel(WMScreen *scrPtr);
@@ -1442,7 +1428,7 @@ void WMSetColorPanelAction(WMColorPanel *panel, WMAction2 *action, void *data);
extern char *WMColorPanelColorChangedNotification;
/* ....................................................................... */
/* ---[ WINGs/wcolorwell.c ]---------------------------------------------- */
WMColorWell* WMCreateColorWell(WMWidget *parent);
@@ -1456,7 +1442,7 @@ void WSetColorWellBordered(WMColorWell *cPtr, Bool flag);
extern char *WMColorWellDidChangeNotification;
/* ...................................................................... */
/* ---[ WINGs/wscrollview.c ]--------------------------------------------- */
WMScrollView* WMCreateScrollView(WMWidget *parent);
@@ -1481,7 +1467,7 @@ void WMSetScrollViewLineScroll(WMScrollView *sPtr, int amount);
void WMSetScrollViewPageScroll(WMScrollView *sPtr, int amount);
/* ....................................................................... */
/* ---[ WINGs/wslider.c ]------------------------------------------------- */
WMSlider* WMCreateSlider(WMWidget *parent);
@@ -1505,7 +1491,7 @@ void WMSetSliderKnobThickness(WMSlider *sPtr, int thickness);
void WMSetSliderImage(WMSlider *sPtr, WMPixmap *pixmap);
/* ....................................................................... */
/* ---[ WINGs/wsplitview.c ]---------------------------------------------- */
WMSplitView* WMCreateSplitView(WMWidget *parent);
@@ -1699,8 +1685,7 @@ void* WMRemoveTextBlock(WMText *tPtr);
void WMDestroyTextBlock(WMText *tPtr, void *vtb);
/* ....................................................................... */
/* ---[ WINGs/wtabview.c ]------------------------------------------------ */
WMTabView* WMCreateTabView(WMWidget *parent);
@@ -1755,7 +1740,7 @@ WMView* WMGetTabViewItemView(WMTabViewItem *item);
void WMDestroyTabViewItem(WMTabViewItem *item);
/* ....................................................................... */
/* ---[ WINGs/wbox.c ]---------------------------------------------------- */
WMBox* WMCreateBox(WMWidget *parent);
@@ -1771,7 +1756,7 @@ void WMRemoveBoxSubview(WMBox *bPtr, WMView *view);
void WMSetBoxHorizontal(WMBox *box, Bool flag);
/* ....................................................................... */
/* ---[ WINGs/wpanel.c ]-------------------------------------------------- */
int WMRunAlertPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
char *defaultButton, char *alternateButton,
@@ -1800,7 +1785,7 @@ void WMDestroyInputPanel(WMInputPanel *panel);
void WMDestroyGenericPanel(WMGenericPanel *panel);
/* ....................................................................... */
/* ---[ WINGs/wfilepanel.c ]---------------------------------------------- */
/* only 1 instance per WMScreen */
WMOpenPanel* WMGetOpenPanel(WMScreen *scrPtr);
@@ -1828,7 +1813,7 @@ void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view);
WMView* WMGetFilePanelAccessoryView(WMFilePanel *panel);
/* ...................................................................... */
/* ---[ WINGs/wfontpanel.c ]---------------------------------------------- */
/* only 1 instance per WMScreen */
WMFontPanel* WMGetFontPanel(WMScreen *scr);

View File

@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#ifdef __cplusplus
@@ -29,7 +30,7 @@ extern "C" {
#define SCROLLER_WIDTH 20
#define XDND_VERSION 4
#define XDND_VERSION 3
typedef struct W_Application {
@@ -78,7 +79,7 @@ typedef struct W_Color {
typedef struct W_FocusInfo {
struct W_View *toplevel;
struct W_View *focused; /* view that has the focus in this toplevel */
struct W_View *focused; /* view that has the focus in this toplevel */
struct W_FocusInfo *next;
} W_FocusInfo;
@@ -110,8 +111,10 @@ typedef struct W_DragSourceInfo {
typedef struct W_DragDestinationInfo {
WMView *destView;
WMView *xdndAwareView;
Window sourceWindow;
W_DndState *state;
Bool sourceActionChanged;
WMArray *sourceTypes;
WMArray *requiredTypes;
Bool typeListAvailable;
@@ -120,7 +123,7 @@ typedef struct W_DragDestinationInfo {
struct W_DraggingInfo {
unsigned char protocolVersion;
unsigned char protocolVersion; /* version supported on the other side */
Time timestamp;
Atom sourceAction;
@@ -162,7 +165,7 @@ typedef struct W_Screen {
struct W_Window *windowList; /* list of windows in the app */
Window groupLeader; /* the leader of the application */
Window groupLeader; /* the leader of the application */
/* also used for other things */
struct W_SelectionHandlers *selectionHandlerList;
@@ -195,11 +198,11 @@ typedef struct W_Screen {
GC copyGC;
GC clipGC;
GC monoGC; /* GC for 1bpp visuals */
GC monoGC; /* GC for 1bpp visuals */
GC xorGC;
GC ixorGC; /* IncludeInferiors XOR */
GC ixorGC; /* IncludeInferiors XOR */
GC drawStringGC; /* for WMDrawString() */
@@ -276,15 +279,15 @@ typedef struct W_Screen {
Cursor invisibleCursor;
Atom attribsAtom; /* GNUstepWindowAttributes */
Atom attribsAtom; /* GNUstepWindowAttributes */
Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
Atom clipboardAtom; /* CLIPBOARD */
Atom clipboardAtom; /* CLIPBOARD */
Atom xdndAwareAtom; /* XdndAware */
Atom xdndAwareAtom; /* XdndAware */
Atom xdndSelectionAtom;
Atom xdndEnterAtom;
Atom xdndLeaveAtom;
@@ -304,7 +307,7 @@ typedef struct W_Screen {
Atom wmIconDragOffsetAtom;
Atom wmStateAtom; /* WM_STATE */
Atom wmStateAtom; /* WM_STATE */
Atom utf8String;
@@ -313,8 +316,8 @@ typedef struct W_Screen {
Atom netwmIcon;
/* stuff for detecting double-clicks */
Time lastClickTime; /* time of last mousedown event */
Window lastClickWindow; /* window of the last mousedown */
Time lastClickTime; /* time of last mousedown event */
Window lastClickWindow; /* window of the last mousedown */
struct W_View *modalView;
unsigned modalLoop:1;
@@ -341,8 +344,7 @@ typedef struct W_ViewDelegate {
typedef struct W_View {
struct W_Screen *screen;
WMWidget *self; /* must point to the widget the
* view belongs to */
WMWidget *self; /* must point to the widget the view belongs to */
W_ViewDelegate *delegate;
@@ -362,18 +364,18 @@ typedef struct W_View {
struct W_View *nextResponder; /* next to receive keyboard events */
struct W_View *parent; /* parent WMView */
struct W_View *parent; /* parent WMView */
struct W_View *childrenList; /* first in list of child windows */
struct W_View *nextSister; /* next on parent's children list */
struct W_View *nextSister; /* next on parent's children list */
WMArray *eventHandlers; /* event handlers for this window */
WMArray *eventHandlers; /* event handlers for this window */
unsigned long attribFlags;
XSetWindowAttributes attribs;
void *hangedData; /* data holder for user program */
void *hangedData; /* data holder for user program */
WMColor *backColor;
@@ -391,9 +393,9 @@ typedef struct W_View {
unsigned int realized:1;
unsigned int mapped:1;
unsigned int parentDying:1;
unsigned int dying:1; /* the view is being destroyed */
unsigned int dying:1; /* the view is being destroyed */
unsigned int topLevel:1; /* is a top level window */
unsigned int root:1; /* is the root window */
unsigned int root:1; /* is the root window */
unsigned int mapWhenRealized:1; /* map the view when it's realized */
unsigned int alreadyDead:1; /* view was freed */
@@ -589,13 +591,13 @@ Bool W_SendDnDClientMessage(Display *dpy, Window win, Atom message,
void W_DragSourceStartTimer(WMDraggingInfo *info);
void W_DragSourceStopTimer();
void W_DragSourceStopTimer(void);
void W_DragSourceStateHandler(WMDraggingInfo *info, XClientMessageEvent *event);
void W_DragDestinationStartTimer(WMDraggingInfo *info);
void W_DragDestinationStopTimer();
void W_DragDestinationStopTimer(void);
void W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info, WMView *toplevel,
XClientMessageEvent *event);

View File

@@ -28,6 +28,9 @@
# endif
#endif
#ifndef __GNUC__
#define __attribute__(x) /*NOTHING*/
#endif
#ifdef NDEBUG
@@ -83,27 +86,6 @@ typedef enum {
} WMNotificationCoalescing;
/* The possible states for connections */
typedef enum {
WCNotConnected=0,
WCListening,
WCInProgress,
WCFailed,
WCConnected,
WCTimedOut,
WCDied,
WCClosed
} WMConnectionState;
/* The possible states for connection timeouts */
typedef enum {
WCTNone=0,
WCTWhileOpening,
WCTWhileSending
} WMConnectionTimeoutState;
enum {
WBNotFound = INT_MIN, /* element was not found in WMBag */
@@ -135,11 +117,12 @@ typedef void WMInputProc(int fd, int mask, void *clientData);
typedef int WMCompareDataProc(const void *item1, const void *item2);
typedef void WMTreeWalkProc(WMTreeNode *aNode, void *data);
typedef void WMFreeDataProc(void *data);
/* Used by WMBag or WMArray for matching data */
typedef int WMMatchDataProc(void *item, void *cdata);
typedef int WMMatchDataProc(const void *item, const void *cdata);
@@ -174,53 +157,41 @@ typedef int WMArrayIterator;
typedef void *WMBagIterator;
#if 0
typedef struct {
char character; /* the escape character */
char *value; /* value to place */
} WMSEscapes;
#endif
/* The connection callbacks */
typedef struct ConnectionDelegate {
void *data;
void (*canResumeSending)(struct ConnectionDelegate *self, WMConnection *cPtr);
void (*didCatchException)(struct ConnectionDelegate *self, WMConnection *cPtr);
void (*didDie)(struct ConnectionDelegate *self, WMConnection *cPtr);
void (*didInitialize)(struct ConnectionDelegate *self, WMConnection *cPtr);
void (*didReceiveInput)(struct ConnectionDelegate *self, WMConnection *cPtr);
void (*didTimeout)(struct ConnectionDelegate *self, WMConnection *cPtr);
} ConnectionDelegate;
typedef void WMNotificationObserverAction(void *observerData,
WMNotification *notification);
/* ---[ WINGs/memory.c ]-------------------------------------------------- */
/*......................................................................*/
void* wmalloc(size_t size);
void* wrealloc(void *ptr, size_t newsize);
void wfree(void *ptr);
void wrelease(void *ptr);
void* wretain(void *ptr);
typedef void waborthandler(int);
waborthandler* wsetabort(waborthandler* handler);
/* ---[ WINGs/error.c ]--------------------------------------------------- */
/* don't free the returned string */
char* wstrerror(int errnum);
enum {
WMESSAGE_TYPE_MESSAGE,
WMESSAGE_TYPE_WARNING,
WMESSAGE_TYPE_ERROR,
WMESSAGE_TYPE_FATAL
};
void wmessage(const char *msg, ...);
void wwarning(const char *msg, ...);
void wfatal(const char *msg, ...);
void wsyserror(const char *msg, ...);
void wsyserrorwithcode(int error, const char *msg, ...);
#define wmessage(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_MESSAGE, fmt, ## args)
#define wwarning(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_WARNING, fmt, ## args)
#define werror(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_ERROR, fmt, ## args)
#define wfatal(fmt, args...) __wmessage( __func__, __FILE__, __LINE__, WMESSAGE_TYPE_FATAL, fmt, ## args)
void __wmessage(const char *func, const char *file, int line, int type, const char *msg, ...)
__attribute__((__format__(printf,5,6)));
/* ---[ WINGs/findfile.c ]------------------------------------------------ */
char* wfindfile(char *paths, char *file);
@@ -230,22 +201,20 @@ char* wfindfileinarray(WMPropList* array, char *file);
char* wexpandpath(char *path);
int wcopy_file(char *toPath, char *srcFile, char *destFile);
/* don't free the returned string */
char* wgethomedir();
char* wgethomedir(void);
void* wmalloc(size_t size);
void* wmalloc0(size_t size);
void* wrealloc(void *ptr, size_t newsize);
void wfree(void *ptr);
/* ---[ WINGs/proplist.c ]------------------------------------------------ */
#define wnew(type, count) wmalloc(sizeof(type)*count)
#define wnew0(type, count) wmalloc0(sizeof(type)*count)
int wmkdirhier(const char *path);
int wrmdirhier(const char *path);
void wrelease(void *ptr);
void* wretain(void *ptr);
/* ---[ WINGs/string.c ]-------------------------------------------------- */
char* wstrdup(char *str);
char* wstrndup(char *str, size_t len);
char *wstrdup(const char *str);
char* wstrndup(const char *str, size_t len);
/* Concatenate str1 with str2 and return that in a newly malloc'ed string.
* str1 and str2 can be any strings including static and constant strings.
@@ -262,6 +231,9 @@ char* wstrconcat(char *str1, char *str2);
* so always assign the returned address to avoid dangling pointers. */
char* wstrappend(char *dst, char *src);
size_t wstrlcpy(char *, const char *, size_t);
size_t wstrlcat(char *, const char *, size_t);
void wtokensplit(char *command, char ***argv, int *argc);
@@ -271,27 +243,23 @@ char* wtokenjoin(char **list, int count);
void wtokenfree(char **tokens, int count);
char* wtrimspace(char *s);
char* wtrimspace(const char *s);
/* transform `s' so that the result is safe to pass to the shell as an argument.
* returns a newly allocated string.
* with very heavy inspirations from NetBSD's shquote(3).
*/
char *wshellquote(const char *s);
/* ---[ WINGs/wmisc.c ]--------------------------------------------------- */
WMRange wmkrange(int start, int count);
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
#define wmkrange(position, count) (WMRange){(position), (count)}
#endif
/* ---[ WINGs/usleep.c ]-------------------------------------------------- */
char* wusergnusteppath();
void wusleep(unsigned int usec);
char* wdefaultspathfordomain(char *domain);
void wusleep(unsigned int microsec);
#if 0
int wsprintesc(char *buffer, int length, char *format, WMSEscapes **escapes,
int count);
#endif
/*......................................................................*/
/* ---[ WINGs/handlers.c ]------------------------------------------------ */
/* Event handlers: timer, idle, input */
@@ -320,9 +288,9 @@ void WMDeleteInputHandler(WMHandlerID handlerID);
* This function will handle all input/timer/idle events, then return.
*/
void WHandleEvents();
void WHandleEvents(void);
/*......................................................................*/
/* ---[ WINGs/hashtable.c ]----------------------------------------------- */
WMHashTable* WMCreateHashTable(WMHashTableCallbacks callbacks);
@@ -383,7 +351,7 @@ extern const WMHashTableCallbacks WMStringPointerHashCallbacks;
/* keys are strings, but they are not copied */
/*......................................................................*/
/* ---[ WINGs/array.c ]--------------------------------------------------- */
/*
* WMArray use an array to store the elements.
@@ -419,8 +387,6 @@ void WMAppendArray(WMArray *array, WMArray *other);
/* add will place the element at the end of the array */
void WMAddToArray(WMArray *array, void *item);
#define WMPushInArray(array, item) WMAddToArray(array, item)
/* insert will increment the index of elements after it by 1 */
void WMInsertInArray(WMArray *array, int index, void *item);
@@ -485,7 +451,7 @@ void* WMArrayPrevious(WMArray *array, WMArrayIterator *iter);
for (var = WMArrayLast(array, &(i)); (i) != WANotFound; \
var = WMArrayPrevious(array, &(i)))
/*..........................................................................*/
/* ---[ WINGs/bagtree.c ]------------------------------------------------- */
/*
* Tree bags use a red-black tree for storage.
@@ -577,7 +543,7 @@ int WMBagIndexForIterator(WMBag *bag, WMBagIterator ptr);
/*-------------------------------------------------------------------------*/
/* ---[ WINGs/data.c ]---------------------------------------------------- */
/* WMData handling */
@@ -646,8 +612,7 @@ void WMSetDataFormat(WMData *aData, unsigned format);
unsigned WMGetDataFormat(WMData *aData);
/* Storing data */
/*--------------------------------------------------------------------------*/
/* ---[ WINGs/tree.c ]---------------------------------------------------- */
/* Generic Tree and TreeNode */
@@ -686,11 +651,17 @@ void WMSortTree(WMTreeNode *aNode, WMCompareDataProc *comparer);
/* Returns the first node which matches node's data with cdata by 'match' */
WMTreeNode* WMFindInTree(WMTreeNode *aTree, WMMatchDataProc *match, void *cdata);
/* Returns the first node where node's data matches cdata by 'match' and node is
* at most `limit' depths down from `aTree'. */
WMTreeNode *WMFindInTreeWithDepthLimit(WMTreeNode * aTree, WMMatchDataProc * match, void *cdata, int limit);
/* Returns first tree node that has data == cdata */
#define WMGetFirstInTree(aTree, cdata) WMFindInTree(aTree, NULL, cdata)
/* Walk every node of aNode with `walk' */
void WMTreeWalk(WMTreeNode *aNode, WMTreeWalkProc * walk, void *data, Bool DepthFirst);
/*--------------------------------------------------------------------------*/
/* ---[ WINGs/data.c ]---------------------------------------------------- */
WMNotification* WMCreateNotification(const char *name, void *object, void *clientData);
@@ -736,7 +707,7 @@ void WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
unsigned coalesceMask);
/*......................................................................*/
/* ---[ WINGs/proplist.c ]------------------------------------------------ */
/* Property Lists handling */
@@ -836,9 +807,15 @@ char* WMGetPropListDescription(WMPropList *plist, Bool indented);
WMPropList* WMReadPropListFromFile(char *file);
Bool WMWritePropListToFile(WMPropList *plist, char *path, Bool atomically);
Bool WMWritePropListToFile(WMPropList *plist, char *path);
/*......................................................................*/
/* ---[ WINGs/userdefaults.c ]-------------------------------------------- */
char* wusergnusteppath(void);
char* wdefaultspathfordomain(char *domain);
char* wglobaldefaultspathfordomain(const char *domain);
WMUserDefaults* WMGetStandardUserDefaults(void);
@@ -891,135 +868,6 @@ extern char *WMUserDefaultsDidChangeNotification;
/*-------------------------------------------------------------------------*/
/* WMHost: host handling */
WMHost* WMGetCurrentHost();
WMHost* WMGetHostWithName(char* name);
WMHost* WMGetHostWithAddress(char* address);
WMHost* WMRetainHost(WMHost *hPtr);
void WMReleaseHost(WMHost *hPtr);
/*
* Host cache management
* If enabled, only one object representing each host will be created, and
* a shared instance will be returned by all methods that return a host.
* Enabled by default.
*/
void WMSetHostCacheEnabled(Bool flag);
Bool WMIsHostCacheEnabled();
void WMFlushHostCache();
/*
* Compare hosts: Hosts are equal if they share at least one address
*/
Bool WMIsHostEqualToHost(WMHost* hPtr, WMHost* anotherHost);
/*
* Host names.
* WMGetHostName() will return first name (official) if a host has several.
* WMGetHostNames() will return a R/O WMArray with all the names of the host.
*/
char* WMGetHostName(WMHost* hPtr);
/* The returned array is R/O. Do not modify it, and do not free it! */
WMArray* WMGetHostNames(WMHost* hPtr);
/*
* Host addresses.
* Addresses are represented as "Dotted Decimal" strings, e.g. "192.42.172.1"
* WMGetHostAddress() will return an arbitrary address if a host has several.
* WMGetHostAddresses() will return a R/O WMArray with all addresses of the host.
*/
char* WMGetHostAddress(WMHost* hPtr);
/* The returned array is R/O. Do not modify it, and do not free it! */
WMArray* WMGetHostAddresses(WMHost* hPtr);
/*-------------------------------------------------------------------------*/
/* WMConnection functions */
WMConnection* WMCreateConnectionAsServerAtAddress(char *host, char *service,
char *protocol);
WMConnection* WMCreateConnectionToAddress(char *host, char *service,
char *protocol);
WMConnection* WMCreateConnectionToAddressAndNotify(char *host, char *service,
char *protocol);
void WMCloseConnection(WMConnection *cPtr);
void WMDestroyConnection(WMConnection *cPtr);
WMConnection* WMAcceptConnection(WMConnection *listener);
/* Release the returned data! */
WMData* WMGetConnectionAvailableData(WMConnection *cPtr);
int WMSendConnectionData(WMConnection *cPtr, WMData *data);
Bool WMEnqueueConnectionData(WMConnection *cPtr, WMData *data);
#define WMFlushConnection(cPtr) WMSendConnectionData((cPtr), NULL)
void WMSetConnectionDelegate(WMConnection *cPtr, ConnectionDelegate *delegate);
/* Connection info */
char* WMGetConnectionAddress(WMConnection *cPtr);
char* WMGetConnectionService(WMConnection *cPtr);
char* WMGetConnectionProtocol(WMConnection *cPtr);
Bool WMSetConnectionNonBlocking(WMConnection *cPtr, Bool flag);
Bool WMSetConnectionCloseOnExec(WMConnection *cPtr, Bool flag);
void WMSetConnectionShutdownOnClose(WMConnection *cPtr, Bool flag);
void* WMGetConnectionClientData(WMConnection *cPtr);
void WMSetConnectionClientData(WMConnection *cPtr, void *data);
unsigned int WMGetConnectionFlags(WMConnection *cPtr);
void WMSetConnectionFlags(WMConnection *cPtr, unsigned int flags);
int WMGetConnectionSocket(WMConnection *cPtr);
WMConnectionState WMGetConnectionState(WMConnection *cPtr);
WMConnectionTimeoutState WMGetConnectionTimeoutState(WMConnection *cPtr);
WMArray* WMGetConnectionUnsentData(WMConnection *cPtr);
#define WMGetConnectionQueuedData(cPtr) WMGetConnectionUnsentData(cPtr)
/*
* Passing timeout==0 in the SetTimeout functions below, will reset that
* timeout to its default value.
*/
/* The default timeout inherited by all WMConnection operations, if none set */
void WMSetConnectionDefaultTimeout(unsigned int timeout);
/* Global timeout for all WMConnection objects, for opening a new connection */
void WMSetConnectionOpenTimeout(unsigned int timeout);
/* Connection specific timeout for sending out data */
void WMSetConnectionSendTimeout(WMConnection *cPtr, unsigned int timeout);
/* Global variables */
extern int WCErrorCode;
@@ -1027,8 +875,6 @@ extern int WCErrorCode;
/*-------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -1,138 +0,0 @@
/*
* This header file is provided for old libPropList compatibility.
* DO _NOT_ USE this except for letting your old libPropList-based code to
* work with the new property list code from WINGs, with minimal changes.
*
* All code written with old libPropList functions should work, given
* that the following changes are made:
*
* 1. Replace all
* #include <proplist.h>
* with
* #include <WINGs/proplist-compat.h>
* in your code.
*
* 2. Change all calls to PLSave() to have the extra filename parameter like:
* PLSave(proplist_t proplist, char* filename, Bool atomically)
*
* 3. The PLSetStringCmpHook() function is no longer available. There is a
* similar but simpler function provided which is enough for practical
* purposes:
* PLSetCaseSensitive(Bool caseSensitive)
*
* 4. The following functions do no longer exist. They were removed because
* they were based on concepts borrowed from UserDefaults which conflict
* with the retain/release mechanism:
* PLSynchronize(), PLDeepSynchronize(), PLShallowSynchronize()
* PLSetFilename(), PLGetFilename()
* PLGetContainer()
* You should change your code to not use them anymore.
*
* 5. The following functions are no longer available. They were removed
* because they also used borrowed concepts which have no place in a
* property list as defined in the OpenStep specifications. Also these
* functions were hardly ever used in programs to our knowledge.
* PLGetDomainNames(), PLGetDomain(), PLSetDomain(), PLDeleteDomain()
* PLRegister(), PLUnregister()
* You should also change your code to not use them anymore (in case you
* ever used them anyway ;-) ).
*
* 6. Link your program with libWINGs or libWUtil instead of libPropList.
* (libWINGs should be used for GUI apps, while libWUtil for non-GUI apps)
*
*
* Our recommandation is to rewrite your code to use the new functions and
* link against libWINGs/libWUtil. We do not recommend you to keep using old
* libPropList function names. This file is provided just to allow existing
* libropList based applications to run with minimal changes with the new
* proplist code from WINGs before their authors get the time to rewrite
* them. New proplist code from WINGs provide a better integration with the
* other data types from WINGs, not to mention that the proplist code in WINGs
* is actively maintained while the old libPropList is dead.
*
*/
#ifndef _PROPLIST_COMPAT_H_
#define _PROPLIST_COMPAT_H_
#include <WINGs/WUtil.h>
typedef WMPropList* proplist_t;
#ifndef YES
#define YES True
#endif
#ifndef NO
#define NO False
#endif
#define PLSetCaseSensitive(c) WMPLSetCaseSensitive(c)
#define PLMakeString(bytes) WMCreatePLString(bytes)
#define PLMakeData(bytes, length) WMCreatePLDataWithBytes(bytes, length)
#define PLMakeArrayFromElements WMCreatePLArray
#define PLMakeDictionaryFromEntries WMCreatePLDictionary
#define PLRetain(pl) WMRetainPropList(pl)
#define PLRelease(pl) WMReleasePropList(pl)
#define PLInsertArrayElement(array, pl, pos) WMInsertInPLArray(array, pos, pl)
#define PLAppendArrayElement(array, pl) WMAddToPLArray(array, pl)
#define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
#define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
#define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source, False)
#define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
#define PLIsString(pl) WMIsPLString(pl)
#define PLIsData(pl) WMIsPLData(pl)
#define PLIsArray(pl) WMIsPLArray(pl)
#define PLIsDictionary(pl) WMIsPLDictionary(pl)
#define PLIsSimple(pl) (WMIsPLString(pl) || WMIsPLData(pl))
#define PLIsCompound(pl) (WMIsPLArray(pl) || WMIsPLDictionary(pl))
#define PLIsEqual(pl1, pl2) WMIsPropListEqualTo(pl1, pl2)
#define PLGetString(pl) WMGetFromPLString(pl)
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
#define PLGetDataLength(pl) WMGetPLDataLength(pl)
#define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
#define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
#define PLShallowCopy(pl) WMShallowCopyPropList(pl)
#define PLDeepCopy(pl) WMDeepCopyPropList(pl)
#define PLGetProplistWithDescription(desc) WMCreatePropListFromDescription(desc)
#define PLGetDescriptionIndent(pl, level) WMGetPropListDescription(pl, True)
#define PLGetDescription(pl) WMGetPropListDescription(pl, False)
#define PLGetStringDescription(pl) WMGetPropListDescription(pl, False)
#define PLGetDataDescription(pl) WMGetPropListDescription(pl, False)
#define PLGetProplistWithPath(file) WMReadPropListFromFile(file)
#define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
/* Unsupported functions. Do not ask for them. They're evil :P */
#define PLSetStringCmpHook(fn) error_PLSetStringCmpHook_is_not_supported
#define PLDeepSynchronize(pl) error_PLDeepSynchronize_is_not_supported
#define PLSynchronize(pl) error_PLSynchronize_is_not_supported
#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
#define PLGetContainer(pl) error_PLGetContainer_is_not_supported
#define PLGetDomainNames error_PLGetDomainNames_is_not_supported
#define PLGetDomain(name) error_PLGetDomain_is_not_supported
#define PLSetDomain(name, value, kickme) error_PLSetDomain_is_not_supported
#define PLDeleteDomain(name, kickme) error_PLDeleteDomain_is_not_supported
#define PLRegister(name, callback) error_PLRegister_is_not_supported
#define PLUnregister(name) error_PLUnregister_is_not_supported
#endif

View File

@@ -1,368 +1,314 @@
/*
* Dynamically Resized Array
*
* Authors: Alfredo K. Kojima <kojima@windowmaker.org>
* Dan Pascu <dan@windowmaker.org>
* Authors: Alfredo K. Kojima <kojima@windowmaker.info>
* Dan Pascu <dan@windowmaker.info>
*
* This code is released to the Public Domain, but
* proper credit is always appreciated :)
*/
#include <stdlib.h>
#include <string.h>
#include "WUtil.h"
#define INITIAL_SIZE 8
#define RESIZE_INCREMENT 8
typedef struct W_Array {
void **items; /* the array data */
int itemCount; /* # of items in array */
int allocSize; /* allocated size of array */
WMFreeDataProc *destructor; /* the destructor to free elements */
void **items; /* the array data */
int itemCount; /* # of items in array */
int allocSize; /* allocated size of array */
WMFreeDataProc *destructor; /* the destructor to free elements */
} W_Array;
WMArray*
WMCreateArray(int initialSize)
WMArray *WMCreateArray(int initialSize)
{
return WMCreateArrayWithDestructor(initialSize, NULL);
return WMCreateArrayWithDestructor(initialSize, NULL);
}
WMArray*
WMCreateArrayWithDestructor(int initialSize, WMFreeDataProc *destructor)
WMArray *WMCreateArrayWithDestructor(int initialSize, WMFreeDataProc * destructor)
{
WMArray *array;
WMArray *array;
array = wmalloc(sizeof(WMArray));
array = wmalloc(sizeof(WMArray));
if (initialSize <= 0) {
initialSize = INITIAL_SIZE;
}
if (initialSize <= 0) {
initialSize = INITIAL_SIZE;
}
array->items = wmalloc(sizeof(void*) * initialSize);
array->items = wmalloc(sizeof(void *) * initialSize);
array->itemCount = 0;
array->allocSize = initialSize;
array->destructor = destructor;
array->itemCount = 0;
array->allocSize = initialSize;
array->destructor = destructor;
return array;
return array;
}
WMArray*
WMCreateArrayWithArray(WMArray *array)
WMArray *WMCreateArrayWithArray(WMArray * array)
{
WMArray *newArray;
WMArray *newArray;
newArray = wmalloc(sizeof(WMArray));
newArray = wmalloc(sizeof(WMArray));
newArray->items = wmalloc(sizeof(void*) * array->allocSize);
memcpy(newArray->items, array->items, sizeof(void*)*array->itemCount);
newArray->items = wmalloc(sizeof(void *) * array->allocSize);
memcpy(newArray->items, array->items, sizeof(void *) * array->itemCount);
newArray->itemCount = array->itemCount;
newArray->allocSize = array->allocSize;
newArray->destructor = NULL;
newArray->itemCount = array->itemCount;
newArray->allocSize = array->allocSize;
newArray->destructor = NULL;
return newArray;
return newArray;
}
void
WMEmptyArray(WMArray *array)
void WMEmptyArray(WMArray * array)
{
if (array->destructor) {
while (array->itemCount > 0) {
array->itemCount--;
array->destructor(array->items[array->itemCount]);
}
}
/*memset(array->items, 0, array->itemCount * sizeof(void*));*/
array->itemCount = 0;
if (array->destructor) {
while (array->itemCount > 0) {
array->itemCount--;
array->destructor(array->items[array->itemCount]);
}
}
/*memset(array->items, 0, array->itemCount * sizeof(void*)); */
array->itemCount = 0;
}
void
WMFreeArray(WMArray *array)
void WMFreeArray(WMArray * array)
{
WMEmptyArray(array);
wfree(array->items);
wfree(array);
WMEmptyArray(array);
wfree(array->items);
wfree(array);
}
int
WMGetArrayItemCount(WMArray *array)
int WMGetArrayItemCount(WMArray * array)
{
return array->itemCount;
return array->itemCount;
}
void
WMAppendArray(WMArray *array, WMArray *other)
void WMAppendArray(WMArray * array, WMArray * other)
{
if (other->itemCount == 0)
return;
if (other->itemCount == 0)
return;
if (array->itemCount + other->itemCount > array->allocSize) {
array->allocSize += other->allocSize;
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
}
if (array->itemCount + other->itemCount > array->allocSize) {
array->allocSize += other->allocSize;
array->items = wrealloc(array->items, sizeof(void *) * array->allocSize);
}
memcpy(array->items+array->itemCount, other->items,
sizeof(void*)*other->itemCount);
array->itemCount += other->itemCount;
memcpy(array->items + array->itemCount, other->items, sizeof(void *) * other->itemCount);
array->itemCount += other->itemCount;
}
void
WMAddToArray(WMArray *array, void *item)
void WMAddToArray(WMArray * array, void *item)
{
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
}
array->items[array->itemCount] = item;
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void *) * array->allocSize);
}
array->items[array->itemCount] = item;
array->itemCount++;
array->itemCount++;
}
void
WMInsertInArray(WMArray *array, int index, void *item)
void WMInsertInArray(WMArray * array, int index, void *item)
{
wassertr(index >= 0 && index <= array->itemCount);
wassertr(index >= 0 && index <= array->itemCount);
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
}
if (index < array->itemCount) {
memmove(array->items+index+1, array->items+index,
sizeof(void*)*(array->itemCount-index));
}
array->items[index] = item;
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void *) * array->allocSize);
}
if (index < array->itemCount) {
memmove(array->items + index + 1, array->items + index,
sizeof(void *) * (array->itemCount - index));
}
array->items[index] = item;
array->itemCount++;
array->itemCount++;
}
void*
WMReplaceInArray(WMArray *array, int index, void *item)
void *WMReplaceInArray(WMArray * array, int index, void *item)
{
void *old;
void *old;
wassertrv(index >= 0 && index <= array->itemCount, NULL);
wassertrv(index >= 0 && index <= array->itemCount, NULL);
/* is it really useful to perform append if index == array->itemCount ? -Dan */
if (index == array->itemCount) {
WMAddToArray(array, item);
return NULL;
}
/* is it really useful to perform append if index == array->itemCount ? -Dan */
if (index == array->itemCount) {
WMAddToArray(array, item);
return NULL;
}
old = array->items[index];
array->items[index] = item;
old = array->items[index];
array->items[index] = item;
return old;
return old;
}
int
WMDeleteFromArray(WMArray *array, int index)
int WMDeleteFromArray(WMArray * array, int index)
{
wassertrv(index >= 0 && index < array->itemCount, 0);
wassertrv(index >= 0 && index < array->itemCount, 0);
if (array->destructor) {
array->destructor(array->items[index]);
}
if (array->destructor) {
array->destructor(array->items[index]);
}
if (index < array->itemCount-1) {
memmove(array->items+index, array->items+index+1,
sizeof(void*)*(array->itemCount-index-1));
}
if (index < array->itemCount - 1) {
memmove(array->items + index, array->items + index + 1,
sizeof(void *) * (array->itemCount - index - 1));
}
array->itemCount--;
array->itemCount--;
return 1;
return 1;
}
int
WMRemoveFromArrayMatching(WMArray *array, WMMatchDataProc *match, void *cdata)
int WMRemoveFromArrayMatching(WMArray * array, WMMatchDataProc * match, void *cdata)
{
int i;
int i;
if (match != NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match)(array->items[i], cdata)) {
WMDeleteFromArray(array, i);
return 1;
}
}
} else {
for (i = 0; i < array->itemCount; i++) {
if (array->items[i] == cdata) {
WMDeleteFromArray(array, i);
return 1;
}
}
}
if (match != NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match) (array->items[i], cdata)) {
WMDeleteFromArray(array, i);
return 1;
}
}
} else {
for (i = 0; i < array->itemCount; i++) {
if (array->items[i] == cdata) {
WMDeleteFromArray(array, i);
return 1;
}
}
}
return 0;
return 0;
}
void*
WMGetFromArray(WMArray *array, int index)
void *WMGetFromArray(WMArray * array, int index)
{
if (index < 0 || index >= array->itemCount)
return NULL;
if (index < 0 || index >= array->itemCount)
return NULL;
return array->items[index];
return array->items[index];
}
void*
WMPopFromArray(WMArray *array)
void *WMPopFromArray(WMArray * array)
{
array->itemCount--;
array->itemCount--;
return array->items[array->itemCount];
return array->items[array->itemCount];
}
int
WMFindInArray(WMArray *array, WMMatchDataProc *match, void *cdata)
int WMFindInArray(WMArray * array, WMMatchDataProc * match, void *cdata)
{
int i;
int i;
if (match!=NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match)(array->items[i], cdata))
return i;
}
} else {
for (i = 0; i < array->itemCount; i++) {
if (array->items[i] == cdata)
return i;
}
}
if (match != NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match) (array->items[i], cdata))
return i;
}
} else {
for (i = 0; i < array->itemCount; i++) {
if (array->items[i] == cdata)
return i;
}
}
return WANotFound;
return WANotFound;
}
int
WMCountInArray(WMArray *array, void *item)
int WMCountInArray(WMArray * array, void *item)
{
int i, count;
int i, count;
for (i=0, count=0; i<array->itemCount; i++) {
if (array->items[i] == item)
count++;
}
for (i = 0, count = 0; i < array->itemCount; i++) {
if (array->items[i] == item)
count++;
}
return count;
return count;
}
void
WMSortArray(WMArray *array, WMCompareDataProc *comparer)
void WMSortArray(WMArray * array, WMCompareDataProc * comparer)
{
if (array->itemCount > 1) { /* Don't sort empty or single element arrays */
qsort(array->items, array->itemCount, sizeof(void*), comparer);
}
if (array->itemCount > 1) { /* Don't sort empty or single element arrays */
qsort(array->items, array->itemCount, sizeof(void *), comparer);
}
}
void
WMMapArray(WMArray *array, void (*function)(void*, void*), void *data)
void WMMapArray(WMArray * array, void (*function) (void *, void *), void *data)
{
int i;
int i;
for (i=0; i<array->itemCount; i++) {
(*function)(array->items[i], data);
}
for (i = 0; i < array->itemCount; i++) {
(*function) (array->items[i], data);
}
}
WMArray*
WMGetSubarrayWithRange(WMArray* array, WMRange aRange)
WMArray *WMGetSubarrayWithRange(WMArray * array, WMRange aRange)
{
WMArray *newArray;
WMArray *newArray;
if (aRange.count <= 0)
return WMCreateArray(0);
if (aRange.count <= 0)
return WMCreateArray(0);
if (aRange.position < 0)
aRange.position = 0;
if (aRange.position >= array->itemCount)
aRange.position = array->itemCount - 1;
if (aRange.position + aRange.count > array->itemCount)
aRange.count = array->itemCount - aRange.position;
if (aRange.position < 0)
aRange.position = 0;
if (aRange.position >= array->itemCount)
aRange.position = array->itemCount - 1;
if (aRange.position + aRange.count > array->itemCount)
aRange.count = array->itemCount - aRange.position;
newArray = WMCreateArray(aRange.count);
memcpy(newArray->items, array->items+aRange.position,
sizeof(void*)*aRange.count);
newArray->itemCount = aRange.count;
newArray = WMCreateArray(aRange.count);
memcpy(newArray->items, array->items + aRange.position, sizeof(void *) * aRange.count);
newArray->itemCount = aRange.count;
return newArray;
return newArray;
}
void*
WMArrayFirst(WMArray *array, WMArrayIterator *iter)
void *WMArrayFirst(WMArray * array, WMArrayIterator * iter)
{
if (array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
*iter = 0;
return array->items[0];
}
if (array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
*iter = 0;
return array->items[0];
}
}
void*
WMArrayLast(WMArray *array, WMArrayIterator *iter)
void *WMArrayLast(WMArray * array, WMArrayIterator * iter)
{
if (array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
*iter = array->itemCount-1;
return array->items[*iter];
}
if (array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
*iter = array->itemCount - 1;
return array->items[*iter];
}
}
void*
WMArrayNext(WMArray *array, WMArrayIterator *iter)
void *WMArrayNext(WMArray * array, WMArrayIterator * iter)
{
if (*iter >= 0 && *iter < array->itemCount-1) {
return array->items[++(*iter)];
} else {
*iter = WANotFound;
return NULL;
}
if (*iter >= 0 && *iter < array->itemCount - 1) {
return array->items[++(*iter)];
} else {
*iter = WANotFound;
return NULL;
}
}
void*
WMArrayPrevious(WMArray *array, WMArrayIterator *iter)
void *WMArrayPrevious(WMArray * array, WMArrayIterator * iter)
{
if (*iter > 0 && *iter < array->itemCount) {
return array->items[--(*iter)];
} else {
*iter = WANotFound;
return NULL;
}
if (*iter > 0 && *iter < array->itemCount) {
return array->items[--(*iter)];
} else {
*iter = WANotFound;
return NULL;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,122 +1,117 @@
#include "WINGsP.h"
#include "wconfig.h"
#include <X11/Xlocale.h>
_WINGsConfiguration WINGsConfiguration;
#define SYSTEM_FONT "Trebuchet MS,Luxi Sans"
#define BOLD_SYSTEM_FONT "Trebuchet MS,Luxi Sans:bold"
#define SYSTEM_FONT "Trebuchet MS,sans serif"
#define BOLD_SYSTEM_FONT "Trebuchet MS,sans serif:bold"
#define DEFAULT_FONT_SIZE 12
#define FLOPPY_PATH "/floppy"
static unsigned
getButtonWithName(const char *name, unsigned defaultButton)
static unsigned getButtonWithName(const char *name, unsigned defaultButton)
{
if (strncmp(name, "Button", 6)==0 && strlen(name)==7) {
switch (name[6]) {
case '1':
return Button1;
case '2':
return Button2;
case '3':
return Button3;
case '4':
return Button4;
case '5':
return Button5;
default:
break;
}
}
if (strncmp(name, "Button", 6) == 0 && strlen(name) == 7) {
switch (name[6]) {
case '1':
return Button1;
case '2':
return Button2;
case '3':
return Button3;
case '4':
return Button4;
case '5':
return Button5;
default:
break;
}
}
return defaultButton;
return defaultButton;
}
void
W_ReadConfigurations(void)
void W_ReadConfigurations(void)
{
WMUserDefaults *defaults;
WMUserDefaults *defaults;
Bool aaIsSet = False;
memset(&WINGsConfiguration, 0, sizeof(_WINGsConfiguration));
memset(&WINGsConfiguration, 0, sizeof(_WINGsConfiguration));
defaults = WMGetStandardUserDefaults();
defaults = WMGetStandardUserDefaults();
if (defaults) {
char *buttonName;
unsigned button;
if (defaults) {
char *buttonName;
WMPropList *val;
unsigned button;
WINGsConfiguration.systemFont =
WMGetUDStringForKey(defaults, "SystemFont");
WINGsConfiguration.systemFont = WMGetUDStringForKey(defaults, "SystemFont");
WINGsConfiguration.boldSystemFont =
WMGetUDStringForKey(defaults, "BoldSystemFont");
WINGsConfiguration.boldSystemFont = WMGetUDStringForKey(defaults, "BoldSystemFont");
WINGsConfiguration.antialiasedText =
WMGetUDBoolForKey(defaults, "AntialiasedText");
val = WMGetUDObjectForKey(defaults, "AntialiasedText");
if (val && WMIsPLString(val) && WMGetFromPLString(val)) {
aaIsSet = True;
WINGsConfiguration.antialiasedText =
WMGetUDBoolForKey(defaults, "AntialiasedText");
}
WINGsConfiguration.doubleClickDelay =
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
WINGsConfiguration.doubleClickDelay = WMGetUDIntegerForKey(defaults, "DoubleClickTime");
WINGsConfiguration.floppyPath =
WMGetUDStringForKey(defaults, "FloppyPath");
WINGsConfiguration.floppyPath = WMGetUDStringForKey(defaults, "FloppyPath");
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
if (buttonName) {
button = getButtonWithName(buttonName, Button4);
wfree(buttonName);
} else {
button = Button4;
}
WINGsConfiguration.mouseWheelUp = button;
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
if (buttonName) {
button = getButtonWithName(buttonName, Button4);
wfree(buttonName);
} else {
button = Button4;
}
WINGsConfiguration.mouseWheelUp = button;
buttonName = WMGetUDStringForKey(defaults, "MouseWheelDown");
if (buttonName) {
button = getButtonWithName(buttonName, Button5);
wfree(buttonName);
} else {
button = Button5;
}
WINGsConfiguration.mouseWheelDown = button;
buttonName = WMGetUDStringForKey(defaults, "MouseWheelDown");
if (buttonName) {
button = getButtonWithName(buttonName, Button5);
wfree(buttonName);
} else {
button = Button5;
}
WINGsConfiguration.mouseWheelDown = button;
if (WINGsConfiguration.mouseWheelDown==WINGsConfiguration.mouseWheelUp) {
WINGsConfiguration.mouseWheelUp = Button4;
WINGsConfiguration.mouseWheelDown = Button5;
}
if (WINGsConfiguration.mouseWheelDown == WINGsConfiguration.mouseWheelUp) {
WINGsConfiguration.mouseWheelUp = Button4;
WINGsConfiguration.mouseWheelDown = Button5;
}
WINGsConfiguration.defaultFontSize =
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
}
WINGsConfiguration.defaultFontSize = WMGetUDIntegerForKey(defaults, "DefaultFontSize");
}
if (!WINGsConfiguration.systemFont) {
WINGsConfiguration.systemFont = SYSTEM_FONT;
}
if (!WINGsConfiguration.boldSystemFont) {
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
}
if (WINGsConfiguration.defaultFontSize == 0) {
WINGsConfiguration.defaultFontSize = DEFAULT_FONT_SIZE;
}
if (!WINGsConfiguration.floppyPath) {
WINGsConfiguration.floppyPath = FLOPPY_PATH;
}
if (WINGsConfiguration.doubleClickDelay == 0) {
WINGsConfiguration.doubleClickDelay = 250;
}
if (WINGsConfiguration.mouseWheelUp == 0) {
WINGsConfiguration.mouseWheelUp = Button4;
}
if (WINGsConfiguration.mouseWheelDown == 0) {
WINGsConfiguration.mouseWheelDown = Button5;
}
if (!WINGsConfiguration.systemFont) {
WINGsConfiguration.systemFont = SYSTEM_FONT;
}
if (!WINGsConfiguration.boldSystemFont) {
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
}
if (WINGsConfiguration.defaultFontSize == 0) {
WINGsConfiguration.defaultFontSize = DEFAULT_FONT_SIZE;
}
if (!aaIsSet) {
WINGsConfiguration.antialiasedText = True;
}
if (!WINGsConfiguration.floppyPath) {
WINGsConfiguration.floppyPath = FLOPPY_PATH;
}
if (WINGsConfiguration.doubleClickDelay == 0) {
WINGsConfiguration.doubleClickDelay = 250;
}
if (WINGsConfiguration.mouseWheelUp == 0) {
WINGsConfiguration.mouseWheelUp = Button4;
}
if (WINGsConfiguration.mouseWheelDown == 0) {
WINGsConfiguration.mouseWheelDown = Button5;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -18,333 +18,272 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include "WUtil.h"
typedef struct W_Data {
unsigned length; /* How many bytes we have */
unsigned capacity; /* How many bytes it can hold */
unsigned growth; /* How much to grow */
void *bytes; /* Actual data */
unsigned retainCount;
WMFreeDataProc *destructor;
int format; /* 0, 8, 16 or 32 */
unsigned length; /* How many bytes we have */
unsigned capacity; /* How many bytes it can hold */
unsigned growth; /* How much to grow */
void *bytes; /* Actual data */
unsigned retainCount;
WMFreeDataProc *destructor;
int format; /* 0, 8, 16 or 32 */
} W_Data;
/* Creating and destroying data objects */
WMData*
WMCreateDataWithCapacity(unsigned capacity)
WMData *WMCreateDataWithCapacity(unsigned capacity)
{
WMData *aData;
WMData *aData;
aData = (WMData*)wmalloc(sizeof(WMData));
aData = (WMData *) wmalloc(sizeof(WMData));
if (capacity>0)
aData->bytes = wmalloc(capacity);
else
aData->bytes = NULL;
if (capacity > 0)
aData->bytes = wmalloc(capacity);
else
aData->bytes = NULL;
aData->capacity = capacity;
aData->growth = capacity/2 > 0 ? capacity/2 : 1;
aData->length = 0;
aData->retainCount = 1;
aData->format = 0;
aData->destructor = wfree;
aData->capacity = capacity;
aData->growth = capacity / 2 > 0 ? capacity / 2 : 1;
aData->length = 0;
aData->retainCount = 1;
aData->format = 0;
aData->destructor = wfree;
return aData;
return aData;
}
WMData*
WMCreateDataWithLength(unsigned length)
WMData *WMCreateDataWithLength(unsigned length)
{
WMData *aData;
WMData *aData;
aData = WMCreateDataWithCapacity(length);
if (length>0) {
memset(aData->bytes, 0, length);
aData->length = length;
}
aData = WMCreateDataWithCapacity(length);
if (length > 0) {
memset(aData->bytes, 0, length);
aData->length = length;
}
return aData;
return aData;
}
WMData*
WMCreateDataWithBytes(void *bytes, unsigned length)
WMData *WMCreateDataWithBytes(void *bytes, unsigned length)
{
WMData *aData;
WMData *aData;
aData = WMCreateDataWithCapacity(length);
aData->length = length;
memcpy(aData->bytes, bytes, length);
aData = WMCreateDataWithCapacity(length);
aData->length = length;
memcpy(aData->bytes, bytes, length);
return aData;
return aData;
}
WMData*
WMCreateDataWithBytesNoCopy(void *bytes, unsigned length,
WMFreeDataProc *destructor)
WMData *WMCreateDataWithBytesNoCopy(void *bytes, unsigned length, WMFreeDataProc * destructor)
{
WMData *aData;
WMData *aData;
aData = (WMData*)wmalloc(sizeof(WMData));
aData->length = length;
aData->capacity = length;
aData->growth = length/2 > 0 ? length/2 : 1;
aData->bytes = bytes;
aData->retainCount = 1;
aData->format = 0;
aData->destructor = destructor;
aData = (WMData *) wmalloc(sizeof(WMData));
aData->length = length;
aData->capacity = length;
aData->growth = length / 2 > 0 ? length / 2 : 1;
aData->bytes = bytes;
aData->retainCount = 1;
aData->format = 0;
aData->destructor = destructor;
return aData;
return aData;
}
WMData*
WMCreateDataWithData(WMData *aData)
WMData *WMCreateDataWithData(WMData * aData)
{
WMData *newData;
WMData *newData;
if (aData->length > 0) {
newData = WMCreateDataWithBytes(aData->bytes, aData->length);
} else {
newData = WMCreateDataWithCapacity(0);
}
newData->format = aData->format;
if (aData->length > 0) {
newData = WMCreateDataWithBytes(aData->bytes, aData->length);
} else {
newData = WMCreateDataWithCapacity(0);
}
newData->format = aData->format;
return newData;
return newData;
}
WMData*
WMRetainData(WMData *aData)
WMData *WMRetainData(WMData * aData)
{
aData->retainCount++;
return aData;
aData->retainCount++;
return aData;
}
void
WMReleaseData(WMData *aData)
void WMReleaseData(WMData * aData)
{
aData->retainCount--;
if (aData->retainCount > 0)
return;
if (aData->bytes!=NULL && aData->destructor!=NULL) {
aData->destructor(aData->bytes);
}
wfree(aData);
aData->retainCount--;
if (aData->retainCount > 0)
return;
if (aData->bytes != NULL && aData->destructor != NULL) {
aData->destructor(aData->bytes);
}
wfree(aData);
}
/* Adjusting capacity */
void
WMSetDataCapacity(WMData *aData, unsigned capacity)
void WMSetDataCapacity(WMData * aData, unsigned capacity)
{
if (aData->capacity != capacity) {
aData->bytes = wrealloc(aData->bytes, capacity);
aData->capacity = capacity;
aData->growth = capacity/2 > 0 ? capacity/2 : 1;
}
if (aData->length > capacity) {
aData->length = capacity;
}
if (aData->capacity != capacity) {
aData->bytes = wrealloc(aData->bytes, capacity);
aData->capacity = capacity;
aData->growth = capacity / 2 > 0 ? capacity / 2 : 1;
}
if (aData->length > capacity) {
aData->length = capacity;
}
}
void
WMSetDataLength(WMData *aData, unsigned length)
void WMSetDataLength(WMData * aData, unsigned length)
{
if (length > aData->capacity) {
WMSetDataCapacity(aData, length);
}
if (length > aData->length) {
memset((unsigned char*)aData->bytes + aData->length, 0,
length - aData->length);
}
aData->length = length;
if (length > aData->capacity) {
WMSetDataCapacity(aData, length);
}
if (length > aData->length) {
memset((unsigned char *)aData->bytes + aData->length, 0, length - aData->length);
}
aData->length = length;
}
void
WMSetDataFormat(WMData *aData, unsigned format)
void WMSetDataFormat(WMData * aData, unsigned format)
{
aData->format = format;
aData->format = format;
}
void
WMIncreaseDataLengthBy(WMData *aData, unsigned extraLength)
void WMIncreaseDataLengthBy(WMData * aData, unsigned extraLength)
{
WMSetDataLength(aData, aData->length + extraLength);
WMSetDataLength(aData, aData->length + extraLength);
}
/* Accessing data */
const void*
WMDataBytes(WMData *aData)
const void *WMDataBytes(WMData * aData)
{
return aData->bytes;
return aData->bytes;
}
void
WMGetDataBytes(WMData *aData, void *buffer)
void WMGetDataBytes(WMData * aData, void *buffer)
{
wassertr(aData->length > 0);
wassertr(aData->length > 0);
memcpy(buffer, aData->bytes, aData->length);
memcpy(buffer, aData->bytes, aData->length);
}
unsigned
WMGetDataFormat(WMData *aData)
unsigned WMGetDataFormat(WMData * aData)
{
return aData->format;
return aData->format;
}
void
WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length)
void WMGetDataBytesWithLength(WMData * aData, void *buffer, unsigned length)
{
wassertr(aData->length > 0);
wassertr(length <= aData->length);
wassertr(aData->length > 0);
wassertr(length <= aData->length);
memcpy(buffer, aData->bytes, length);
memcpy(buffer, aData->bytes, length);
}
void
WMGetDataBytesWithRange(WMData *aData, void *buffer, WMRange aRange)
void WMGetDataBytesWithRange(WMData * aData, void *buffer, WMRange aRange)
{
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length - aRange.position);
memcpy(buffer, (unsigned char*)aData->bytes + aRange.position,
aRange.count);
memcpy(buffer, (unsigned char *)aData->bytes + aRange.position, aRange.count);
}
WMData*
WMGetSubdataWithRange(WMData *aData, WMRange aRange)
WMData *WMGetSubdataWithRange(WMData * aData, WMRange aRange)
{
void *buffer;
WMData *newData;
void *buffer;
WMData *newData;
if (aRange.count <= 0)
return WMCreateDataWithCapacity(0);
if (aRange.count <= 0)
return WMCreateDataWithCapacity(0);
buffer = wmalloc(aRange.count);
WMGetDataBytesWithRange(aData, buffer, aRange);
newData = WMCreateDataWithBytesNoCopy(buffer, aRange.count, wfree);
newData->format = aData->format;
buffer = wmalloc(aRange.count);
WMGetDataBytesWithRange(aData, buffer, aRange);
newData = WMCreateDataWithBytesNoCopy(buffer, aRange.count, wfree);
newData->format = aData->format;
return newData;
return newData;
}
/* Testing data */
Bool
WMIsDataEqualToData(WMData *aData, WMData *anotherData)
Bool WMIsDataEqualToData(WMData * aData, WMData * anotherData)
{
if (aData->length != anotherData->length)
return False;
else if (!aData->bytes && !anotherData->bytes) /* both are empty */
return True;
else if (!aData->bytes || !anotherData->bytes) /* one of them is empty */
return False;
return (memcmp(aData->bytes, anotherData->bytes, aData->length)==0);
if (aData->length != anotherData->length)
return False;
else if (!aData->bytes && !anotherData->bytes) /* both are empty */
return True;
else if (!aData->bytes || !anotherData->bytes) /* one of them is empty */
return False;
return (memcmp(aData->bytes, anotherData->bytes, aData->length) == 0);
}
unsigned
WMGetDataLength(WMData *aData)
unsigned WMGetDataLength(WMData * aData)
{
return aData->length;
return aData->length;
}
/* Adding data */
void
WMAppendDataBytes(WMData *aData, void *bytes, unsigned length)
void WMAppendDataBytes(WMData * aData, void *bytes, unsigned length)
{
unsigned oldLength = aData->length;
unsigned newLength = oldLength + length;
unsigned oldLength = aData->length;
unsigned newLength = oldLength + length;
if (newLength > aData->capacity) {
unsigned nextCapacity = aData->capacity + aData->growth;
unsigned nextGrowth = aData->capacity ? aData->capacity : 1;
if (newLength > aData->capacity) {
unsigned nextCapacity = aData->capacity + aData->growth;
unsigned nextGrowth = aData->capacity ? aData->capacity : 1;
while (nextCapacity < newLength) {
unsigned tmp = nextCapacity + nextGrowth;
while (nextCapacity < newLength) {
unsigned tmp = nextCapacity + nextGrowth;
nextGrowth = nextCapacity;
nextCapacity = tmp;
}
WMSetDataCapacity(aData, nextCapacity);
aData->growth = nextGrowth;
}
memcpy((unsigned char*)aData->bytes + oldLength, bytes, length);
aData->length = newLength;
nextGrowth = nextCapacity;
nextCapacity = tmp;
}
WMSetDataCapacity(aData, nextCapacity);
aData->growth = nextGrowth;
}
memcpy((unsigned char *)aData->bytes + oldLength, bytes, length);
aData->length = newLength;
}
void
WMAppendData(WMData *aData, WMData *anotherData)
void WMAppendData(WMData * aData, WMData * anotherData)
{
if (anotherData->length > 0)
WMAppendDataBytes(aData, anotherData->bytes, anotherData->length);
if (anotherData->length > 0)
WMAppendDataBytes(aData, anotherData->bytes, anotherData->length);
}
/* Modifying data */
void
WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes)
void WMReplaceDataBytesInRange(WMData * aData, WMRange aRange, void *bytes)
{
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length - aRange.position);
memcpy((unsigned char*)aData->bytes + aRange.position, bytes, aRange.count);
memcpy((unsigned char *)aData->bytes + aRange.position, bytes, aRange.count);
}
void
WMResetDataBytesInRange(WMData *aData, WMRange aRange)
void WMResetDataBytesInRange(WMData * aData, WMRange aRange)
{
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length-aRange.position);
wassertr(aRange.position < aData->length);
wassertr(aRange.count <= aData->length - aRange.position);
memset((unsigned char*)aData->bytes + aRange.position, 0, aRange.count);
memset((unsigned char *)aData->bytes + aRange.position, 0, aRange.count);
}
void
WMSetData(WMData *aData, WMData *anotherData)
void WMSetData(WMData * aData, WMData * anotherData)
{
unsigned length = anotherData->length;
unsigned length = anotherData->length;
WMSetDataCapacity(aData, length);
if (length > 0)
memcpy(aData->bytes, anotherData->bytes, length);
aData->length = length;
WMSetDataCapacity(aData, length);
if (length > 0)
memcpy(aData->bytes, anotherData->bytes, length);
aData->length = length;
}
/* Storing data */

View File

@@ -1,276 +1,255 @@
#include "WINGsP.h"
#define VERSION_INFO(dragInfo) dragInfo->protocolVersion
#define XDND_SOURCE_VERSION(dragInfo) dragInfo->protocolVersion
#define XDND_DEST_INFO(dragInfo) dragInfo->destInfo
#define XDND_DEST_VIEW(dragInfo) dragInfo->destInfo->destView
#define XDND_DEST_VIEW_STORED(dragInfo) ((dragInfo->destInfo) != NULL)\
&& ((dragInfo->destInfo->destView) != NULL)
static Bool _WindowExists;
Atom
W_OperationToAction(WMScreen *scr, WMDragOperationType operation)
Atom W_OperationToAction(WMScreen * scr, WMDragOperationType operation)
{
switch (operation) {
case WDOperationNone:
return None;
switch (operation) {
case WDOperationNone:
return None;
case WDOperationCopy:
return scr->xdndActionCopy;
case WDOperationCopy:
return scr->xdndActionCopy;
case WDOperationMove:
return scr->xdndActionMove;
case WDOperationMove:
return scr->xdndActionMove;
case WDOperationLink:
return scr->xdndActionLink;
case WDOperationLink:
return scr->xdndActionLink;
case WDOperationAsk:
return scr->xdndActionAsk;
case WDOperationAsk:
return scr->xdndActionAsk;
case WDOperationPrivate:
return scr->xdndActionPrivate;
case WDOperationPrivate:
return scr->xdndActionPrivate;
default:
return None;
}
default:
return None;
}
}
WMDragOperationType
W_ActionToOperation(WMScreen *scr, Atom action)
WMDragOperationType W_ActionToOperation(WMScreen * scr, Atom action)
{
if (action == scr->xdndActionCopy) {
return WDOperationCopy;
if (action == scr->xdndActionCopy) {
return WDOperationCopy;
} else if (action == scr->xdndActionMove) {
return WDOperationMove;
} else if (action == scr->xdndActionMove) {
return WDOperationMove;
} else if (action == scr->xdndActionLink) {
return WDOperationLink;
} else if (action == scr->xdndActionLink) {
return WDOperationLink;
} else if (action == scr->xdndActionAsk) {
return WDOperationAsk;
} else if (action == scr->xdndActionAsk) {
return WDOperationAsk;
} else if (action == scr->xdndActionPrivate) {
return WDOperationPrivate;
} else if (action == scr->xdndActionPrivate) {
return WDOperationPrivate;
} else if (action == None) {
} else if (action == None) {
return WDOperationNone;
} else {
char *tmp = XGetAtomName(scr->display, action);
return WDOperationNone;
} else {
char *tmp = XGetAtomName(scr->display, action);
wwarning("unknown XDND action %s ", tmp);
XFree(tmp);
wwarning("unknown XDND action %s ", tmp);
XFree(tmp);
return WDOperationCopy;
}
return WDOperationCopy;
}
}
static void
freeDragOperationItem(void* item)
static void freeDragOperationItem(void *item)
{
wfree(item);
wfree(item);
}
WMArray*
WMCreateDragOperationArray(int initialSize)
WMArray *WMCreateDragOperationArray(int initialSize)
{
return WMCreateArrayWithDestructor(initialSize, freeDragOperationItem);
return WMCreateArrayWithDestructor(initialSize, freeDragOperationItem);
}
WMDragOperationItem*
WMCreateDragOperationItem(WMDragOperationType type, char* text)
WMDragOperationItem *WMCreateDragOperationItem(WMDragOperationType type, char *text)
{
W_DragOperationItem *result = wmalloc(sizeof(W_DragOperationItem));
W_DragOperationItem *result = wmalloc(sizeof(W_DragOperationItem));
result->type = type;
result->text = text;
result->type = type;
result->text = text;
return (WMDragOperationItem*) result;
return (WMDragOperationItem *) result;
}
WMDragOperationType
WMGetDragOperationItemType(WMDragOperationItem* item)
WMDragOperationType WMGetDragOperationItemType(WMDragOperationItem * item)
{
return ((W_DragOperationItem*)item)->type;
return ((W_DragOperationItem *) item)->type;
}
char*
WMGetDragOperationItemText(WMDragOperationItem* item)
char *WMGetDragOperationItemText(WMDragOperationItem * item)
{
return ((W_DragOperationItem*)item)->text;
return ((W_DragOperationItem *) item)->text;
}
static int
handleNoWindowXError(Display *dpy, XErrorEvent *errEvt)
static int handleNoWindowXError(Display * dpy, XErrorEvent * errEvt)
{
if (errEvt->error_code == BadWindow
|| errEvt->error_code == BadDrawable) {
_WindowExists = False;
return Success;
}
if (errEvt->error_code == BadWindow || errEvt->error_code == BadDrawable) {
_WindowExists = False;
return Success;
}
return errEvt->error_code;
return errEvt->error_code;
}
static Bool
windowExists(Display *dpy, Window win)
static Bool windowExists(Display * dpy, Window win)
{
void* previousErrorHandler;
XWindowAttributes attr;
void *previousErrorHandler;
XWindowAttributes attr;
XSynchronize(dpy, True);
previousErrorHandler = XSetErrorHandler(handleNoWindowXError);
_WindowExists = True;
XSynchronize(dpy, True);
previousErrorHandler = XSetErrorHandler(handleNoWindowXError);
_WindowExists = True;
/* can generate BadDrawable or BadWindow */
XGetWindowAttributes(dpy, win, &attr);
/* can generate BadDrawable or BadWindow */
XGetWindowAttributes(dpy, win, &attr);
XSetErrorHandler(previousErrorHandler);
XSynchronize(dpy, False);
return _WindowExists;
XSetErrorHandler(previousErrorHandler);
XSynchronize(dpy, False);
return _WindowExists;
}
Bool
W_SendDnDClientMessage(Display *dpy, Window win, Atom message,
unsigned long data0,
unsigned long data1,
unsigned long data2,
unsigned long data3,
unsigned long data4)
W_SendDnDClientMessage(Display * dpy, Window win, Atom message,
unsigned long data0,
unsigned long data1, unsigned long data2, unsigned long data3, unsigned long data4)
{
XEvent ev;
if (! windowExists(dpy, win)) {
wwarning("xdnd message target %d does no longer exist.", win);
return False; /* message not sent */
}
ev.type = ClientMessage;
ev.xclient.message_type = message;
ev.xclient.format = 32;
ev.xclient.window = win;
ev.xclient.data.l[0] = data0;
ev.xclient.data.l[1] = data1;
ev.xclient.data.l[2] = data2;
ev.xclient.data.l[3] = data3;
ev.xclient.data.l[4] = data4;
XSendEvent(dpy, win, False, 0, &ev);
XFlush(dpy);
return True; /* message sent */
}
static void
handleLeaveMessage(WMDraggingInfo *info)
{
if (XDND_DEST_INFO(info) != NULL) {
if (XDND_DEST_VIEW(info) != NULL) {
XDND_DEST_VIEW(info)->dragDestinationProcs->concludeDragOperation(
XDND_DEST_VIEW(info));
}
W_DragDestinationInfoClear(info);
}
}
void
W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
{
WMScreen *scr = W_VIEW_SCREEN(toplevel);
WMDraggingInfo *info = &scr->dragInfo;
Atom messageType = event->message_type;
XEvent ev;
#ifdef XDND_DEBUG
{
char* msgTypeName = XGetAtomName(scr->display, messageType);
char *msgName = XGetAtomName(dpy, message);
if (msgTypeName != NULL)
printf("event type = %s\n", msgTypeName);
else
printf("pb with event type !\n");
}
printf("sending message %s ... ", msgName);
XFree(msgName);
#endif
if (!windowExists(dpy, win)) {
wwarning("xdnd message target %lu does no longer exist.", win);
return False; /* message not sent */
}
/* Messages from destination to source */
if (messageType == scr->xdndStatusAtom
|| messageType == scr->xdndFinishedAtom) {
W_DragSourceStopTimer();
W_DragSourceStateHandler(info, event);
return;
}
ev.type = ClientMessage;
ev.xclient.message_type = message;
ev.xclient.format = 32;
ev.xclient.window = win;
ev.xclient.data.l[0] = data0;
ev.xclient.data.l[1] = data1;
ev.xclient.data.l[2] = data2;
ev.xclient.data.l[3] = data3;
ev.xclient.data.l[4] = data4;
/* Messages from source to destination */
if (messageType == scr->xdndEnterAtom) {
W_DragDestinationStopTimer();
W_DragDestinationStoreEnterMsgInfo(info, toplevel, event);
XSendEvent(dpy, win, False, 0, &ev);
XFlush(dpy);
if (VERSION_INFO(info) <= XDND_VERSION) {
if (XDND_DEST_VIEW_STORED(info)) {
/* xdndPosition previously received on xdnd aware view */
W_DragDestinationStateHandler(info, event);
return;
} else {
W_DragDestinationStartTimer(info);
return;
}
} else {
wwarning("received dnd enter msg with unsupported version %i",
VERSION_INFO(info));
W_DragDestinationCancelDropOnEnter(toplevel, info);
return;
}
}
if (messageType == scr->xdndPositionAtom) {
W_DragDestinationStopTimer();
W_DragDestinationStorePositionMsgInfo(info, toplevel, event);
W_DragDestinationStateHandler(info, event);
return;
}
if (messageType == scr->xdndSelectionAtom
|| messageType == scr->xdndDropAtom) {
W_DragDestinationStopTimer();
W_DragDestinationStateHandler(info, event);
return;
}
if (messageType == scr->xdndLeaveAtom) {
/* conclude drop operation, and clear dragging info */
W_DragDestinationStopTimer();
handleLeaveMessage(info);
}
#ifdef XDND_DEBUG
printf("sent\n");
#endif
return True; /* message sent */
}
static void handleLeaveMessage(WMDraggingInfo * info)
{
if (XDND_DEST_INFO(info) != NULL) {
/* XDND_DEST_VIEW is never NULL (it's the xdnd aware view) */
wassertr(XDND_DEST_VIEW(info) != NULL);
if (XDND_DEST_VIEW(info)->dragDestinationProcs != NULL) {
XDND_DEST_VIEW(info)->dragDestinationProcs->concludeDragOperation(XDND_DEST_VIEW(info));
}
W_DragDestinationInfoClear(info);
}
}
void W_HandleDNDClientMessage(WMView * toplevel, XClientMessageEvent * event)
{
WMScreen *scr = W_VIEW_SCREEN(toplevel);
WMDraggingInfo *info = &scr->dragInfo;
Atom messageType = event->message_type;
#ifdef XDND_DEBUG
{
char *msgTypeName = XGetAtomName(scr->display, messageType);
if (msgTypeName != NULL)
printf("event type = %s\n", msgTypeName);
else
printf("pb with event type !\n");
}
#endif
/* Messages from destination to source */
if (messageType == scr->xdndStatusAtom || messageType == scr->xdndFinishedAtom) {
W_DragSourceStopTimer();
W_DragSourceStateHandler(info, event);
return;
}
/* Messages from source to destination */
if (messageType == scr->xdndEnterAtom) {
Bool positionSent = (XDND_DEST_INFO(info) != NULL);
W_DragDestinationStopTimer();
W_DragDestinationStoreEnterMsgInfo(info, toplevel, event);
/* Xdnd version 3 and up are not compatible with version 1 or 2 */
if (XDND_SOURCE_VERSION(info) > 2) {
if (positionSent) {
/* xdndPosition previously received on xdnd aware view */
W_DragDestinationStateHandler(info, event);
return;
} else {
W_DragDestinationStartTimer(info);
return;
}
} else {
wwarning("received dnd enter msg with unsupported version %i", XDND_SOURCE_VERSION(info));
W_DragDestinationCancelDropOnEnter(toplevel, info);
return;
}
}
if (messageType == scr->xdndPositionAtom) {
W_DragDestinationStopTimer();
W_DragDestinationStorePositionMsgInfo(info, toplevel, event);
W_DragDestinationStateHandler(info, event);
return;
}
if (messageType == scr->xdndSelectionAtom || messageType == scr->xdndDropAtom) {
W_DragDestinationStopTimer();
W_DragDestinationStateHandler(info, event);
return;
}
if (messageType == scr->xdndLeaveAtom) {
/* conclude drop operation, and clear dragging info */
W_DragDestinationStopTimer();
handleLeaveMessage(info);
}
}
/* called in destroyView (wview.c) */
void
W_FreeViewXdndPart(WMView *view)
void W_FreeViewXdndPart(WMView * view)
{
WMUnregisterViewDraggedTypes(view);
WMUnregisterViewDraggedTypes(view);
if (view->dragSourceProcs)
wfree(view->dragSourceProcs);
if (view->dragSourceProcs)
wfree(view->dragSourceProcs);
if (view->dragDestinationProcs)
wfree(view->dragDestinationProcs);
if (view->dragDestinationProcs)
wfree(view->dragDestinationProcs);
if (view->dragImage)
WMReleasePixmap(view->dragImage);
if (view->dragImage)
WMReleasePixmap(view->dragImage);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -18,185 +18,79 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "wconfig.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <WUtil.h>
extern char *_WINGS_progname;
#define MAXLINE 1024
/*********************************************************************
* Returns the system error message associated with error code 'errnum'
*********************************************************************/
char*
wstrerror(int errnum)
void __wmessage(const char *func, const char *file, int line, int type, const char *msg, ...)
{
#if defined(HAVE_STRERROR)
return strerror(errnum);
#elif !defined(HAVE_STRERROR) && defined(BSD)
extern int errno, sys_nerr;
# ifndef __DECC
extern char *sys_errlist[];
# endif
static char buf[] = "Unknown error 12345678901234567890";
va_list args;
char *buf;
static int linemax = 0;
int truncated = 0;
if (errno < sys_nerr)
return sys_errlist[errnum];
if (linemax == 0) {
#ifdef HAVE_SYSCONF
linemax = sysconf(_SC_LINE_MAX);
if (linemax == -1) {
/* I'd like to know of this ever fires */
fprintf(stderr, "%s %d: sysconf(_SC_LINE_MAX) returned error\n",
__FILE__, __LINE__);
linemax = 512;
}
#else /* !HAVE_SYSCONF */
fprintf(stderr, "%s %d: Your system does not have sysconf(3); "
"let wmaker-dev@windowmaker.org know.\n", __FILE__, __LINE__);
linemax = 512;
#endif /* HAVE_SYSCONF */
}
snprintf(buf, sizeof(buf), _("Unknown error %d"), errnum);
return buf;
#else /* no strerror() and no sys_errlist[] */
static char buf[] = "Error 12345678901234567890";
buf = wmalloc(linemax);
snprintf(buf, sizeof(buf), _("Error %d"), errnum);
return buf;
#endif
fflush(stdout);
/* message format: <wings_progname>(function(file:line): <type?>: <message>"\n" */
strncat(buf, _WINGS_progname ? _WINGS_progname : "WINGs", linemax - 1);
snprintf(buf + strlen(buf), linemax - strlen(buf), "(%s(%s:%d))", func, file, line);
strncat(buf, ": ", linemax - 1 - strlen(buf));
switch (type) {
case WMESSAGE_TYPE_FATAL:
strncat(buf, _("fatal error: "), linemax - 1 - strlen(buf));
break;
case WMESSAGE_TYPE_ERROR:
strncat(buf, _("error: "), linemax - 1 - strlen(buf));
break;
case WMESSAGE_TYPE_WARNING:
strncat(buf, _("warning: "), linemax - 1 - strlen(buf));
break;
case WMESSAGE_TYPE_MESSAGE:
/* FALLTHROUGH */
default: /* should not happen, but doesn't hurt either */
break;
}
va_start(args, msg);
if (vsnprintf(buf + strlen(buf), linemax - strlen(buf), msg, args) >= linemax - strlen(buf))
truncated = 1;
va_end(args);
fputs(buf, stderr);
if (truncated)
fputs("*** message truncated ***", stderr);
fputs("\n", stderr);
wfree(buf);
}
/*********************************************************************
* Prints a message with variable arguments
*
* msg - message to print with optional formatting
* ... - arguments to use on formatting
*********************************************************************/
void
wmessage(const char *msg, ...)
{
va_list args;
char buf[MAXLINE];
va_start(args, msg);
vsnprintf(buf, MAXLINE-3, msg, args);
strcat(buf,"\n");
fflush(stdout);
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
fputs(": ",stderr);
fputs(buf, stderr);
fflush(stdout);
fflush(stderr);
va_end(args);
}
/*********************************************************************
* Prints a warning message with variable arguments
*
* msg - message to print with optional formatting
* ... - arguments to use on formatting
*********************************************************************/
void
wwarning(const char *msg, ...)
{
va_list args;
char buf[MAXLINE];
va_start(args, msg);
vsnprintf(buf, MAXLINE-3, msg, args);
strcat(buf,"\n");
fflush(stdout);
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
fputs(_(" warning: "),stderr);
fputs(buf, stderr);
fflush(stdout);
fflush(stderr);
va_end(args);
}
/**************************************************************************
* Prints a fatal error message with variable arguments and terminates
*
* msg - message to print with optional formatting
* ... - arguments to use on formatting
**************************************************************************/
void
wfatal(const char *msg, ...)
{
va_list args;
char buf[MAXLINE];
va_start(args, msg);
vsnprintf(buf, MAXLINE-3, msg, args);
strcat(buf,"\n");
fflush(stdout);
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
fputs(_(" fatal error: "),stderr);
fputs(buf, stderr);
fflush(stdout);
fflush(stderr);
va_end(args);
}
/*********************************************************************
* Prints a system error message with variable arguments
*
* msg - message to print with optional formatting
* ... - arguments to use on formatting
*********************************************************************/
void
wsyserror(const char *msg, ...)
{
va_list args;
char buf[MAXLINE];
int error=errno;
va_start(args, msg);
vsnprintf(buf, MAXLINE-3, msg, args);
fflush(stdout);
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
fputs(_(" error: "), stderr);
fputs(buf, stderr);
fputs(": ", stderr);
fputs(wstrerror(error), stderr);
fputs("\n", stderr);
fflush(stderr);
fflush(stdout);
va_end(args);
}
/*********************************************************************
* Prints a system error message with variable arguments, being given
* the error code.
*
* error - the error code foe which to print the message
* msg - message to print with optional formatting
* ... - arguments to use on formatting
*********************************************************************/
void
wsyserrorwithcode(int error, const char *msg, ...)
{
va_list args;
char buf[MAXLINE];
va_start(args, msg);
vsnprintf(buf, MAXLINE-3, msg, args);
fflush(stdout);
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
fputs(_(" error: "), stderr);
fputs(buf, stderr);
fputs(": ", stderr);
fputs(wstrerror(error), stderr);
fputs("\n", stderr);
fflush(stderr);
fflush(stdout);
va_end(args);
}

View File

@@ -18,11 +18,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "wconfig.h"
#include "WUtil.h"
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -33,155 +35,187 @@
#define PATH_MAX 1024
#endif
#define RETRY( x ) do { x; } while (errno == EINTR);
char*
wgethomedir()
char *wgethomedir()
{
char *home = getenv("HOME");
struct passwd *user;
static char *home = NULL;
char *tmp;
struct passwd *user;
if (home)
return home;
if (home)
return home;
user = getpwuid(getuid());
if (!user) {
wsyserror(_("could not get password entry for UID %i"), getuid());
return "/";
}
if (!user->pw_dir) {
return "/";
} else {
return user->pw_dir;
}
tmp = getenv("HOME");
if (tmp) {
home = wstrdup(tmp);
return home;
}
user = getpwuid(getuid());
if (!user) {
werror(_("could not get password entry for UID %i"), getuid());
home = "/";
}
if (!user->pw_dir)
home = "/";
else
home = wstrdup(user->pw_dir);
return home;
}
static char*
getuserhomedir(char *username)
static char *getuserhomedir(const char *username)
{
struct passwd *user;
static char *home = NULL;
struct passwd *user;
user = getpwnam(username);
if (!user) {
wsyserror(_("could not get password entry for user %s"), username);
return NULL;
}
if (!user->pw_dir) {
return "/";
} else {
return user->pw_dir;
}
if (home)
return home;
user = getpwnam(username);
if (!user) {
werror(_("could not get password entry for user %s"), username);
return NULL;
}
if (!user->pw_dir)
home = "/";
else
home = wstrdup(user->pw_dir);
return home;
}
char*
wexpandpath(char *path)
char *wexpandpath(char *path)
{
char buffer2[PATH_MAX+2];
char buffer[PATH_MAX+2];
int i;
char *origpath = path;
char buffer2[PATH_MAX + 2];
char buffer[PATH_MAX + 2];
int i;
memset(buffer, 0, PATH_MAX+2);
memset(buffer, 0, PATH_MAX + 2);
if (*path=='~') {
char *home;
if (*path == '~') {
char *home;
path++;
if (*path=='/' || *path==0) {
home = wgethomedir();
strcat(buffer, home);
} else {
int j;
j = 0;
while (*path!=0 && *path!='/') {
buffer2[j++] = *path;
buffer2[j] = 0;
path++;
}
home = getuserhomedir(buffer2);
if (!home)
return NULL;
strcat(buffer, home);
}
}
path++;
if (*path == '/' || *path == 0) {
home = wgethomedir();
if (strlen(home) > PATH_MAX ||
wstrlcpy(buffer, home, sizeof(buffer)) >= sizeof(buffer))
goto error;
} else {
int j;
j = 0;
while (*path != 0 && *path != '/') {
if (j > PATH_MAX)
goto error;
buffer2[j++] = *path;
buffer2[j] = 0;
path++;
}
home = getuserhomedir(buffer2);
if (!home || wstrlcat(buffer, home, sizeof(buffer)) >= sizeof(buffer))
goto error;
}
}
i = strlen(buffer);
i = strlen(buffer);
while (*path!=0) {
char *tmp;
while (*path != 0 && i <= PATH_MAX) {
char *tmp;
if (*path=='$') {
int j = 0;
path++;
/* expand $(HOME) or $HOME style environment variables */
if (*path=='(') {
path++;
while (*path!=0 && *path!=')') {
buffer2[j++] = *(path++);
buffer2[j] = 0;
}
if (*path==')')
path++;
tmp = getenv(buffer2);
if (!tmp) {
buffer[i] = 0;
strcat(buffer, "$(");
strcat(buffer, buffer2);
strcat(buffer, ")");
i += strlen(buffer2)+3;
} else {
strcat(buffer, tmp);
i += strlen(tmp);
}
} else {
while (*path!=0 && *path!='/') {
buffer2[j++] = *(path++);
buffer2[j] = 0;
}
tmp = getenv(buffer2);
if (!tmp) {
strcat(buffer, "$");
strcat(buffer, buffer2);
i += strlen(buffer2)+1;
} else {
strcat(buffer, tmp);
i += strlen(tmp);
}
}
} else {
buffer[i++] = *path;
path++;
}
}
if (*path == '$') {
int j = 0;
path++;
/* expand $(HOME) or $HOME style environment variables */
if (*path == '(') {
path++;
while (*path != 0 && *path != ')') {
if (j > PATH_MAX)
goto error;
buffer2[j++] = *(path++);
buffer2[j] = 0;
}
if (*path == ')') {
path++;
tmp = getenv(buffer2);
} else {
tmp = NULL;
}
if (!tmp) {
if ((i += strlen(buffer2) + 2) > PATH_MAX)
goto error;
buffer[i] = 0;
if (wstrlcat(buffer, "$(", sizeof(buffer)) >= sizeof(buffer) ||
wstrlcat(buffer, buffer2, sizeof(buffer)) >= sizeof(buffer))
goto error;
if (*(path-1)==')') {
if (++i > PATH_MAX ||
wstrlcat(buffer, ")", sizeof(buffer)) >= sizeof(buffer))
goto error;
}
} else {
if ((i += strlen(tmp)) > PATH_MAX ||
wstrlcat(buffer, tmp, sizeof(buffer)) >= sizeof(buffer))
goto error;
}
} else {
while (*path != 0 && *path != '/') {
if (j > PATH_MAX)
goto error;
buffer2[j++] = *(path++);
buffer2[j] = 0;
}
tmp = getenv(buffer2);
if (!tmp) {
if ((i += strlen(buffer2) + 1) > PATH_MAX ||
wstrlcat(buffer, "$", sizeof(buffer)) >= sizeof(buffer) ||
wstrlcat(buffer, buffer2, sizeof(buffer)) >= sizeof(buffer))
goto error;
} else {
if ((i += strlen(tmp)) > PATH_MAX ||
wstrlcat(buffer, tmp, sizeof(buffer)) >= sizeof(buffer))
goto error;
}
}
} else {
buffer[i++] = *path;
path++;
}
}
return wstrdup(buffer);
if (*path!=0)
goto error;
return wstrdup(buffer);
error:
errno = ENAMETOOLONG;
werror(_("could not expand %s"), origpath);
return NULL;
}
/* return address of next char != tok or end of string whichever comes first */
static char*
skipchar(char *string, char tok)
static char *skipchar(char *string, char tok)
{
while(*string!=0 && *string==tok)
string++;
while (*string != 0 && *string == tok)
string++;
return string;
return string;
}
/* return address of next char == tok or end of string whichever comes first */
static char*
nextchar(char *string, char tok)
static char *nextchar(char *string, char tok)
{
while(*string!=0 && *string!=tok)
string++;
while (*string != 0 && *string != tok)
string++;
return string;
return string;
}
/*
*----------------------------------------------------------------------
* findfile--
@@ -197,173 +231,232 @@ nextchar(char *string, char tok)
*
*----------------------------------------------------------------------
*/
char*
wfindfile(char *paths, char *file)
char *wfindfile(char *paths, char *file)
{
char *path;
char *tmp, *tmp2;
int len, flen;
char *fullpath;
char *path;
char *tmp, *tmp2;
int len, flen;
char *fullpath;
if (!file)
return NULL;
if (!file)
return NULL;
if (*file=='/' || *file=='~' || *file=='$' || !paths || *paths==0) {
if (access(file, F_OK)<0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (*file == '/' || *file == '~' || *file == '$' || !paths || *paths == 0) {
if (access(file, F_OK) < 0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (access(fullpath, F_OK)<0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
if (access(fullpath, F_OK) < 0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
flen = strlen(file);
tmp = paths;
while (*tmp) {
tmp = skipchar(tmp, ':');
if (*tmp==0)
break;
tmp2 = nextchar(tmp, ':');
len = tmp2 - tmp;
path = wmalloc(len+flen+2);
path = memcpy(path, tmp, len);
path[len]=0;
if (path[len-1] != '/')
strcat(path, "/");
strcat(path, file);
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
if (access(fullpath, F_OK)==0) {
return fullpath;
}
wfree(fullpath);
}
tmp = tmp2;
}
flen = strlen(file);
tmp = paths;
while (*tmp) {
tmp = skipchar(tmp, ':');
if (*tmp == 0)
break;
tmp2 = nextchar(tmp, ':');
len = tmp2 - tmp;
path = wmalloc(len + flen + 2);
path = memcpy(path, tmp, len);
path[len] = 0;
if (path[len - 1] != '/' &&
wstrlcat(path, "/", len + flen + 2) >= len + flen + 2) {
wfree(path);
return NULL;
}
return NULL;
if (wstrlcat(path, file, len + flen + 2) >= len + flen + 2) {
wfree(path);
return NULL;
}
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
if (access(fullpath, F_OK) == 0) {
return fullpath;
}
wfree(fullpath);
}
tmp = tmp2;
}
return NULL;
}
char*
wfindfileinlist(char **path_list, char *file)
char *wfindfileinlist(char **path_list, char *file)
{
int i;
char *path;
int len, flen;
char *fullpath;
int i;
char *path;
int len, flen;
char *fullpath;
if (!file)
return NULL;
if (!file)
return NULL;
if (*file=='/' || *file=='~' || !path_list) {
if (access(file, F_OK)<0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (*file == '/' || *file == '~' || !path_list) {
if (access(file, F_OK) < 0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (access(fullpath, F_OK)<0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
if (access(fullpath, F_OK) < 0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
flen = strlen(file);
for (i=0; path_list[i]!=NULL; i++) {
len = strlen(path_list[i]);
path = wmalloc(len+flen+2);
path = memcpy(path, path_list[i], len);
path[len]=0;
strcat(path, "/");
strcat(path, file);
/* expand tilde */
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
/* check if file exists */
if (access(fullpath, F_OK)==0) {
return fullpath;
}
wfree(fullpath);
}
}
return NULL;
flen = strlen(file);
for (i = 0; path_list[i] != NULL; i++) {
len = strlen(path_list[i]);
path = wmalloc(len + flen + 2);
path = memcpy(path, path_list[i], len);
path[len] = 0;
if (wstrlcat(path, "/", len + flen + 2) >= len + flen + 2 ||
wstrlcat(path, file, len + flen + 2) >= len + flen + 2) {
wfree(path);
return NULL;
}
/* expand tilde */
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
/* check if file exists */
if (access(fullpath, F_OK) == 0) {
return fullpath;
}
wfree(fullpath);
}
}
return NULL;
}
char*
wfindfileinarray(WMPropList *array, char *file)
char *wfindfileinarray(WMPropList * array, char *file)
{
int i;
char *path;
int len, flen;
char *fullpath;
int i;
char *path;
int len, flen;
char *fullpath;
if (!file)
return NULL;
if (!file)
return NULL;
if (*file=='/' || *file=='~' || !array) {
if (access(file, F_OK)<0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (*file == '/' || *file == '~' || !array) {
if (access(file, F_OK) < 0) {
fullpath = wexpandpath(file);
if (!fullpath)
return NULL;
if (access(fullpath, F_OK)<0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
if (access(fullpath, F_OK) < 0) {
wfree(fullpath);
return NULL;
} else {
return fullpath;
}
} else {
return wstrdup(file);
}
}
flen = strlen(file);
for (i=0; i<WMGetPropListItemCount(array); i++) {
WMPropList *prop;
char *p;
flen = strlen(file);
for (i = 0; i < WMGetPropListItemCount(array); i++) {
WMPropList *prop;
char *p;
prop = WMGetFromPLArray(array, i);
if (!prop)
continue;
p = WMGetFromPLString(prop);
prop = WMGetFromPLArray(array, i);
if (!prop)
continue;
p = WMGetFromPLString(prop);
len = strlen(p);
path = wmalloc(len+flen+2);
path = memcpy(path, p, len);
path[len]=0;
strcat(path, "/");
strcat(path, file);
/* expand tilde */
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
/* check if file exists */
if (access(fullpath, F_OK)==0) {
return fullpath;
}
wfree(fullpath);
}
}
return NULL;
len = strlen(p);
path = wmalloc(len + flen + 2);
path = memcpy(path, p, len);
path[len] = 0;
if (wstrlcat(path, "/", len + flen + 2) >= len + flen + 2 ||
wstrlcat(path, file, len + flen + 2) >= len + flen + 2) {
wfree(path);
return NULL;
}
/* expand tilde */
fullpath = wexpandpath(path);
wfree(path);
if (fullpath) {
/* check if file exists */
if (access(fullpath, F_OK) == 0) {
return fullpath;
}
wfree(fullpath);
}
}
return NULL;
}
int wcopy_file(char *dir, char *src_file, char *dest_file)
{
FILE *src, *dst;
size_t nread, nwritten;
char *dstpath;
struct stat st;
char buf[4096];
/* only to a directory */
if (stat(dir, &st) != 0 || !S_ISDIR(st.st_mode))
return -1;
/* only copy files */
if (stat(src_file, &st) != 0 || !S_ISREG(st.st_mode))
return -1;
RETRY( src = fopen(src_file, "rb") )
if (src == NULL) {
werror(_("Could not open %s"), src_file);
return -1;
}
dstpath = wstrconcat(dir, dest_file);
RETRY( dst = fopen(dstpath, "wb") )
if (dst == NULL) {
werror(_("Could not create %s"), dstpath);
wfree(dstpath);
RETRY( fclose(src) )
return -1;
}
do {
RETRY( nread = fread(buf, 1, sizeof(buf), src) )
if (ferror(src))
break;
RETRY( nwritten = fwrite(buf, 1, nread, dst) )
if (ferror(dst) || feof(src) || nread != nwritten)
break;
} while (1);
if (ferror(src) || ferror(dst))
unlink(dstpath);
RETRY( fclose(src) )
fchmod(fileno(dst), st.st_mode);
fsync(fileno(dst));
RETRY( fclose(dst) )
wfree(dstpath);
return 0;
}

31
WINGs/get-wings-flags.in Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
WCFLAGS="${inc_search_path}"
WLFLAGS="${lib_search_path}"
WLIBS="-lWINGs -lWUtil -lwraster ${GFXLIBS} ${XFTLIBS} ${XLIBS} -lm ${INTLIBS}"
usage="Usage: get-wings-flags [--cflags] [--ldflags] [--libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case $1 in
--cflags)
echo $WCFLAGS
;;
--ldflags|--lflags)
echo $WLFLAGS
;;
--libs)
echo $WLIBS
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done

31
WINGs/get-wutil-flags.in Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
WCFLAGS="-I${includedir}"
WLFLAGS="-L${libdir}"
WLIBS="-lWUtil ${INTLIBS}"
usage="Usage: get-wutil-flags [--cflags] [--ldflags] [--libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case $1 in
--cflags)
echo $WCFLAGS
;;
--ldflags|--lflags)
echo $WLFLAGS
;;
--libs)
echo $WLIBS
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done

View File

@@ -21,47 +21,38 @@
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
#endif
typedef struct TimerHandler {
WMCallback *callback; /* procedure to call */
struct timeval when; /* when to call the callback */
void *clientData;
struct TimerHandler *next;
int nextDelay; /* 0 if it's one-shot */
WMCallback *callback; /* procedure to call */
struct timeval when; /* when to call the callback */
void *clientData;
struct TimerHandler *next;
int nextDelay; /* 0 if it's one-shot */
} TimerHandler;
typedef struct IdleHandler {
WMCallback *callback;
void *clientData;
WMCallback *callback;
void *clientData;
} IdleHandler;
typedef struct InputHandler {
WMInputProc *callback;
void *clientData;
int fd;
int mask;
WMInputProc *callback;
void *clientData;
int fd;
int mask;
} InputHandler;
/* queue of timer event handlers */
static TimerHandler *timerHandler=NULL;
static TimerHandler *timerHandler = NULL;
static WMArray *idleHandler=NULL;
static WMArray *idleHandler = NULL;
static WMArray *inputHandler=NULL;
static WMArray *inputHandler = NULL;
#define timerPending() (timerHandler)
static void
rightNow(struct timeval *tv)
static void rightNow(struct timeval *tv)
{
X_GETTIMEOFDAY(tv);
X_GETTIMEOFDAY(tv);
}
/* is t1 after t2 ? */
@@ -73,308 +64,277 @@ rightNow(struct timeval *tv)
#define SET_ZERO(tv) tv.tv_sec = 0, tv.tv_usec = 0
static void
addmillisecs(struct timeval *tv, int milliseconds)
static void addmillisecs(struct timeval *tv, int milliseconds)
{
tv->tv_usec += milliseconds*1000;
tv->tv_usec += milliseconds * 1000;
tv->tv_sec += tv->tv_usec/1000000;
tv->tv_usec = tv->tv_usec%1000000;
tv->tv_sec += tv->tv_usec / 1000000;
tv->tv_usec = tv->tv_usec % 1000000;
}
static void
enqueueTimerHandler(TimerHandler *handler)
static void enqueueTimerHandler(TimerHandler * handler)
{
TimerHandler *tmp;
TimerHandler *tmp;
/* insert callback in queue, sorted by time left */
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
/* first in the queue */
handler->next = timerHandler;
timerHandler = handler;
} else {
tmp = timerHandler;
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
tmp = tmp->next;
}
handler->next = tmp->next;
tmp->next = handler;
}
/* insert callback in queue, sorted by time left */
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
/* first in the queue */
handler->next = timerHandler;
timerHandler = handler;
} else {
tmp = timerHandler;
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
tmp = tmp->next;
}
handler->next = tmp->next;
tmp->next = handler;
}
}
static void
delayUntilNextTimerEvent(struct timeval *delay)
static void delayUntilNextTimerEvent(struct timeval *delay)
{
struct timeval now;
TimerHandler *handler;
struct timeval now;
TimerHandler *handler;
handler = timerHandler;
while (handler && IS_ZERO(handler->when)) handler = handler->next;
handler = timerHandler;
while (handler && IS_ZERO(handler->when))
handler = handler->next;
if (!handler) {
/* The return value of this function is only valid if there _are_
timers active. */
delay->tv_sec = 0;
delay->tv_usec = 0;
return;
}
if (!handler) {
/* The return value of this function is only valid if there _are_
timers active. */
delay->tv_sec = 0;
delay->tv_usec = 0;
return;
}
rightNow(&now);
if (IS_AFTER(now, handler->when)) {
delay->tv_sec = 0;
delay->tv_usec = 0;
} else {
delay->tv_sec = handler->when.tv_sec - now.tv_sec;
delay->tv_usec = handler->when.tv_usec - now.tv_usec;
if (delay->tv_usec < 0) {
delay->tv_usec += 1000000;
delay->tv_sec--;
}
}
rightNow(&now);
if (IS_AFTER(now, handler->when)) {
delay->tv_sec = 0;
delay->tv_usec = 0;
} else {
delay->tv_sec = handler->when.tv_sec - now.tv_sec;
delay->tv_usec = handler->when.tv_usec - now.tv_usec;
if (delay->tv_usec < 0) {
delay->tv_usec += 1000000;
delay->tv_sec--;
}
}
}
WMHandlerID
WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
WMHandlerID WMAddTimerHandler(int milliseconds, WMCallback * callback, void *cdata)
{
TimerHandler *handler;
TimerHandler *handler;
handler = malloc(sizeof(TimerHandler));
if (!handler)
return NULL;
handler = malloc(sizeof(TimerHandler));
if (!handler)
return NULL;
rightNow(&handler->when);
addmillisecs(&handler->when, milliseconds);
handler->callback = callback;
handler->clientData = cdata;
handler->nextDelay = 0;
rightNow(&handler->when);
addmillisecs(&handler->when, milliseconds);
handler->callback = callback;
handler->clientData = cdata;
handler->nextDelay = 0;
enqueueTimerHandler(handler);
enqueueTimerHandler(handler);
return handler;
return handler;
}
WMHandlerID
WMAddPersistentTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
WMHandlerID WMAddPersistentTimerHandler(int milliseconds, WMCallback * callback, void *cdata)
{
TimerHandler *handler = WMAddTimerHandler(milliseconds, callback, cdata);
TimerHandler *handler = WMAddTimerHandler(milliseconds, callback, cdata);
if (handler != NULL)
handler->nextDelay = milliseconds;
if (handler != NULL)
handler->nextDelay = milliseconds;
return handler;
return handler;
}
void
WMDeleteTimerWithClientData(void *cdata)
void WMDeleteTimerWithClientData(void *cdata)
{
TimerHandler *handler, *tmp;
TimerHandler *handler, *tmp;
if (!cdata || !timerHandler)
return;
if (!cdata || !timerHandler)
return;
tmp = timerHandler;
if (tmp->clientData==cdata) {
tmp->nextDelay = 0;
if (!IS_ZERO(tmp->when)) {
timerHandler = tmp->next;
wfree(tmp);
}
} else {
while (tmp->next) {
if (tmp->next->clientData==cdata) {
handler = tmp->next;
handler->nextDelay = 0;
if (IS_ZERO(handler->when))
break;
tmp->next = handler->next;
wfree(handler);
break;
}
tmp = tmp->next;
}
}
tmp = timerHandler;
if (tmp->clientData == cdata) {
tmp->nextDelay = 0;
if (!IS_ZERO(tmp->when)) {
timerHandler = tmp->next;
wfree(tmp);
}
} else {
while (tmp->next) {
if (tmp->next->clientData == cdata) {
handler = tmp->next;
handler->nextDelay = 0;
if (IS_ZERO(handler->when))
break;
tmp->next = handler->next;
wfree(handler);
break;
}
tmp = tmp->next;
}
}
}
void
WMDeleteTimerHandler(WMHandlerID handlerID)
void WMDeleteTimerHandler(WMHandlerID handlerID)
{
TimerHandler *tmp, *handler=(TimerHandler*)handlerID;
TimerHandler *tmp, *handler = (TimerHandler *) handlerID;
if (!handler || !timerHandler)
return;
if (!handler || !timerHandler)
return;
tmp = timerHandler;
tmp = timerHandler;
handler->nextDelay = 0;
handler->nextDelay = 0;
if (IS_ZERO(handler->when))
return;
if (IS_ZERO(handler->when))
return;
if (tmp==handler) {
timerHandler = handler->next;
wfree(handler);
} else {
while (tmp->next) {
if (tmp->next==handler) {
tmp->next=handler->next;
wfree(handler);
break;
}
tmp = tmp->next;
}
}
if (tmp == handler) {
timerHandler = handler->next;
wfree(handler);
} else {
while (tmp->next) {
if (tmp->next == handler) {
tmp->next = handler->next;
wfree(handler);
break;
}
tmp = tmp->next;
}
}
}
WMHandlerID
WMAddIdleHandler(WMCallback *callback, void *cdata)
WMHandlerID WMAddIdleHandler(WMCallback * callback, void *cdata)
{
IdleHandler *handler;
IdleHandler *handler;
handler = malloc(sizeof(IdleHandler));
if (!handler)
return NULL;
handler = malloc(sizeof(IdleHandler));
if (!handler)
return NULL;
handler->callback = callback;
handler->clientData = cdata;
/* add handler at end of queue */
if (!idleHandler) {
idleHandler = WMCreateArrayWithDestructor(16, wfree);
}
WMAddToArray(idleHandler, handler);
handler->callback = callback;
handler->clientData = cdata;
/* add handler at end of queue */
if (!idleHandler) {
idleHandler = WMCreateArrayWithDestructor(16, wfree);
}
WMAddToArray(idleHandler, handler);
return handler;
return handler;
}
void
WMDeleteIdleHandler(WMHandlerID handlerID)
void WMDeleteIdleHandler(WMHandlerID handlerID)
{
IdleHandler *handler = (IdleHandler*)handlerID;
IdleHandler *handler = (IdleHandler *) handlerID;
if (!handler || !idleHandler)
return;
if (!handler || !idleHandler)
return;
WMRemoveFromArray(idleHandler, handler);
WMRemoveFromArray(idleHandler, handler);
}
WMHandlerID
WMAddInputHandler(int fd, int condition, WMInputProc *proc, void *clientData)
WMHandlerID WMAddInputHandler(int fd, int condition, WMInputProc * proc, void *clientData)
{
InputHandler *handler;
InputHandler *handler;
handler = wmalloc(sizeof(InputHandler));
handler = wmalloc(sizeof(InputHandler));
handler->fd = fd;
handler->mask = condition;
handler->callback = proc;
handler->clientData = clientData;
handler->fd = fd;
handler->mask = condition;
handler->callback = proc;
handler->clientData = clientData;
if (!inputHandler)
inputHandler = WMCreateArrayWithDestructor(16, wfree);
WMAddToArray(inputHandler, handler);
if (!inputHandler)
inputHandler = WMCreateArrayWithDestructor(16, wfree);
WMAddToArray(inputHandler, handler);
return handler;
return handler;
}
void
WMDeleteInputHandler(WMHandlerID handlerID)
void WMDeleteInputHandler(WMHandlerID handlerID)
{
InputHandler *handler = (InputHandler*)handlerID;
InputHandler *handler = (InputHandler *) handlerID;
if (!handler || !inputHandler)
return;
if (!handler || !inputHandler)
return;
WMRemoveFromArray(inputHandler, handler);
WMRemoveFromArray(inputHandler, handler);
}
Bool
W_CheckIdleHandlers(void)
Bool W_CheckIdleHandlers(void)
{
IdleHandler *handler;
WMArray *handlerCopy;
WMArrayIterator iter;
IdleHandler *handler;
WMArray *handlerCopy;
WMArrayIterator iter;
if (!idleHandler || WMGetArrayItemCount(idleHandler)==0) {
W_FlushIdleNotificationQueue();
/* make sure an observer in queue didn't added an idle handler */
return (idleHandler!=NULL && WMGetArrayItemCount(idleHandler)>0);
}
if (!idleHandler || WMGetArrayItemCount(idleHandler) == 0) {
W_FlushIdleNotificationQueue();
/* make sure an observer in queue didn't added an idle handler */
return (idleHandler != NULL && WMGetArrayItemCount(idleHandler) > 0);
}
handlerCopy = WMDuplicateArray(idleHandler);
handlerCopy = WMDuplicateArray(idleHandler);
WM_ITERATE_ARRAY(handlerCopy, handler, iter) {
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(idleHandler, handler) == WANotFound)
continue;
WM_ITERATE_ARRAY(handlerCopy, handler, iter) {
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(idleHandler, handler) == WANotFound)
continue;
(*handler->callback)(handler->clientData);
WMDeleteIdleHandler(handler);
}
(*handler->callback) (handler->clientData);
WMDeleteIdleHandler(handler);
}
WMFreeArray(handlerCopy);
WMFreeArray(handlerCopy);
W_FlushIdleNotificationQueue();
W_FlushIdleNotificationQueue();
/* this is not necesarrily False, because one handler can re-add itself */
return (WMGetArrayItemCount(idleHandler)>0);
/* this is not necesarrily False, because one handler can re-add itself */
return (WMGetArrayItemCount(idleHandler) > 0);
}
void
W_CheckTimerHandlers(void)
void W_CheckTimerHandlers(void)
{
TimerHandler *handler;
struct timeval now;
TimerHandler *handler;
struct timeval now;
if (!timerHandler) {
W_FlushASAPNotificationQueue();
return;
}
if (!timerHandler) {
W_FlushASAPNotificationQueue();
return;
}
rightNow(&now);
rightNow(&now);
handler = timerHandler;
while (handler && IS_AFTER(now, handler->when)) {
if (!IS_ZERO(handler->when)) {
SET_ZERO(handler->when);
(*handler->callback)(handler->clientData);
}
handler = handler->next;
}
handler = timerHandler;
while (handler && IS_AFTER(now, handler->when)) {
if (!IS_ZERO(handler->when)) {
SET_ZERO(handler->when);
(*handler->callback) (handler->clientData);
}
handler = handler->next;
}
while (timerHandler && IS_ZERO(timerHandler->when)) {
handler = timerHandler;
timerHandler = timerHandler->next;
while (timerHandler && IS_ZERO(timerHandler->when)) {
handler = timerHandler;
timerHandler = timerHandler->next;
if (handler->nextDelay > 0) {
handler->when = now;
addmillisecs(&handler->when, handler->nextDelay);
enqueueTimerHandler(handler);
} else {
wfree(handler);
}
}
if (handler->nextDelay > 0) {
handler->when = now;
addmillisecs(&handler->when, handler->nextDelay);
enqueueTimerHandler(handler);
} else {
wfree(handler);
}
}
W_FlushASAPNotificationQueue();
W_FlushASAPNotificationQueue();
}
/*
* This functions will handle input events on all registered file descriptors.
* Input:
@@ -409,205 +369,198 @@ W_CheckTimerHandlers(void)
* inputfd = -1
*
*/
Bool
W_HandleInputEvents(Bool waitForInput, int inputfd)
Bool W_HandleInputEvents(Bool waitForInput, int inputfd)
{
#if defined(HAVE_POLL) && defined(HAVE_POLL_H) && !defined(HAVE_SELECT)
struct poll fd *fds;
InputHandler *handler;
int count, timeout, nfds, i, extrafd;
struct poll fd *fds;
InputHandler *handler;
int count, timeout, nfds, i, extrafd;
extrafd = (inputfd < 0) ? 0 : 1;
extrafd = (inputfd < 0) ? 0 : 1;
if (inputHandler)
nfds = WMGetArrayItemCount(inputHandler);
else
nfds = 0;
if (inputHandler)
nfds = WMGetArrayItemCount(inputHandler);
else
nfds = 0;
if (!extrafd && nfds==0) {
W_FlushASAPNotificationQueue();
return False;
}
if (!extrafd && nfds == 0) {
W_FlushASAPNotificationQueue();
return False;
}
fds = wmalloc((nfds+extrafd) * sizeof(struct pollfd));
if (extrafd) {
/* put this to the end of array to avoid using ranges from 1 to nfds+1 */
fds[nfds].fd = inputfd;
fds[nfds].events = POLLIN;
}
fds = wmalloc((nfds + extrafd) * sizeof(struct pollfd));
if (extrafd) {
/* put this to the end of array to avoid using ranges from 1 to nfds+1 */
fds[nfds].fd = inputfd;
fds[nfds].events = POLLIN;
}
/* use WM_ITERATE_ARRAY() here */
for (i = 0; i<nfds; i++) {
handler = WMGetFromArray(inputHandler, i);
fds[i].fd = handler->fd;
fds[i].events = 0;
if (handler->mask & WIReadMask)
fds[i].events |= POLLIN;
/* use WM_ITERATE_ARRAY() here */
for (i = 0; i < nfds; i++) {
handler = WMGetFromArray(inputHandler, i);
fds[i].fd = handler->fd;
fds[i].events = 0;
if (handler->mask & WIReadMask)
fds[i].events |= POLLIN;
if (handler->mask & WIWriteMask)
fds[i].events |= POLLOUT;
if (handler->mask & WIWriteMask)
fds[i].events |= POLLOUT;
#if 0 /* FIXME */
if (handler->mask & WIExceptMask)
FD_SET(handler->fd, &eset);
#if 0 /* FIXME */
if (handler->mask & WIExceptMask)
FD_SET(handler->fd, &eset);
#endif
}
}
/*
* Setup the timeout to the estimated time until the
* next timer expires.
*/
if (!waitForInput) {
timeout = 0;
} else if (timerPending()) {
struct timeval tv;
delayUntilNextTimerEvent(&tv);
timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
} else {
timeout = -1;
}
/*
* Setup the timeout to the estimated time until the
* next timer expires.
*/
if (!waitForInput) {
timeout = 0;
} else if (timerPending()) {
struct timeval tv;
delayUntilNextTimerEvent(&tv);
timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
} else {
timeout = -1;
}
count = poll(fds, nfds+extrafd, timeout);
count = poll(fds, nfds + extrafd, timeout);
if (count>0 && nfds>0) {
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
int mask;
if (count > 0 && nfds > 0) {
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
int mask;
/* use WM_ITERATE_ARRAY() here */
for (i=0; i<nfds; i++) {
handler = WMGetFromArray(handlerCopy, i);
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
continue;
/* use WM_ITERATE_ARRAY() here */
for (i = 0; i < nfds; i++) {
handler = WMGetFromArray(handlerCopy, i);
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
continue;
mask = 0;
mask = 0;
if ((handler->mask & WIReadMask) &&
(fds[i].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI)))
mask |= WIReadMask;
if ((handler->mask & WIReadMask) &&
(fds[i].revents & (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)))
mask |= WIReadMask;
if ((handler->mask & WIWriteMask) &&
(fds[i].revents & (POLLOUT | POLLWRBAND)))
mask |= WIWriteMask;
if ((handler->mask & WIWriteMask) && (fds[i].revents & (POLLOUT | POLLWRBAND)))
mask |= WIWriteMask;
if ((handler->mask & WIExceptMask) &&
(fds[i].revents & (POLLHUP | POLLNVAL | POLLERR)))
mask |= WIExceptMask;
if ((handler->mask & WIExceptMask) && (fds[i].revents & (POLLHUP | POLLNVAL | POLLERR)))
mask |= WIExceptMask;
if (mask!=0 && handler->callback) {
(*handler->callback)(handler->fd, mask,
handler->clientData);
}
}
if (mask != 0 && handler->callback) {
(*handler->callback) (handler->fd, mask, handler->clientData);
}
}
WMFreeArray(handlerCopy);
}
WMFreeArray(handlerCopy);
}
wfree(fds);
wfree(fds);
W_FlushASAPNotificationQueue();
W_FlushASAPNotificationQueue();
return (count > 0);
return (count > 0);
#else
#ifdef HAVE_SELECT
struct timeval timeout;
struct timeval *timeoutPtr;
fd_set rset, wset, eset;
int maxfd, nfds, i;
int count;
InputHandler *handler;
struct timeval timeout;
struct timeval *timeoutPtr;
fd_set rset, wset, eset;
int maxfd, nfds, i;
int count;
InputHandler *handler;
if (inputHandler)
nfds = WMGetArrayItemCount(inputHandler);
else
nfds = 0;
if (inputHandler)
nfds = WMGetArrayItemCount(inputHandler);
else
nfds = 0;
if (inputfd<0 && nfds==0) {
W_FlushASAPNotificationQueue();
return False;
}
if (inputfd < 0 && nfds == 0) {
W_FlushASAPNotificationQueue();
return False;
}
FD_ZERO(&rset);
FD_ZERO(&wset);
FD_ZERO(&eset);
FD_ZERO(&rset);
FD_ZERO(&wset);
FD_ZERO(&eset);
if (inputfd < 0) {
maxfd = 0;
} else {
FD_SET(inputfd, &rset);
maxfd = inputfd;
}
if (inputfd < 0) {
maxfd = 0;
} else {
FD_SET(inputfd, &rset);
maxfd = inputfd;
}
/* use WM_ITERATE_ARRAY() here */
for (i=0; i<nfds; i++) {
handler = WMGetFromArray(inputHandler, i);
if (handler->mask & WIReadMask)
FD_SET(handler->fd, &rset);
/* use WM_ITERATE_ARRAY() here */
for (i = 0; i < nfds; i++) {
handler = WMGetFromArray(inputHandler, i);
if (handler->mask & WIReadMask)
FD_SET(handler->fd, &rset);
if (handler->mask & WIWriteMask)
FD_SET(handler->fd, &wset);
if (handler->mask & WIWriteMask)
FD_SET(handler->fd, &wset);
if (handler->mask & WIExceptMask)
FD_SET(handler->fd, &eset);
if (handler->mask & WIExceptMask)
FD_SET(handler->fd, &eset);
if (maxfd < handler->fd)
maxfd = handler->fd;
}
if (maxfd < handler->fd)
maxfd = handler->fd;
}
/*
* Setup the timeout to the estimated time until the
* next timer expires.
*/
if (!waitForInput) {
SET_ZERO(timeout);
timeoutPtr = &timeout;
} else if (timerPending()) {
delayUntilNextTimerEvent(&timeout);
timeoutPtr = &timeout;
} else {
timeoutPtr = (struct timeval*)0;
}
/*
* Setup the timeout to the estimated time until the
* next timer expires.
*/
if (!waitForInput) {
SET_ZERO(timeout);
timeoutPtr = &timeout;
} else if (timerPending()) {
delayUntilNextTimerEvent(&timeout);
timeoutPtr = &timeout;
} else {
timeoutPtr = (struct timeval *)0;
}
count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);
count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);
if (count>0 && nfds>0) {
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
int mask;
if (count > 0 && nfds > 0) {
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
int mask;
/* use WM_ITERATE_ARRAY() here */
for (i=0; i<nfds; i++) {
handler = WMGetFromArray(handlerCopy, i);
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
continue;
/* use WM_ITERATE_ARRAY() here */
for (i = 0; i < nfds; i++) {
handler = WMGetFromArray(handlerCopy, i);
/* check if the handler still exist or was removed by a callback */
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
continue;
mask = 0;
mask = 0;
if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))
mask |= WIReadMask;
if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))
mask |= WIReadMask;
if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))
mask |= WIWriteMask;
if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))
mask |= WIWriteMask;
if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))
mask |= WIExceptMask;
if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))
mask |= WIExceptMask;
if (mask!=0 && handler->callback) {
(*handler->callback)(handler->fd, mask,
handler->clientData);
}
}
if (mask != 0 && handler->callback) {
(*handler->callback) (handler->fd, mask, handler->clientData);
}
}
WMFreeArray(handlerCopy);
}
WMFreeArray(handlerCopy);
}
W_FlushASAPNotificationQueue();
W_FlushASAPNotificationQueue();
return (count > 0);
#else /* not HAVE_SELECT, not HAVE_POLL */
return (count > 0);
#else /* not HAVE_SELECT, not HAVE_POLL */
# error Neither select nor poll. You lose.
#endif /* HAVE_SELECT */
#endif /* HAVE_POLL */
#endif /* HAVE_SELECT */
#endif /* HAVE_POLL */
}

View File

@@ -1,5 +1,4 @@
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
@@ -7,39 +6,30 @@
#include "WUtil.h"
#define INITIAL_CAPACITY 23
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define INLINE inline
#else
# define INLINE
#endif
typedef struct HashItem {
const void *key;
const void *data;
const void *key;
const void *data;
struct HashItem *next; /* collided item list */
struct HashItem *next; /* collided item list */
} HashItem;
typedef struct W_HashTable {
WMHashTableCallbacks callbacks;
WMHashTableCallbacks callbacks;
unsigned itemCount;
unsigned size; /* table size */
unsigned itemCount;
unsigned size; /* table size */
HashItem **table;
HashItem **table;
} HashTable;
#define HASH(table, key) (((table)->callbacks.hash ? \
(*(table)->callbacks.hash)(key) : hashPtr(key)) % (table)->size)
@@ -49,452 +39,399 @@ typedef struct W_HashTable {
#define RELKEY(table, key) if ((table)->callbacks.releaseKey) \
(*(table)->callbacks.releaseKey)(key)
static INLINE unsigned
hashString(const char *key)
static INLINE unsigned hashString(const char *key)
{
unsigned ret = 0;
unsigned ctr = 0;
unsigned ret = 0;
unsigned ctr = 0;
while (*key) {
ret ^= *(char*)key++ << ctr;
ctr = (ctr + 1) % sizeof (char *);
}
while (*key) {
ret ^= *(char *)key++ << ctr;
ctr = (ctr + 1) % sizeof(char *);
}
return ret;
return ret;
}
static INLINE unsigned
hashPtr(const void *key)
static INLINE unsigned hashPtr(const void *key)
{
return ((size_t)key / sizeof(char*));
return ((size_t) key / sizeof(char *));
}
static void
rellocateItem(WMHashTable *table, HashItem *item)
static void rellocateItem(WMHashTable * table, HashItem * item)
{
unsigned h;
unsigned h;
h = HASH(table, item->key);
h = HASH(table, item->key);
item->next = table->table[h];
table->table[h] = item;
item->next = table->table[h];
table->table[h] = item;
}
static void
rebuildTable(WMHashTable *table)
static void rebuildTable(WMHashTable * table)
{
HashItem *next;
HashItem **oldArray;
int i;
int oldSize;
int newSize;
HashItem *next;
HashItem **oldArray;
int i;
int oldSize;
int newSize;
oldArray = table->table;
oldSize = table->size;
oldArray = table->table;
oldSize = table->size;
newSize = table->size*2;
newSize = table->size * 2;
table->table = wmalloc(sizeof(char*)*newSize);
memset(table->table, 0, sizeof(char*)*newSize);
table->size = newSize;
table->table = wmalloc(sizeof(char *) * newSize);
table->size = newSize;
for (i = 0; i < oldSize; i++) {
while (oldArray[i]!=NULL) {
next = oldArray[i]->next;
rellocateItem(table, oldArray[i]);
oldArray[i] = next;
}
}
wfree(oldArray);
for (i = 0; i < oldSize; i++) {
while (oldArray[i] != NULL) {
next = oldArray[i]->next;
rellocateItem(table, oldArray[i]);
oldArray[i] = next;
}
}
wfree(oldArray);
}
WMHashTable*
WMCreateHashTable(WMHashTableCallbacks callbacks)
WMHashTable *WMCreateHashTable(WMHashTableCallbacks callbacks)
{
HashTable *table;
HashTable *table;
table = wmalloc(sizeof(HashTable));
memset(table, 0, sizeof(HashTable));
table = wmalloc(sizeof(HashTable));
memset(table, 0, sizeof(HashTable));
table->callbacks = callbacks;
table->callbacks = callbacks;
table->size = INITIAL_CAPACITY;
table->size = INITIAL_CAPACITY;
table->table = wmalloc(sizeof(HashItem*)*table->size);
memset(table->table, 0, sizeof(HashItem*)*table->size);
table->table = wmalloc(sizeof(HashItem *) * table->size);
memset(table->table, 0, sizeof(HashItem *) * table->size);
return table;
return table;
}
void
WMResetHashTable(WMHashTable *table)
void WMResetHashTable(WMHashTable * table)
{
HashItem *item, *tmp;
int i;
HashItem *item, *tmp;
int i;
for (i = 0; i < table->size; i++) {
item = table->table[i];
while (item) {
tmp = item->next;
RELKEY(table, item->key);
wfree(item);
item = tmp;
}
}
for (i = 0; i < table->size; i++) {
item = table->table[i];
while (item) {
tmp = item->next;
RELKEY(table, item->key);
wfree(item);
item = tmp;
}
}
table->itemCount = 0;
table->itemCount = 0;
if (table->size > INITIAL_CAPACITY) {
wfree(table->table);
table->size = INITIAL_CAPACITY;
table->table = wmalloc(sizeof(HashItem*)*table->size);
}
memset(table->table, 0, sizeof(HashItem*)*table->size);
if (table->size > INITIAL_CAPACITY) {
wfree(table->table);
table->size = INITIAL_CAPACITY;
table->table = wmalloc(sizeof(HashItem *) * table->size);
}
memset(table->table, 0, sizeof(HashItem *) * table->size);
}
void
WMFreeHashTable(WMHashTable *table)
void WMFreeHashTable(WMHashTable * table)
{
HashItem *item, *tmp;
int i;
HashItem *item, *tmp;
int i;
for (i = 0; i < table->size; i++) {
item = table->table[i];
while (item) {
tmp = item->next;
RELKEY(table, item->key);
wfree(item);
item = tmp;
}
}
wfree(table->table);
wfree(table);
for (i = 0; i < table->size; i++) {
item = table->table[i];
while (item) {
tmp = item->next;
RELKEY(table, item->key);
wfree(item);
item = tmp;
}
}
wfree(table->table);
wfree(table);
}
unsigned
WMCountHashTable(WMHashTable *table)
unsigned WMCountHashTable(WMHashTable * table)
{
return table->itemCount;
return table->itemCount;
}
void*
WMHashGet(WMHashTable *table, const void *key)
void *WMHashGet(WMHashTable * table, const void *key)
{
unsigned h;
HashItem *item;
unsigned h;
HashItem *item;
h = HASH(table, key);
item = table->table[h];
h = HASH(table, key);
item = table->table[h];
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual)(key, item->key)) {
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
break;
}
item = item->next;
}
}
if (item)
return (void*)item->data;
else
return NULL;
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual) (key, item->key)) {
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
break;
}
item = item->next;
}
}
if (item)
return (void *)item->data;
else
return NULL;
}
Bool
WMHashGetItemAndKey(WMHashTable *table, const void *key,
void **retItem, void **retKey)
Bool WMHashGetItemAndKey(WMHashTable * table, const void *key, void **retItem, void **retKey)
{
unsigned h;
HashItem *item;
unsigned h;
HashItem *item;
h = HASH(table, key);
item = table->table[h];
h = HASH(table, key);
item = table->table[h];
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual)(key, item->key)) {
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
break;
}
item = item->next;
}
}
if (item) {
if (retKey)
*retKey = (void*)item->key;
if (retItem)
*retItem = (void*)item->data;
return True;
} else {
return False;
}
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual) (key, item->key)) {
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
break;
}
item = item->next;
}
}
if (item) {
if (retKey)
*retKey = (void *)item->key;
if (retItem)
*retItem = (void *)item->data;
return True;
} else {
return False;
}
}
void*
WMHashInsert(WMHashTable *table, const void *key, const void *data)
void *WMHashInsert(WMHashTable * table, const void *key, const void *data)
{
unsigned h;
HashItem *item;
int replacing = 0;
unsigned h;
HashItem *item;
int replacing = 0;
h = HASH(table, key);
/* look for the entry */
item = table->table[h];
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual)(key, item->key)) {
replacing = 1;
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
replacing = 1;
break;
}
item = item->next;
}
}
h = HASH(table, key);
/* look for the entry */
item = table->table[h];
if (table->callbacks.keyIsEqual) {
while (item) {
if ((*table->callbacks.keyIsEqual) (key, item->key)) {
replacing = 1;
break;
}
item = item->next;
}
} else {
while (item) {
if (key == item->key) {
replacing = 1;
break;
}
item = item->next;
}
}
if (replacing) {
const void *old;
if (replacing) {
const void *old;
old = item->data;
item->data = data;
RELKEY(table, item->key);
item->key = DUPKEY(table, key);
old = item->data;
item->data = data;
RELKEY(table, item->key);
item->key = DUPKEY(table, key);
return (void*)old;
} else {
HashItem *nitem;
return (void *)old;
} else {
HashItem *nitem;
nitem = wmalloc(sizeof(HashItem));
nitem->key = DUPKEY(table, key);
nitem->data = data;
nitem->next = table->table[h];
table->table[h] = nitem;
nitem = wmalloc(sizeof(HashItem));
nitem->key = DUPKEY(table, key);
nitem->data = data;
nitem->next = table->table[h];
table->table[h] = nitem;
table->itemCount++;
}
table->itemCount++;
}
/* OPTIMIZE: put this in an idle handler.*/
if (table->itemCount > table->size) {
/* OPTIMIZE: put this in an idle handler. */
if (table->itemCount > table->size) {
#ifdef DEBUG0
printf("rebuilding hash table...\n");
printf("rebuilding hash table...\n");
#endif
rebuildTable(table);
rebuildTable(table);
#ifdef DEBUG0
printf("finished rebuild.\n");
printf("finished rebuild.\n");
#endif
}
}
return NULL;
return NULL;
}
static HashItem*
deleteFromList(HashTable *table, HashItem *item, const void *key)
static HashItem *deleteFromList(HashTable * table, HashItem * item, const void *key)
{
HashItem *next;
HashItem *next;
if (item==NULL)
return NULL;
if (item == NULL)
return NULL;
if ((table->callbacks.keyIsEqual
&& (*table->callbacks.keyIsEqual)(key, item->key))
|| (!table->callbacks.keyIsEqual && key==item->key)) {
if ((table->callbacks.keyIsEqual && (*table->callbacks.keyIsEqual) (key, item->key))
|| (!table->callbacks.keyIsEqual && key == item->key)) {
next = item->next;
RELKEY(table, item->key);
wfree(item);
next = item->next;
RELKEY(table, item->key);
wfree(item);
table->itemCount--;
table->itemCount--;
return next;
}
return next;
}
item->next = deleteFromList(table, item->next, key);
item->next = deleteFromList(table, item->next, key);
return item;
return item;
}
void
WMHashRemove(WMHashTable *table, const void *key)
void WMHashRemove(WMHashTable * table, const void *key)
{
unsigned h;
unsigned h;
h = HASH(table, key);
h = HASH(table, key);
table->table[h] = deleteFromList(table, table->table[h], key);
table->table[h] = deleteFromList(table, table->table[h], key);
}
WMHashEnumerator
WMEnumerateHashTable(WMHashTable *table)
WMHashEnumerator WMEnumerateHashTable(WMHashTable * table)
{
WMHashEnumerator enumerator;
WMHashEnumerator enumerator;
enumerator.table = table;
enumerator.index = 0;
enumerator.nextItem = table->table[0];
enumerator.table = table;
enumerator.index = 0;
enumerator.nextItem = table->table[0];
return enumerator;
return enumerator;
}
void*
WMNextHashEnumeratorItem(WMHashEnumerator *enumerator)
void *WMNextHashEnumeratorItem(WMHashEnumerator * enumerator)
{
const void *data = NULL;
const void *data = NULL;
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorItem() calls */
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorItem() calls */
if (enumerator->nextItem==NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index]!=NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem == NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index] != NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem) {
data = ((HashItem*)enumerator->nextItem)->data;
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
}
if (enumerator->nextItem) {
data = ((HashItem *) enumerator->nextItem)->data;
enumerator->nextItem = ((HashItem *) enumerator->nextItem)->next;
}
return (void*)data;
return (void *)data;
}
void*
WMNextHashEnumeratorKey(WMHashEnumerator *enumerator)
void *WMNextHashEnumeratorKey(WMHashEnumerator * enumerator)
{
const void *key = NULL;
const void *key = NULL;
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorKey() calls */
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorKey() calls */
if (enumerator->nextItem==NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index]!=NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem == NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index] != NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem) {
key = ((HashItem*)enumerator->nextItem)->key;
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
}
if (enumerator->nextItem) {
key = ((HashItem *) enumerator->nextItem)->key;
enumerator->nextItem = ((HashItem *) enumerator->nextItem)->next;
}
return (void*)key;
return (void *)key;
}
Bool
WMNextHashEnumeratorItemAndKey(WMHashEnumerator *enumerator,
void **item, void **key)
Bool WMNextHashEnumeratorItemAndKey(WMHashEnumerator * enumerator, void **item, void **key)
{
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
if (enumerator->nextItem==NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index]!=NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem == NULL) {
HashTable *table = enumerator->table;
while (++enumerator->index < table->size) {
if (table->table[enumerator->index] != NULL) {
enumerator->nextItem = table->table[enumerator->index];
break;
}
}
}
if (enumerator->nextItem) {
if (item)
*item = (void*)((HashItem*)enumerator->nextItem)->data;
if (key)
*key = (void*)((HashItem*)enumerator->nextItem)->key;
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
if (enumerator->nextItem) {
if (item)
*item = (void *)((HashItem *) enumerator->nextItem)->data;
if (key)
*key = (void *)((HashItem *) enumerator->nextItem)->key;
enumerator->nextItem = ((HashItem *) enumerator->nextItem)->next;
return True;
}
return True;
}
return False;
return False;
}
static Bool
compareStrings(const char *key1, const char *key2)
static Bool compareStrings(const char *key1, const char *key2)
{
return strcmp(key1, key2)==0;
return strcmp(key1, key2) == 0;
}
typedef unsigned (*hashFunc)(const void*);
typedef Bool (*isEqualFunc)(const void*, const void*);
typedef void* (*retainFunc)(const void*);
typedef void (*releaseFunc)(const void*);
typedef unsigned (*hashFunc) (const void *);
typedef Bool(*isEqualFunc) (const void *, const void *);
typedef void *(*retainFunc) (const void *);
typedef void (*releaseFunc) (const void *);
const WMHashTableCallbacks WMIntHashCallbacks = {
NULL,
NULL,
NULL,
NULL
NULL,
NULL,
NULL,
NULL
};
const WMHashTableCallbacks WMStringHashCallbacks = {
(hashFunc)hashString,
(isEqualFunc)compareStrings,
(retainFunc)wstrdup,
(releaseFunc)wfree
(hashFunc) hashString,
(isEqualFunc) compareStrings,
(retainFunc) wstrdup,
(releaseFunc) wfree
};
const WMHashTableCallbacks WMStringPointerHashCallbacks = {
(hashFunc)hashString,
(isEqualFunc)compareStrings,
NULL,
NULL
(hashFunc) hashString,
(isEqualFunc) compareStrings,
NULL,
NULL
};

View File

@@ -1,310 +0,0 @@
/*
* WINGs WMHost function library
*
* Copyright (c) 1999-2003 Dan Pascu
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "wconfig.h"
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "WUtil.h"
/* For Solaris */
#ifndef INADDR_NONE
# define INADDR_NONE (-1)
#endif
/* Max hostname length (RFC 1123) */
#define W_MAXHOSTNAMELEN 255
typedef struct W_Host {
char *name;
WMArray *names;
WMArray *addresses;
int refCount;
} W_Host;
static WMHashTable *hostCache = NULL;
static Bool hostCacheEnabled = True;
static WMHost*
getHostFromCache(char *name)
{
if (!hostCache)
return NULL;
return WMHashGet(hostCache, name);
}
static WMHost*
getHostWithHostEntry(struct hostent *host, char *name)
{
WMHost *hPtr;
struct in_addr in;
int i;
hPtr = (WMHost*)wmalloc(sizeof(WMHost));
memset(hPtr, 0, sizeof(WMHost));
hPtr->names = WMCreateArrayWithDestructor(1, wfree);
hPtr->addresses = WMCreateArrayWithDestructor(1, wfree);
WMAddToArray(hPtr->names, wstrdup(host->h_name));
for (i=0; host->h_aliases[i]!=NULL; i++) {
WMAddToArray(hPtr->names, wstrdup(host->h_aliases[i]));
}
for (i=0; host->h_addr_list[i]!=NULL; i++) {
memcpy((void*)&in.s_addr, (const void*)host->h_addr_list[i],
host->h_length);
WMAddToArray(hPtr->addresses, wstrdup(inet_ntoa(in)));
}
hPtr->refCount = 1;
if (hostCacheEnabled) {
if (!hostCache)
hostCache = WMCreateHashTable(WMStringPointerHashCallbacks);
hPtr->name = wstrdup(name);
wassertr(WMHashInsert(hostCache, hPtr->name, hPtr)==NULL);
hPtr->refCount++;
}
return hPtr;
}
WMHost*
WMGetCurrentHost()
{
char name[W_MAXHOSTNAMELEN+1];
if (gethostname(name, W_MAXHOSTNAMELEN) < 0) {
wsyserror(_("Cannot get current host name"));
return NULL;
}
name[W_MAXHOSTNAMELEN] = 0;
return WMGetHostWithName(name);
}
WMHost*
WMGetHostWithName(char *name)
{
struct hostent *host;
WMHost *hPtr;
wassertrv(name!=NULL, NULL);
if (hostCacheEnabled) {
if ((hPtr = getHostFromCache(name)) != NULL) {
WMRetainHost(hPtr);
return hPtr;
}
}
host = gethostbyname(name);
if (host == NULL) {
return NULL;
}
hPtr = getHostWithHostEntry(host, name);
return hPtr;
}
WMHost*
WMGetHostWithAddress(char *address)
{
struct hostent *host;
struct in_addr in;
WMHost *hPtr;
wassertrv(address!=NULL, NULL);
if (hostCacheEnabled) {
if ((hPtr = getHostFromCache(address)) != NULL) {
WMRetainHost(hPtr);
return hPtr;
}
}
#ifndef HAVE_INET_ATON
if ((in.s_addr = inet_addr(address)) == INADDR_NONE)
return NULL;
#else
if (inet_aton(address, &in) == 0)
return NULL;
#endif
host = gethostbyaddr((char*)&in, sizeof(in), AF_INET);
if (host == NULL) {
return NULL;
}
hPtr = getHostWithHostEntry(host, address);
return hPtr;
}
WMHost*
WMRetainHost(WMHost *hPtr)
{
hPtr->refCount++;
return hPtr;
}
void
WMReleaseHost(WMHost *hPtr)
{
hPtr->refCount--;
if (hPtr->refCount > 0)
return;
WMFreeArray(hPtr->names);
WMFreeArray(hPtr->addresses);
if (hPtr->name) {
WMHashRemove(hostCache, hPtr->name);
wfree(hPtr->name);
}
wfree(hPtr);
}
void
WMSetHostCacheEnabled(Bool flag)
{
hostCacheEnabled = ((flag==0) ? 0 : 1);
}
Bool
WMIsHostCacheEnabled()
{
return hostCacheEnabled;
}
void
WMFlushHostCache()
{
if (hostCache && WMCountHashTable(hostCache)>0) {
WMArray *hostArray = WMCreateArray(WMCountHashTable(hostCache));
WMHashEnumerator enumer = WMEnumerateHashTable(hostCache);
WMHost *hPtr;
int i;
while ((hPtr = WMNextHashEnumeratorItem(&enumer))) {
/* we can't release the host here, because we can't change the
* hash while using the enumerator functions. */
WMAddToArray(hostArray, hPtr);
}
for (i=0; i<WMGetArrayItemCount(hostArray); i++)
WMReleaseHost(WMGetFromArray(hostArray, i));
WMFreeArray(hostArray);
WMResetHashTable(hostCache);
}
}
static int
matchAddress(void *item, void *cdata)
{
return (strcmp((char*) item, (char*) cdata)==0);
}
Bool
WMIsHostEqualToHost(WMHost* hPtr, WMHost* aPtr)
{
char *adr;
int i;
wassertrv(hPtr!=NULL && aPtr!=NULL, False);
if (hPtr == aPtr)
return True;
for (i=0; i<WMGetArrayItemCount(aPtr->addresses); i++) {
adr = WMGetFromArray(aPtr->addresses, i);
if (WMFindInArray(hPtr->addresses, matchAddress, adr) != WANotFound) {
return True;
}
}
return False;
}
char*
WMGetHostName(WMHost *hPtr)
{
return (WMGetArrayItemCount(hPtr->names) > 0 ?
WMGetFromArray(hPtr->names, 0) : NULL);
/*return WMGetFromArray(hPtr->names, 0);*/
}
WMArray*
WMGetHostNames(WMHost *hPtr)
{
return hPtr->names;
}
char*
WMGetHostAddress(WMHost *hPtr)
{
return (WMGetArrayItemCount(hPtr->addresses) > 0 ?
WMGetFromArray(hPtr->addresses, 0) : NULL);
}
WMArray*
WMGetHostAddresses(WMHost *hPtr)
{
return hPtr->addresses;
}

View File

@@ -1,12 +0,0 @@
#include <X11/Xlib.h>
#include "WINGsP.h"
void
InitI18n(Display *dpy)
{
}

53
WINGs/make-rgb Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/python
import sys
import re
from optparse import OptionParser
parser = OptionParser(version="%prog 1.0")
parser.add_option("-f", "--file", dest="rgbtxtFile", default='/etc/X11/rgb.txt',
help="rgb.txt file containing X11 colors (/etc/X11/rgb.txt)",
metavar="File")
(options, args) = parser.parse_args()
f = open(options.rgbtxtFile)
lines = f.readlines()
f.close()
colorLine = re.compile(r'''\s*
(?P<red>\d+) # red
\s+
(?P<green>\d+) # green
\s+
(?P<blue>\d+) # blue
\s+
(?P<name>[^\s]+) # name
''', re.VERBOSE)
print '''
/* Automatically generated file. Do NOT edit. Regenerate it using make-rgb */
#ifndef RGB_H_
#define RGB_H_
#include <wraster.h>
typedef struct RGBColor {
RColor color;
char *name;
} RGBColor;
RGBColor rgbColors[] = {'''
for line in lines:
m = colorLine.match(line)
if m:
print ''' {{%(red)3s, %(green)3s, %(blue)3s, 0}, "%(name)s"},''' % m.groupdict()
print ''' {{ 0, 0, 0, 0}, NULL}
};
#endif
'''

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "wconfig.h"
#include "WUtil.h"
@@ -30,9 +29,12 @@
#include <assert.h>
#include <signal.h>
#ifdef TEST_WITH_GC
#ifdef USE_BOEHM_GC
#ifndef GC_DEBUG
#define GC_DEBUG
#endif /* !GC_DEBUG */
#include <gc/gc.h>
#endif
#endif /* USE_BOEHM_GC */
#ifndef False
# define False 0
@@ -41,194 +43,171 @@
# define True 1
#endif
static void
defaultHandler(int bla)
static void defaultHandler(int bla)
{
if (bla)
kill(getpid(), SIGABRT);
else
exit(1);
if (bla)
kill(getpid(), SIGABRT);
else
exit(1);
}
static waborthandler *aborthandler = (waborthandler*)defaultHandler;
static waborthandler *aborthandler = (waborthandler *) defaultHandler;
#define wAbort(a) (*aborthandler)(a)
waborthandler*
wsetabort(waborthandler *handler)
waborthandler *wsetabort(waborthandler * handler)
{
waborthandler *old = aborthandler;
waborthandler *old = aborthandler;
aborthandler = handler;
aborthandler = handler;
return old;
return old;
}
static int Aborting=0; /* if we're in the middle of an emergency exit */
static int Aborting = 0; /* if we're in the middle of an emergency exit */
static WMHashTable *table = NULL;
void*
wmalloc(size_t size)
void *wmalloc(size_t size)
{
void *tmp;
void *tmp;
assert(size > 0);
assert(size > 0);
#ifdef TEST_WITH_GC
tmp = GC_malloc(size);
#ifdef USE_BOEHM_GC
tmp = GC_MALLOC(size);
#else
tmp = malloc(size);
tmp = malloc(size);
#endif
if (tmp == NULL) {
wwarning("malloc() failed. Retrying after 2s.");
sleep(2);
#ifdef TEST_WITH_GC
tmp = GC_malloc(size);
if (tmp == NULL) {
wwarning("malloc() failed. Retrying after 2s.");
sleep(2);
#ifdef USE_BOEHM_GC
tmp = GC_MALLOC(size);
#else
tmp = malloc(size);
tmp = malloc(size);
#endif
if (tmp == NULL) {
if (Aborting) {
fputs("Really Bad Error: recursive malloc() failure.", stderr);
exit(-1);
} else {
wfatal("virtual memory exhausted");
Aborting=1;
wAbort(False);
}
}
}
return tmp;
if (tmp == NULL) {
if (Aborting) {
fputs("Really Bad Error: recursive malloc() failure.", stderr);
exit(-1);
} else {
wfatal("virtual memory exhausted");
Aborting = 1;
wAbort(False);
}
}
}
memset(tmp, 0, size);
return tmp;
}
void*
wmalloc0(size_t size)
void *wrealloc(void *ptr, size_t newsize)
{
void *ptr= wmalloc(size);
if (!ptr)
return NULL;
void *nptr;
memset(ptr, 0, size);
return ptr;
if (!ptr) {
nptr = wmalloc(newsize);
} else if (newsize == 0) {
wfree(ptr);
nptr = NULL;
} else {
#ifdef USE_BOEHM_GC
nptr = GC_REALLOC(ptr, newsize);
#else
nptr = realloc(ptr, newsize);
#endif
if (nptr == NULL) {
wwarning("realloc() failed. Retrying after 2s.");
sleep(2);
#ifdef USE_BOEHM_GC
nptr = GC_REALLOC(ptr, newsize);
#else
nptr = realloc(ptr, newsize);
#endif
if (nptr == NULL) {
if (Aborting) {
fputs("Really Bad Error: recursive realloc() failure.", stderr);
exit(-1);
} else {
wfatal("virtual memory exhausted");
Aborting = 1;
wAbort(False);
}
}
}
}
return nptr;
}
void*
wrealloc(void *ptr, size_t newsize)
void *wretain(void *ptr)
{
void *nptr;
int *refcount;
if (!ptr) {
nptr = wmalloc(newsize);
} else if (newsize==0) {
wfree(ptr);
nptr = NULL;
} else {
#ifdef TEST_WITH_GC
nptr = GC_realloc(ptr, newsize);
#else
nptr = realloc(ptr, newsize);
#endif
if (nptr==NULL) {
wwarning("realloc() failed. Retrying after 2s.");
sleep(2);
#ifdef TEST_WITH_GC
nptr = GC_realloc(ptr, newsize);
#else
nptr = realloc(ptr, newsize);
#endif
if (nptr == NULL) {
if (Aborting) {
fputs("Really Bad Error: recursive realloc() failure.",
stderr);
exit(-1);
} else {
wfatal("virtual memory exhausted");
Aborting=1;
wAbort(False);
}
}
}
}
return nptr;
}
if (!table) {
table = WMCreateHashTable(WMIntHashCallbacks);
}
void*
wretain(void *ptr)
{
int *refcount;
if (!table) {
table = WMCreateHashTable(WMIntHashCallbacks);
}
refcount = WMHashGet(table, ptr);
if (!refcount) {
refcount = wmalloc(sizeof(int));
*refcount = 1;
WMHashInsert(table, ptr, refcount);
refcount = WMHashGet(table, ptr);
if (!refcount) {
refcount = wmalloc(sizeof(int));
*refcount = 1;
WMHashInsert(table, ptr, refcount);
#ifdef VERBOSE
printf("== %i (%p)\n", *refcount, ptr);
printf("== %i (%p)\n", *refcount, ptr);
#endif
} else {
(*refcount)++;
} else {
(*refcount)++;
#ifdef VERBOSE
printf("+ %i (%p)\n", *refcount, ptr);
printf("+ %i (%p)\n", *refcount, ptr);
#endif
}
}
return ptr;
return ptr;
}
void
wfree(void *ptr)
void wfree(void *ptr)
{
#ifdef TEST_WITH_GC
GC_free(ptr);
if (ptr)
#ifdef USE_BOEHM_GC
/* This should eventually be removed, once the criss-cross
* of wmalloc()d memory being free()d, malloc()d memory being
* wfree()d, various misuses of calling wfree() on objects
* allocated by libc malloc() and calling libc free() on
* objects allocated by Boehm GC (think external libraries)
* is cleaned up.
*/
if (GC_base(ptr) != 0)
GC_FREE(ptr);
else
free(ptr);
#else
free(ptr);
free(ptr);
#endif
ptr = NULL;
}
void
wrelease(void *ptr)
void wrelease(void *ptr)
{
int *refcount;
int *refcount;
refcount = WMHashGet(table, ptr);
if (!refcount) {
wwarning("trying to release unexisting data %p", ptr);
} else {
(*refcount)--;
if (*refcount < 1) {
refcount = WMHashGet(table, ptr);
if (!refcount) {
wwarning("trying to release unexisting data %p", ptr);
} else {
(*refcount)--;
if (*refcount < 1) {
#ifdef VERBOSE
printf("RELEASING %p\n", ptr);
printf("RELEASING %p\n", ptr);
#endif
WMHashRemove(table, ptr);
wfree(refcount);
wfree(ptr);
}
WMHashRemove(table, ptr);
wfree(refcount);
wfree(ptr);
}
#ifdef VERBOSE
else {
printf("- %i (%p)\n", *refcount, ptr);
}
else {
printf("- %i (%p)\n", *refcount, ptr);
}
#endif
}
}
}

View File

@@ -3,16 +3,12 @@
#include "WINGsP.h"
WMRange
wmkrange(int start, int count)
WMRange wmkrange(int start, int count)
{
WMRange range;
WMRange range;
range.position = start;
range.count = count;
range.position = start;
range.count = count;
return range;
return range;
}

View File

@@ -6,538 +6,461 @@
#include "WUtil.h"
typedef struct W_Notification {
const char *name;
void *object;
void *clientData;
int refCount;
const char *name;
void *object;
void *clientData;
int refCount;
} Notification;
extern void W_FlushASAPNotificationQueue();
const char*
WMGetNotificationName(WMNotification *notification)
const char *WMGetNotificationName(WMNotification * notification)
{
return notification->name;
return notification->name;
}
void*
WMGetNotificationObject(WMNotification *notification)
void *WMGetNotificationObject(WMNotification * notification)
{
return notification->object;
return notification->object;
}
void*
WMGetNotificationClientData(WMNotification *notification)
void *WMGetNotificationClientData(WMNotification * notification)
{
return notification->clientData;
return notification->clientData;
}
WMNotification*
WMCreateNotification(const char *name, void *object, void *clientData)
WMNotification *WMCreateNotification(const char *name, void *object, void *clientData)
{
Notification *nPtr;
Notification *nPtr;
nPtr = wmalloc(sizeof(Notification));
nPtr = wmalloc(sizeof(Notification));
nPtr->name = name;
nPtr->object = object;
nPtr->clientData = clientData;
nPtr->refCount = 1;
nPtr->name = name;
nPtr->object = object;
nPtr->clientData = clientData;
nPtr->refCount = 1;
return nPtr;
return nPtr;
}
void
WMReleaseNotification(WMNotification *notification)
void WMReleaseNotification(WMNotification * notification)
{
notification->refCount--;
notification->refCount--;
if (notification->refCount < 1) {
wfree(notification);
}
if (notification->refCount < 1) {
wfree(notification);
}
}
WMNotification*
WMRetainNotification(WMNotification *notification)
WMNotification *WMRetainNotification(WMNotification * notification)
{
notification->refCount++;
notification->refCount++;
return notification;
return notification;
}
/***************** Notification Center *****************/
typedef struct NotificationObserver {
WMNotificationObserverAction *observerAction;
void *observer;
WMNotificationObserverAction *observerAction;
void *observer;
const char *name;
void *object;
const char *name;
void *object;
struct NotificationObserver *prev; /* for tables */
struct NotificationObserver *next;
struct NotificationObserver *nextAction; /* for observerTable */
struct NotificationObserver *prev; /* for tables */
struct NotificationObserver *next;
struct NotificationObserver *nextAction; /* for observerTable */
} NotificationObserver;
typedef struct W_NotificationCenter {
WMHashTable *nameTable; /* names -> observer lists */
WMHashTable *objectTable; /* object -> observer lists */
NotificationObserver *nilList; /* obervers that catch everything */
WMHashTable *nameTable; /* names -> observer lists */
WMHashTable *objectTable; /* object -> observer lists */
NotificationObserver *nilList; /* obervers that catch everything */
WMHashTable *observerTable; /* observer -> NotificationObserver */
WMHashTable *observerTable; /* observer -> NotificationObserver */
} NotificationCenter;
/* default (and only) center */
static NotificationCenter *notificationCenter = NULL;
void
W_InitNotificationCenter(void)
void W_InitNotificationCenter(void)
{
notificationCenter = wmalloc(sizeof(NotificationCenter));
notificationCenter->nameTable = WMCreateHashTable(WMStringPointerHashCallbacks);
notificationCenter->objectTable = WMCreateHashTable(WMIntHashCallbacks);
notificationCenter->nilList = NULL;
notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
notificationCenter = wmalloc(sizeof(NotificationCenter));
notificationCenter->nameTable = WMCreateHashTable(WMStringPointerHashCallbacks);
notificationCenter->objectTable = WMCreateHashTable(WMIntHashCallbacks);
notificationCenter->nilList = NULL;
notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
}
void
WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
void *observer, const char *name, void *object)
WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
void *observer, const char *name, void *object)
{
NotificationObserver *oRec, *rec;
NotificationObserver *oRec, *rec;
oRec = wmalloc(sizeof(NotificationObserver));
oRec->observerAction = observerAction;
oRec->observer = observer;
oRec->name = name;
oRec->object = object;
oRec->next = NULL;
oRec->prev = NULL;
oRec = wmalloc(sizeof(NotificationObserver));
oRec->observerAction = observerAction;
oRec->observer = observer;
oRec->name = name;
oRec->object = object;
oRec->next = NULL;
oRec->prev = NULL;
/* put this action in the list of actions for this observer */
rec = (NotificationObserver *) WMHashInsert(notificationCenter->observerTable, observer, oRec);
/* put this action in the list of actions for this observer */
rec = (NotificationObserver*)WMHashInsert(notificationCenter->observerTable,
observer, oRec);
if (rec) {
/* if this is not the first action for the observer */
oRec->nextAction = rec;
} else {
oRec->nextAction = NULL;
}
if (rec) {
/* if this is not the first action for the observer */
oRec->nextAction = rec;
} else {
oRec->nextAction = NULL;
}
if (!name && !object) {
/* catch-all */
oRec->next = notificationCenter->nilList;
if (notificationCenter->nilList) {
notificationCenter->nilList->prev = oRec;
}
notificationCenter->nilList = oRec;
} else if (!name) {
/* any message coming from object */
rec = (NotificationObserver*)WMHashInsert(notificationCenter->objectTable,
object, oRec);
oRec->next = rec;
if (rec) {
rec->prev = oRec;
}
} else {
/* name && (object || !object) */
rec = (NotificationObserver*)WMHashInsert(notificationCenter->nameTable,
name, oRec);
oRec->next = rec;
if (rec) {
rec->prev = oRec;
}
}
if (!name && !object) {
/* catch-all */
oRec->next = notificationCenter->nilList;
if (notificationCenter->nilList) {
notificationCenter->nilList->prev = oRec;
}
notificationCenter->nilList = oRec;
} else if (!name) {
/* any message coming from object */
rec = (NotificationObserver *) WMHashInsert(notificationCenter->objectTable, object, oRec);
oRec->next = rec;
if (rec) {
rec->prev = oRec;
}
} else {
/* name && (object || !object) */
rec = (NotificationObserver *) WMHashInsert(notificationCenter->nameTable, name, oRec);
oRec->next = rec;
if (rec) {
rec->prev = oRec;
}
}
}
void
WMPostNotification(WMNotification *notification)
void WMPostNotification(WMNotification * notification)
{
NotificationObserver *orec, *tmp;
NotificationObserver *orec, *tmp;
WMRetainNotification(notification);
WMRetainNotification(notification);
/* tell the observers that want to know about a particular message */
orec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
notification->name);
/* tell the observers that want to know about a particular message */
orec = (NotificationObserver *) WMHashGet(notificationCenter->nameTable, notification->name);
while (orec) {
tmp = orec->next;
while (orec) {
tmp = orec->next;
if (!orec->object || !notification->object
|| orec->object == notification->object) {
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction)(orec->observer, notification);
}
}
if (!orec->object || !notification->object || orec->object == notification->object) {
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction) (orec->observer, notification);
}
}
orec = tmp;
}
orec = tmp;
}
/* tell the observers that want to know about an object */
orec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable,
notification->object);
/* tell the observers that want to know about an object */
orec = (NotificationObserver *) WMHashGet(notificationCenter->objectTable, notification->object);
while (orec) {
tmp = orec->next;
while (orec) {
tmp = orec->next;
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction)(orec->observer, notification);
}
orec = tmp;
}
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction) (orec->observer, notification);
}
orec = tmp;
}
/* tell the catch all observers */
orec = notificationCenter->nilList;
while (orec) {
tmp = orec->next;
/* tell the catch all observers */
orec = notificationCenter->nilList;
while (orec) {
tmp = orec->next;
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction)(orec->observer, notification);
}
orec = tmp;
}
/* tell the observer */
if (orec->observerAction) {
(*orec->observerAction) (orec->observer, notification);
}
orec = tmp;
}
WMReleaseNotification(notification);
WMReleaseNotification(notification);
}
void
WMRemoveNotificationObserver(void *observer)
void WMRemoveNotificationObserver(void *observer)
{
NotificationObserver *orec, *tmp, *rec;
NotificationObserver *orec, *tmp, *rec;
/* get the list of actions the observer is doing */
orec = (NotificationObserver*)WMHashGet(notificationCenter->observerTable,
observer);
/* get the list of actions the observer is doing */
orec = (NotificationObserver *) WMHashGet(notificationCenter->observerTable, observer);
/*
* FOREACH orec IN actionlist for observer
* DO
* remove from respective lists/tables
* free
* END
*/
while (orec) {
tmp = orec->nextAction;
/*
* FOREACH orec IN actionlist for observer
* DO
* remove from respective lists/tables
* free
* END
*/
while (orec) {
tmp = orec->nextAction;
if (!orec->name && !orec->object) {
/* catch-all */
if (notificationCenter->nilList==orec)
notificationCenter->nilList = orec->next;
} else if (!orec->name) {
/* any message coming from object */
rec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable,
orec->object);
if (rec==orec) {
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->objectTable, orec->object,
orec->next);
} else {
WMHashRemove(notificationCenter->objectTable, orec->object);
}
}
} else {
/* name && (object || !object) */
rec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
orec->name);
if (rec==orec) {
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->nameTable, orec->name,
orec->next);
} else {
WMHashRemove(notificationCenter->nameTable, orec->name);
}
}
}
if (orec->prev)
orec->prev->next = orec->next;
if (orec->next)
orec->next->prev = orec->prev;
if (!orec->name && !orec->object) {
/* catch-all */
if (notificationCenter->nilList == orec)
notificationCenter->nilList = orec->next;
} else if (!orec->name) {
/* any message coming from object */
rec = (NotificationObserver *) WMHashGet(notificationCenter->objectTable, orec->object);
if (rec == orec) {
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->objectTable, orec->object, orec->next);
} else {
WMHashRemove(notificationCenter->objectTable, orec->object);
}
}
} else {
/* name && (object || !object) */
rec = (NotificationObserver *) WMHashGet(notificationCenter->nameTable, orec->name);
if (rec == orec) {
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->nameTable, orec->name, orec->next);
} else {
WMHashRemove(notificationCenter->nameTable, orec->name);
}
}
}
if (orec->prev)
orec->prev->next = orec->next;
if (orec->next)
orec->next->prev = orec->prev;
wfree(orec);
wfree(orec);
orec = tmp;
}
orec = tmp;
}
WMHashRemove(notificationCenter->observerTable, observer);
WMHashRemove(notificationCenter->observerTable, observer);
}
void
WMRemoveNotificationObserverWithName(void *observer, const char *name, void *object)
void WMRemoveNotificationObserverWithName(void *observer, const char *name, void *object)
{
NotificationObserver *orec, *tmp, *rec;
NotificationObserver *newList = NULL;
NotificationObserver *orec, *tmp, *rec;
NotificationObserver *newList = NULL;
/* get the list of actions the observer is doing */
orec = (NotificationObserver*)WMHashGet(notificationCenter->observerTable, observer);
/* get the list of actions the observer is doing */
orec = (NotificationObserver *) WMHashGet(notificationCenter->observerTable, observer);
WMHashRemove(notificationCenter->observerTable, observer);
WMHashRemove(notificationCenter->observerTable, observer);
/* rebuild the list of actions for the observer */
/* rebuild the list of actions for the observer */
while (orec) {
tmp = orec->nextAction;
if (orec->name == name && orec->object == object) {
if (!name && !object) {
if (notificationCenter->nilList == orec)
notificationCenter->nilList = orec->next;
} else if (!name) {
rec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable, orec->object);
if (rec==orec) {
assert(rec->prev==NULL);
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->objectTable,
orec->object, orec->next);
} else {
WMHashRemove(notificationCenter->objectTable,
orec->object);
}
}
} else {
rec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
orec->name);
if (rec==orec) {
assert(rec->prev==NULL);
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->nameTable,
orec->name, orec->next);
} else {
WMHashRemove(notificationCenter->nameTable,
orec->name);
}
}
}
while (orec) {
tmp = orec->nextAction;
if (orec->name == name && orec->object == object) {
if (!name && !object) {
if (notificationCenter->nilList == orec)
notificationCenter->nilList = orec->next;
} else if (!name) {
rec =
(NotificationObserver *) WMHashGet(notificationCenter->objectTable,
orec->object);
if (rec == orec) {
assert(rec->prev == NULL);
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->objectTable,
orec->object, orec->next);
} else {
WMHashRemove(notificationCenter->objectTable, orec->object);
}
}
} else {
rec = (NotificationObserver *) WMHashGet(notificationCenter->nameTable,
orec->name);
if (rec == orec) {
assert(rec->prev == NULL);
/* replace table entry */
if (orec->next) {
WMHashInsert(notificationCenter->nameTable,
orec->name, orec->next);
} else {
WMHashRemove(notificationCenter->nameTable, orec->name);
}
}
}
if (orec->prev)
orec->prev->next = orec->next;
if (orec->next)
orec->next->prev = orec->prev;
wfree(orec);
} else {
/* append this action in the new action list */
orec->nextAction = NULL;
if (!newList) {
newList = orec;
} else {
NotificationObserver *p;
if (orec->prev)
orec->prev->next = orec->next;
if (orec->next)
orec->next->prev = orec->prev;
wfree(orec);
} else {
/* append this action in the new action list */
orec->nextAction = NULL;
if (!newList) {
newList = orec;
} else {
NotificationObserver *p;
p = newList;
while (p->nextAction) {
p = p->nextAction;
}
p->nextAction = orec;
}
}
orec = tmp;
}
p = newList;
while (p->nextAction) {
p = p->nextAction;
}
p->nextAction = orec;
}
}
orec = tmp;
}
/* reinsert the list to the table */
if (newList) {
WMHashInsert(notificationCenter->observerTable, observer, newList);
}
/* reinsert the list to the table */
if (newList) {
WMHashInsert(notificationCenter->observerTable, observer, newList);
}
}
void
WMPostNotificationName(const char *name, void *object, void *clientData)
void WMPostNotificationName(const char *name, void *object, void *clientData)
{
WMNotification *notification;
WMNotification *notification;
notification = WMCreateNotification(name, object, clientData);
notification = WMCreateNotification(name, object, clientData);
WMPostNotification(notification);
WMPostNotification(notification);
WMReleaseNotification(notification);
WMReleaseNotification(notification);
}
/**************** Notification Queues ****************/
typedef struct W_NotificationQueue {
WMArray *asapQueue;
WMArray *idleQueue;
WMArray *asapQueue;
WMArray *idleQueue;
struct W_NotificationQueue *next;
struct W_NotificationQueue *next;
} NotificationQueue;
static WMNotificationQueue *notificationQueueList = NULL;
/* default queue */
static WMNotificationQueue *notificationQueue = NULL;
WMNotificationQueue*
WMGetDefaultNotificationQueue(void)
WMNotificationQueue *WMGetDefaultNotificationQueue(void)
{
if (!notificationQueue)
notificationQueue = WMCreateNotificationQueue();
if (!notificationQueue)
notificationQueue = WMCreateNotificationQueue();
return notificationQueue;
return notificationQueue;
}
WMNotificationQueue*
WMCreateNotificationQueue(void)
WMNotificationQueue *WMCreateNotificationQueue(void)
{
NotificationQueue *queue;
NotificationQueue *queue;
queue = wmalloc(sizeof(NotificationQueue));
queue = wmalloc(sizeof(NotificationQueue));
queue->asapQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification);
queue->idleQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification);
queue->next = notificationQueueList;
queue->asapQueue =
WMCreateArrayWithDestructor(8, (WMFreeDataProc*)WMReleaseNotification);
queue->idleQueue =
WMCreateArrayWithDestructor(8, (WMFreeDataProc*)WMReleaseNotification);
queue->next = notificationQueueList;
notificationQueueList = queue;
notificationQueueList = queue;
return queue;
return queue;
}
void
WMEnqueueNotification(WMNotificationQueue *queue, WMNotification *notification,
WMPostingStyle postingStyle)
void WMEnqueueNotification(WMNotificationQueue * queue, WMNotification * notification, WMPostingStyle postingStyle)
{
WMEnqueueCoalesceNotification(queue, notification, postingStyle,
WNCOnName|WNCOnSender);
WMEnqueueCoalesceNotification(queue, notification, postingStyle, WNCOnName | WNCOnSender);
}
#define NOTIF ((WMNotification*)cdata)
#define ITEM ((WMNotification*)item)
static int
matchSenderAndName(void *item, void *cdata)
static int matchSenderAndName(const void *item, const void *cdata)
{
return (NOTIF->object==ITEM->object && strcmp(NOTIF->name, ITEM->name)==0);
return (NOTIF->object == ITEM->object && strcmp(NOTIF->name, ITEM->name) == 0);
}
static int
matchSender(void *item, void *cdata)
static int matchSender(const void *item, const void *cdata)
{
return (NOTIF->object == ITEM->object);
return (NOTIF->object == ITEM->object);
}
static int
matchName(void *item, void *cdata)
static int matchName(const void *item, const void *cdata)
{
return (strcmp(NOTIF->name, ITEM->name)==0);
return (strcmp(NOTIF->name, ITEM->name) == 0);
}
#undef NOTIF
#undef ITEM
void
WMDequeueNotificationMatching(WMNotificationQueue *queue,
WMNotification *notification, unsigned mask)
void WMDequeueNotificationMatching(WMNotificationQueue * queue, WMNotification * notification, unsigned mask)
{
WMMatchDataProc *matchFunc;
WMMatchDataProc *matchFunc;
if ((mask & WNCOnName) && (mask & WNCOnSender))
matchFunc = matchSenderAndName;
else if (mask & WNCOnName)
matchFunc = matchName;
else if (mask & WNCOnSender)
matchFunc = matchSender;
else
return;
if ((mask & WNCOnName) && (mask & WNCOnSender))
matchFunc = matchSenderAndName;
else if (mask & WNCOnName)
matchFunc = matchName;
else if (mask & WNCOnSender)
matchFunc = matchSender;
else
return;
WMRemoveFromArrayMatching(queue->asapQueue, matchFunc, notification);
WMRemoveFromArrayMatching(queue->idleQueue, matchFunc, notification);
WMRemoveFromArrayMatching(queue->asapQueue, matchFunc, notification);
WMRemoveFromArrayMatching(queue->idleQueue, matchFunc, notification);
}
void
WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
WMNotification *notification,
WMPostingStyle postingStyle,
unsigned coalesceMask)
WMEnqueueCoalesceNotification(WMNotificationQueue * queue,
WMNotification * notification, WMPostingStyle postingStyle, unsigned coalesceMask)
{
if (coalesceMask != WNCNone)
WMDequeueNotificationMatching(queue, notification, coalesceMask);
if (coalesceMask != WNCNone)
WMDequeueNotificationMatching(queue, notification, coalesceMask);
switch (postingStyle) {
case WMPostNow:
WMPostNotification(notification);
WMReleaseNotification(notification);
break;
switch (postingStyle) {
case WMPostNow:
WMPostNotification(notification);
WMReleaseNotification(notification);
break;
case WMPostASAP:
WMAddToArray(queue->asapQueue, notification);
break;
case WMPostASAP:
WMAddToArray(queue->asapQueue, notification);
break;
case WMPostWhenIdle:
WMAddToArray(queue->idleQueue, notification);
break;
}
case WMPostWhenIdle:
WMAddToArray(queue->idleQueue, notification);
break;
}
}
void
W_FlushASAPNotificationQueue()
void W_FlushASAPNotificationQueue()
{
WMNotificationQueue *queue = notificationQueueList;
WMNotificationQueue *queue = notificationQueueList;
while (queue) {
while (WMGetArrayItemCount(queue->asapQueue)) {
WMPostNotification(WMGetFromArray(queue->asapQueue, 0));
WMDeleteFromArray(queue->asapQueue, 0);
}
while (queue) {
while (WMGetArrayItemCount(queue->asapQueue)) {
WMPostNotification(WMGetFromArray(queue->asapQueue, 0));
WMDeleteFromArray(queue->asapQueue, 0);
}
queue = queue->next;
}
queue = queue->next;
}
}
void
W_FlushIdleNotificationQueue()
void W_FlushIdleNotificationQueue()
{
WMNotificationQueue *queue = notificationQueueList;
WMNotificationQueue *queue = notificationQueueList;
while (queue) {
while (WMGetArrayItemCount(queue->idleQueue)) {
WMPostNotification(WMGetFromArray(queue->idleQueue, 0));
WMDeleteFromArray(queue->idleQueue, 0);
}
while (queue) {
while (WMGetArrayItemCount(queue->idleQueue)) {
WMPostNotification(WMGetFromArray(queue->idleQueue, 0));
WMDeleteFromArray(queue->idleQueue, 0);
}
queue = queue->next;
}
queue = queue->next;
}
}

View File

@@ -1,4 +0,0 @@
Makefile Makefile.in
.psrc .inslog2 tca.map tca.log pchdir *.rpt
*.pot
*.mo

View File

@@ -7,10 +7,8 @@ CLEANFILES = $(CATALOGS) WINGs.pot
EXTRA_DIST = bg.po ca.po cs.po de.po fr.po sk.po
POTFILES = \
$(top_builddir)/WINGs/connection.c \
$(top_builddir)/WINGs/error.c \
$(top_builddir)/WINGs/findfile.c \
$(top_builddir)/WINGs/host.c \
$(top_builddir)/WINGs/proplist.c \
$(top_builddir)/WINGs/userdefaults.c \
$(top_builddir)/WINGs/wcolor.c \

View File

@@ -1,23 +1,28 @@
# KTranslator Generated File
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# German Message Catalog for WINGs
#
# Initial translation
# Gudio Scholz <guido.scholz@bayernline.de>
#
# Adapted to versions 0.80 ff.
# Torsten Marek <shlomme@gmx.net>
#
msgid ""
msgstr ""
"Project-Id-Version: WINGs 0.80.0\n"
"POT-Creation-Date: 2002-01-09 21:06+0100\n"
"PO-Revision-Date: 2002-01-09 21:20+0100\n"
"Last-Translator: Guido Scholz <guido.scholz@bayernline.de>\n"
"Language-Team: Deutsch <de@li.org>\n"
"Project-Id-Version: WINGs\n"
"POT-Creation-Date: 2004-11-01 16:24+0100\n"
"PO-Revision-Date: 2004-11-05 23:48+0100\n"
"Last-Translator: shlomme@gmx.net\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: unknown\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../WINGs/connection.c:461 ../../WINGs/connection.c:526
#: ../../WINGs/connection.c:569
#: ../../WINGs/connection.c:471 ../../WINGs/connection.c:536
#: ../../WINGs/connection.c:579
msgid "Bad address-service-protocol combination"
msgstr "Ungültige Adress-Dienst-Protokoll Kombination"
msgstr "Ungültige Kombination von Adresse und Dienstprotokoll"
#: ../../WINGs/error.c:54
#, c-format
@@ -44,346 +49,349 @@ msgstr " Fehler: "
#: ../../WINGs/findfile.c:48
#, c-format
msgid "could not get password entry for UID %i"
msgstr "konnte Passwort nicht ermitteln für UID %i"
msgstr "Passworteintrag für UID %i konnte nicht ermittelt werden"
#: ../../WINGs/findfile.c:66
#, c-format
msgid "could not get password entry for user %s"
msgstr "konnte Passwort nicht ermitteln für Benutzer %s"
msgstr "Passworteintrag für Benutzer %s konnte nicht ermittelt werden"
#: ../../WINGs/host.c:114
msgid "Cannot get current host name"
msgstr "Kann aktuellen Hostnamen nicht ermitteln"
msgstr "Aktueller Hostname kann nicht ermittelt werden"
#: ../../WINGs/proplist.c:91
#, c-format
msgid "syntax error in %s %s, line %i: %s"
msgstr "Syntaxfehler in %s %s, Zeile %i: %s"
#: ../../WINGs/proplist.c:150
msgid "Only string or data is supported for a proplist dictionary key"
msgstr ""
"Nur string oder data wird als Schlüssel für ein proplist dictionary "
"Nur Zeichenketten oder Binärdaten werden als Schlüssel für ein PropList-Dictionary "
"unterstützt"
#: ../../WINGs/proplist.c:184 ../../WINGs/proplist.c:236
#: ../../WINGs/proplist.c:394 ../../WINGs/proplist.c:474
#: ../../WINGs/proplist.c:1071 ../../WINGs/proplist.c:1123
#: ../../WINGs/proplist.c:1289 ../../WINGs/proplist.c:1368
#: ../../WINGs/proplist.c:1489 ../../WINGs/proplist.c:1536
#: ../../WINGs/proplist.c:1075 ../../WINGs/proplist.c:1127
#: ../../WINGs/proplist.c:1293 ../../WINGs/proplist.c:1372
#: ../../WINGs/proplist.c:1493 ../../WINGs/proplist.c:1540
msgid "Used proplist functions on non-WMPropLists objects"
msgstr ""
msgstr "PropList-Funktionen werden auf nicht-WMPropList-Objekte angewendet"
#: ../../WINGs/proplist.c:630
msgid "unterminated PropList string"
msgstr "nicht terminierter PropList string"
msgstr "nicht terminierte PropList-Zeichenkette"
#: ../../WINGs/proplist.c:670
msgid "unterminated PropList data"
msgstr "nicht terminiertes PropList data"
msgstr "nicht terminierte PropList-Binärdaten"
#: ../../WINGs/proplist.c:678
msgid "unterminated PropList data (missing hexdigit)"
msgstr "nicht terminiertes PropList data (fehlendes hex-Zeichen)"
msgstr "nicht terminierte PropList-Binärdaten (fehlendes Hex-Zeichen)"
#: ../../WINGs/proplist.c:690
#: ../../WINGs/proplist.c:690 ../../WINGs/proplist.c:695
msgid "non hexdigit character in PropList data"
msgstr "falsches hex-Zeichen in PropList data"
msgstr "falsches Hex-Zeichen in PropList-Binärdaten"
#: ../../WINGs/proplist.c:725
#: ../../WINGs/proplist.c:729
msgid "unterminated PropList array"
msgstr "nicht terminiertes PropList array"
msgstr "nicht terminiertes PropList-Array"
#: ../../WINGs/proplist.c:733
#: ../../WINGs/proplist.c:737
msgid "missing or unterminated PropList array"
msgstr "fehlendes oder nicht terminiertes PropList array"
msgstr "fehlendes oder nicht terminiertes PropList-Array"
#: ../../WINGs/proplist.c:743
#: ../../WINGs/proplist.c:747
msgid "could not get PropList array element"
msgstr ""
msgstr "PropList-Array-Element konnte nicht gelesen werden"
#: ../../WINGs/proplist.c:772
#: ../../WINGs/proplist.c:776
msgid "unterminated PropList dictionary"
msgstr ""
msgstr "nicht terminiertes PropList-Dictionary"
#: ../../WINGs/proplist.c:789
#: ../../WINGs/proplist.c:793
msgid "missing PropList dictionary key"
msgstr ""
msgstr "fehlender Schlüssel in PropList-Dictionary"
#: ../../WINGs/proplist.c:791
#: ../../WINGs/proplist.c:795
msgid "missing PropList dictionary entry key or unterminated dictionary"
msgstr ""
msgstr "fehlender Schlüssel in PropList-Dictionary oder fehlende Terminierung"
#: ../../WINGs/proplist.c:799
#: ../../WINGs/proplist.c:803
msgid "error parsing PropList dictionary key"
msgstr ""
msgstr "Fehler beim Parsen eines PropList-Dictionary-Schlüssels"
#: ../../WINGs/proplist.c:807
#: ../../WINGs/proplist.c:811
msgid "missing = in PropList dictionary entry"
msgstr ""
msgstr "fehlendes \"=\" in PropList-Dictionary-Schlüssel"
#: ../../WINGs/proplist.c:815
#: ../../WINGs/proplist.c:819
msgid "error parsing PropList dictionary entry value"
msgstr ""
msgstr "Fehler beim Parsen eines PropList-Dictionary-Wertes"
#: ../../WINGs/proplist.c:823
#: ../../WINGs/proplist.c:827
msgid "missing ; in PropList dictionary entry"
msgstr ""
msgstr "fehlendes \";\" in PropList-Dictionary-Eintrag"
#: ../../WINGs/proplist.c:884
#: ../../WINGs/proplist.c:888
msgid ""
"was expecting a string, data, array or dictionary. If it's a string, try "
"enclosing it with \"."
msgstr ""
"string, data, array oder dictionary wurde erwartet. Zeichenketten mit \" "
"Zeichenkette, Binärdaten, Array oder Dictionary erwartet. Zeichenketten ggf. mit \" "
"einklammern."
#: ../../WINGs/proplist.c:888
#: ../../WINGs/proplist.c:892
msgid "Comments are not allowed inside WindowMaker owned domain files."
msgstr "Kommentare sind in Domaindaten von WindowMaker nicht erlaubt."
msgstr "Kommentare sind in Domänendaten von WindowMaker nicht erlaubt."
#: ../../WINGs/proplist.c:1559 ../../WINGs/proplist.c:1624
#: ../../WINGs/proplist.c:1563 ../../WINGs/proplist.c:1630
msgid "extra data after end of property list"
msgstr "zusätzliche Daten hinter dem Ende der Propertyliste"
#: ../../WINGs/proplist.c:1602
#: ../../WINGs/proplist.c:1606
#, c-format
msgid "could not get size for file '%s'"
msgstr "konnte Dateigröße von '%s' nicht ermitteln"
msgstr "Dateigröße von '%s' konnte nicht ermittelt werden"
#: ../../WINGs/proplist.c:1614
#: ../../WINGs/proplist.c:1619
#, c-format
msgid "error reading from file '%s'"
msgstr "Fehler beim Lesen der Datei '%s'"
#: ../../WINGs/proplist.c:1665
#: ../../WINGs/proplist.c:1671
#, c-format
msgid "mkstemp (%s) failed"
msgstr "mkstemp (%s) schlug fehl"
msgstr "mkstemp (%s) fehlgeschlagen"
#: ../../WINGs/proplist.c:1676
#: ../../WINGs/proplist.c:1682
#, c-format
msgid "mktemp (%s) failed"
msgstr "mktemp (%s) schlug fehl"
msgstr "mktemp (%s) fehlgeschlagen"
#: ../../WINGs/proplist.c:1687
#: ../../WINGs/proplist.c:1693
#, c-format
msgid "open (%s) failed"
msgstr "open (%s) schlug fehl"
msgstr "open (%s) fehlgeschlagen"
#: ../../WINGs/proplist.c:1694
#: ../../WINGs/proplist.c:1700
#, c-format
msgid "writing to file: %s failed"
msgstr "Schreiben in Datei: %s schlug fehl"
msgstr "Schreiben in Datei: %s fehlgeschlagen"
#: ../../WINGs/proplist.c:1702
#: ../../WINGs/proplist.c:1708
#, c-format
msgid "fclose (%s) failed"
msgstr "fclose (%s) schlug fehl"
msgstr "fclose (%s) fehlgeschlagen"
#: ../../WINGs/proplist.c:1711
#: ../../WINGs/proplist.c:1717
#, c-format
msgid "rename ('%s' to '%s') failed"
msgstr "rename ('%s' to '%s') schlug fehl"
msgstr "rename ('%s' nach '%s') fehlgeschlagen"
#. something happened with the file. just overwrite it
#: ../../WINGs/userdefaults.c:192 ../../WINGs/userdefaults.c:208
#: ../../WINGs/userdefaults.c:188 ../../WINGs/userdefaults.c:204
#, c-format
msgid "cannot read domain from file '%s' when syncing"
msgstr "Kann bei der Synchronisation nicht aus Datei '%s' lesen"
msgstr "Bei der Synchronisation konnte nicht aus der Datei '%s' gelesen werden"
#: ../../WINGs/wcolor.c:198 ../../WINGs/wcolor.c:211 ../../WINGs/wcolor.c:250
#: ../../WINGs/wcolor.c:291
#: ../../WINGs/wcolor.c:237 ../../WINGs/wcolor.c:249 ../../WINGs/wcolor.c:288
#: ../../WINGs/wcolor.c:329
#, c-format
msgid "could not allocate %s color"
msgstr "konnte die Farbe %s nicht erzeugen"
msgstr "Farbe %s konnte nicht erzeugt werden"
#: ../../WINGs/wcolor.c:198
#: ../../WINGs/wcolor.c:237
msgid "white"
msgstr "weiß"
msgstr "Weiß"
#: ../../WINGs/wcolor.c:211
#: ../../WINGs/wcolor.c:249
msgid "black"
msgstr "schwarz"
msgstr "Schwarz"
#: ../../WINGs/wcolor.c:250
#: ../../WINGs/wcolor.c:288
msgid "gray"
msgstr "grau"
msgstr "Grau"
#: ../../WINGs/wcolor.c:291
#: ../../WINGs/wcolor.c:329
msgid "dark gray"
msgstr "dunkelgrau"
msgstr "Dunkelgrau"
#: ../../WINGs/wcolorpanel.c:415
#: ../../WINGs/wcolorpanel.c:420
msgid "Colors"
msgstr "Farben"
#: ../../WINGs/wcolorpanel.c:605 ../../WINGs/wcolorpanel.c:2824
#: ../../WINGs/wcolorpanel.c:610 ../../WINGs/wcolorpanel.c:2829
msgid "Brightness"
msgstr "Helligkeit"
#: ../../WINGs/wcolorpanel.c:607 ../../WINGs/wcolorpanel.c:683
#: ../../WINGs/wcolorpanel.c:716 ../../WINGs/wcolorpanel.c:750
#: ../../WINGs/wcolorpanel.c:810 ../../WINGs/wcolorpanel.c:844
#: ../../WINGs/wcolorpanel.c:878 ../../WINGs/wcolorpanel.c:913
#: ../../WINGs/wcolorpanel.c:2164 ../../WINGs/wcolorpanel.c:2826
#: ../../WINGs/wcolorpanel.c:2862 ../../WINGs/wcolorpanel.c:2898
#: ../../WINGs/wcolorpanel.c:3746
#: ../../WINGs/wcolorpanel.c:612 ../../WINGs/wcolorpanel.c:688
#: ../../WINGs/wcolorpanel.c:721 ../../WINGs/wcolorpanel.c:755
#: ../../WINGs/wcolorpanel.c:815 ../../WINGs/wcolorpanel.c:849
#: ../../WINGs/wcolorpanel.c:883 ../../WINGs/wcolorpanel.c:918
#: ../../WINGs/wcolorpanel.c:2169 ../../WINGs/wcolorpanel.c:2831
#: ../../WINGs/wcolorpanel.c:2867 ../../WINGs/wcolorpanel.c:2903
#: ../../WINGs/wcolorpanel.c:3745
msgid "Color Panel: Could not allocate memory"
msgstr "Color Panel: Konnte keinen Speicher reservieren"
msgstr "Farb-Panel: Speicher konnte nicht reserviert werden"
#: ../../WINGs/wcolorpanel.c:680 ../../WINGs/wcolorpanel.c:681
#: ../../WINGs/wcolorpanel.c:685 ../../WINGs/wcolorpanel.c:686
msgid "Red"
msgstr "Rot"
#: ../../WINGs/wcolorpanel.c:713 ../../WINGs/wcolorpanel.c:714
#: ../../WINGs/wcolorpanel.c:718 ../../WINGs/wcolorpanel.c:719
msgid "Green"
msgstr "Grün"
#: ../../WINGs/wcolorpanel.c:747 ../../WINGs/wcolorpanel.c:748
#: ../../WINGs/wcolorpanel.c:752 ../../WINGs/wcolorpanel.c:753
msgid "Blue"
msgstr "Blau"
#: ../../WINGs/wcolorpanel.c:807 ../../WINGs/wcolorpanel.c:808
#: ../../WINGs/wcolorpanel.c:812 ../../WINGs/wcolorpanel.c:813
msgid "Cyan"
msgstr ""
#: ../../WINGs/wcolorpanel.c:841 ../../WINGs/wcolorpanel.c:842
#: ../../WINGs/wcolorpanel.c:846 ../../WINGs/wcolorpanel.c:847
msgid "Magenta"
msgstr ""
#: ../../WINGs/wcolorpanel.c:875 ../../WINGs/wcolorpanel.c:876
#: ../../WINGs/wcolorpanel.c:880 ../../WINGs/wcolorpanel.c:881
msgid "Yellow"
msgstr "Gelb"
#: ../../WINGs/wcolorpanel.c:910 ../../WINGs/wcolorpanel.c:911
#: ../../WINGs/wcolorpanel.c:915 ../../WINGs/wcolorpanel.c:916
msgid "Black"
msgstr "Schwarz"
#: ../../WINGs/wcolorpanel.c:991
#: ../../WINGs/wcolorpanel.c:996
msgid "Spectrum"
msgstr "Spektrum"
#: ../../WINGs/wcolorpanel.c:1021
#: ../../WINGs/wcolorpanel.c:1026
msgid "Palette"
msgstr ""
#: ../../WINGs/wcolorpanel.c:1027
#: ../../WINGs/wcolorpanel.c:1032
msgid "New from File..."
msgstr "Neu aus Datei..."
#: ../../WINGs/wcolorpanel.c:1028 ../../WINGs/wcolorpanel.c:1076
#: ../../WINGs/wcolorpanel.c:1093
#: ../../WINGs/wcolorpanel.c:1033 ../../WINGs/wcolorpanel.c:1081
#: ../../WINGs/wcolorpanel.c:1098
msgid "Rename..."
msgstr "Umbenennen..."
#: ../../WINGs/wcolorpanel.c:1029 ../../WINGs/wcolorpanel.c:1077
#: ../../WINGs/wcolorpanel.c:1094 ../../WINGs/wcolorpanel.c:3321
#: ../../WINGs/wcolorpanel.c:1034 ../../WINGs/wcolorpanel.c:1082
#: ../../WINGs/wcolorpanel.c:1099 ../../WINGs/wcolorpanel.c:3326
msgid "Remove"
msgstr "Entfernen"
#: ../../WINGs/wcolorpanel.c:1030
#: ../../WINGs/wcolorpanel.c:1035
msgid "Copy"
msgstr "Kopieren"
#: ../../WINGs/wcolorpanel.c:1031
#: ../../WINGs/wcolorpanel.c:1036
msgid "New from Clipboard"
msgstr "Neu aus Zwischenablage"
#: ../../WINGs/wcolorpanel.c:1052
#: ../../WINGs/wcolorpanel.c:1057
msgid "X11-Colors"
msgstr "X11-Farben"
#: ../../WINGs/wcolorpanel.c:1069
#: ../../WINGs/wcolorpanel.c:1074
msgid "Color"
msgstr "Farbe"
#: ../../WINGs/wcolorpanel.c:1075
#: ../../WINGs/wcolorpanel.c:1080
msgid "Add..."
msgstr "Hinzufügen..."
#: ../../WINGs/wcolorpanel.c:1085
#: ../../WINGs/wcolorpanel.c:1090
msgid "List"
msgstr "Liste"
#: ../../WINGs/wcolorpanel.c:1092
#: ../../WINGs/wcolorpanel.c:1097
msgid "New..."
msgstr "Neu..."
#: ../../WINGs/wcolorpanel.c:1231
#: ../../WINGs/wcolorpanel.c:1236
#, c-format
msgid ""
"Color Panel: Could not create directory %s needed to store configurations"
msgstr ""
"Color Panel: Konnte das Verzeichnis %s zum Speichern der Konfiguration nicht erzeugen"
msgid "Color Panel: Could not create directory %s needed to store configurations"
msgstr "Farb-Panel: Verzeichnis %s konnte zum Speichern der Konfiguration nicht erzeugt werden"
#. Delete the file, it doesn't belong here
#: ../../WINGs/wcolorpanel.c:1237 ../../WINGs/wcolorpanel.c:3207
#: ../../WINGs/wcolorpanel.c:3211
#: ../../WINGs/wcolorpanel.c:1242 ../../WINGs/wcolorpanel.c:3212
#: ../../WINGs/wcolorpanel.c:3216
msgid "File Error"
msgstr "Dateifehler"
#: ../../WINGs/wcolorpanel.c:1238
#: ../../WINGs/wcolorpanel.c:1243
msgid "Could not create ColorPanel configuration directory"
msgstr "Konnte Konfigurationsverzeichnis für Farbdialog nicht erzeugen"
msgstr "Konfigurationsverzeichnis für Farb-Panel konnte nicht erzeugt werden"
#: ../../WINGs/wcolorpanel.c:1239 ../../WINGs/wcolorpanel.c:3208
#: ../../WINGs/wcolorpanel.c:3213 ../../WINGs/wcolorpanel.c:3240
#: ../../WINGs/wfilepanel.c:250 ../../WINGs/wfilepanel.c:647
#: ../../WINGs/wfilepanel.c:659 ../../WINGs/wfilepanel.c:760
#: ../../WINGs/wfilepanel.c:971 ../../WINGs/wfontpanel.c:709
#: ../../WINGs/wcolorpanel.c:1244 ../../WINGs/wcolorpanel.c:3213
#: ../../WINGs/wcolorpanel.c:3218 ../../WINGs/wcolorpanel.c:3245
#: ../../WINGs/wfilepanel.c:250 ../../WINGs/wfilepanel.c:650
#: ../../WINGs/wfilepanel.c:662 ../../WINGs/wfilepanel.c:763
#: ../../WINGs/wfilepanel.c:974 ../../WINGs/wfontpanel.c:591
msgid "OK"
msgstr "OK"
msgstr ""
#: ../../WINGs/wcolorpanel.c:1245 ../../WINGs/wcolorpanel.c:1281
#: ../../WINGs/wcolorpanel.c:1299
#: ../../WINGs/wcolorpanel.c:1250 ../../WINGs/wcolorpanel.c:1286
#: ../../WINGs/wcolorpanel.c:1304
msgid "Color Panel: Could not find file"
msgstr "Color Panel: Konnte Datei nicht finden"
msgstr "Farb-Panel: Datei konnte nicht gefunden werden"
#: ../../WINGs/wcolorpanel.c:1486 ../../WINGs/wcolorpanel.c:1551
#: ../../WINGs/wcolorpanel.c:1615
#: ../../WINGs/wcolorpanel.c:1491 ../../WINGs/wcolorpanel.c:1556
#: ../../WINGs/wcolorpanel.c:1620
msgid "Color Panel: X failed request"
msgstr "Color Panel: X Anfrage schlug fehl"
msgstr "Farb-Panel: X-Anfrage fehlgeschlagen"
#: ../../WINGs/wcolorpanel.c:2860
#: ../../WINGs/wcolorpanel.c:2865
msgid "Saturation"
msgstr "Sättigung"
#: ../../WINGs/wcolorpanel.c:2896
#: ../../WINGs/wcolorpanel.c:2901
msgid "Hue"
msgstr "Farbton"
#: ../../WINGs/wcolorpanel.c:3146
#: ../../WINGs/wcolorpanel.c:3151
msgid "Open Palette"
msgstr "Palette öffnen"
#: ../../WINGs/wcolorpanel.c:3208
#: ../../WINGs/wcolorpanel.c:3213
msgid "Invalid file format !"
msgstr "Ungültiges Dateiformat!"
#: ../../WINGs/wcolorpanel.c:3210
#: ../../WINGs/wcolorpanel.c:3215
#, c-format
msgid "can't remove file %s"
msgstr "kann Datei %s nicht entfernen"
msgstr "Datei %s konnte nicht entfert werden"
#: ../../WINGs/wcolorpanel.c:3212
#: ../../WINGs/wcolorpanel.c:3217
msgid "Couldn't remove file from Configuration Directory !"
msgstr "Konnte Datei nicht aus Konfigurationsverzeichnis entfernen!"
msgstr "Datei konnte nicht aus Konfigurationsverzeichnis entfernt werden!"
#: ../../WINGs/wcolorpanel.c:3239
#: ../../WINGs/wcolorpanel.c:3244
msgid "Rename"
msgstr "Umbenennen"
#: ../../WINGs/wcolorpanel.c:3239
#: ../../WINGs/wcolorpanel.c:3244
msgid "Rename palette to:"
msgstr "Palette umbenennen in:"
#: ../../WINGs/wcolorpanel.c:3240 ../../WINGs/wfilepanel.c:259
#: ../../WINGs/wfilepanel.c:659 ../../WINGs/wfilepanel.c:760
#: ../../WINGs/wcolorpanel.c:3245 ../../WINGs/wfilepanel.c:259
#: ../../WINGs/wfilepanel.c:662 ../../WINGs/wfilepanel.c:763
msgid "Cancel"
msgstr "Abbrechen"
#. Careful, this palette exists already
#: ../../WINGs/wcolorpanel.c:3256 ../../WINGs/wfilepanel.c:760
#: ../../WINGs/wcolorpanel.c:3261 ../../WINGs/wfilepanel.c:763
msgid "Warning"
msgstr "Warnung"
#: ../../WINGs/wcolorpanel.c:3257
#: ../../WINGs/wcolorpanel.c:3262
msgid ""
"Palette already exists !\n"
"\n"
@@ -393,24 +401,24 @@ msgstr ""
"\n"
"Überschreiben?"
#: ../../WINGs/wcolorpanel.c:3257 ../../WINGs/wcolorpanel.c:3321
#: ../../WINGs/wcolorpanel.c:3262 ../../WINGs/wcolorpanel.c:3326
msgid "No"
msgstr "Nein"
#: ../../WINGs/wcolorpanel.c:3257 ../../WINGs/wcolorpanel.c:3321
#: ../../WINGs/wcolorpanel.c:3262 ../../WINGs/wcolorpanel.c:3326
msgid "Yes"
msgstr "Ja"
#: ../../WINGs/wcolorpanel.c:3289
#: ../../WINGs/wcolorpanel.c:3294
#, c-format
msgid "Couldn't rename palette %s to %s\n"
msgstr "Konnte Palette %s nicht in %s umbenennen\n"
msgstr "Palette %s konnte nicht nach %s umbenannt werden\n"
#: ../../WINGs/wcolorpanel.c:3315
#: ../../WINGs/wcolorpanel.c:3320
msgid "This will permanently remove the palette "
msgstr "Das wird die Palette unwiderruflich löschen "
msgstr "Hiermit wird die Palette unwiderruflich gelöscht "
#: ../../WINGs/wcolorpanel.c:3318
#: ../../WINGs/wcolorpanel.c:3323
msgid ""
".\n"
"\n"
@@ -420,29 +428,29 @@ msgstr ""
"\n"
"Sind Sie sicher, dass Sie die Palette löschen wollen?"
#: ../../WINGs/wcolorpanel.c:3343
#: ../../WINGs/wcolorpanel.c:3348
#, c-format
msgid "Couldn't remove palette %s\n"
msgstr "Konnte Palette %s nicht löschen\n"
msgstr "Palette %s konnte nicht gelöscht werden\n"
#: ../../WINGs/wcolorpanel.c:3648
#: ../../WINGs/wcolorpanel.c:3647
#, c-format
msgid "Could not open %s"
msgstr "Konnte %s nicht öffnen"
msgstr "%s konnte nicht geöffnet werden"
#: ../../WINGs/wcolorpanel.c:3655
#: ../../WINGs/wcolorpanel.c:3654
#, c-format
msgid "Could not create %s"
msgstr "Konnte %s nicht erzeugen"
msgstr "%s konnte nicht erzeugt werden"
#: ../../WINGs/wcolorpanel.c:3666
#: ../../WINGs/wcolorpanel.c:3665
#, c-format
msgid "Write error on file %s"
msgstr "Schreibfehler bei Datei %s"
#: ../../WINGs/wcolorpanel.c:3711
#: ../../WINGs/wcolorpanel.c:3710
msgid "Color Panel: Color unspecified"
msgstr "Color Panel: Farbe nicht spezifiziert"
msgstr "Farb-Panel: Farbe nicht spezifiziert"
#: ../../WINGs/wfilepanel.c:235
msgid "Name:"
@@ -456,208 +464,164 @@ msgstr "Öffnen"
msgid "Save"
msgstr "Speichern"
#: ../../WINGs/wfilepanel.c:562
#: ../../WINGs/wfilepanel.c:565
#, c-format
msgid "WINGs: could not open directory %s\n"
msgstr "WINGs: Konnte Verzeichnis %s nicht öffen\n"
msgstr "WINGs: Verzeichnis %s konnte nicht geöffnet werden\n"
#: ../../WINGs/wfilepanel.c:580
#: ../../WINGs/wfilepanel.c:583
#, c-format
msgid "WINGs: could not stat %s\n"
msgstr "WINGs: Dateistatus von %s nicht bestimmbar\n"
msgstr "WINGs: Dateistatus von %s unbestimmbar\n"
#: ../../WINGs/wfilepanel.c:647 ../../WINGs/wfilepanel.c:970
#: ../../WINGs/wfontpanel.c:708
#: ../../WINGs/wfilepanel.c:650 ../../WINGs/wfilepanel.c:973
#: ../../WINGs/wfontpanel.c:590
msgid "Error"
msgstr "Fehler"
#: ../../WINGs/wfilepanel.c:658
#: ../../WINGs/wfilepanel.c:661
msgid "Create Directory"
msgstr "Verzeichnis anlegen"
#: ../../WINGs/wfilepanel.c:659
#: ../../WINGs/wfilepanel.c:662
msgid "Enter directory name"
msgstr "Verzeichnisname eingeben"
#: ../../WINGs/wfilepanel.c:695 ../../WINGs/wfilepanel.c:734
#: ../../WINGs/wfilepanel.c:765 ../../WINGs/wfilepanel.c:793
#: ../../WINGs/wfilepanel.c:698 ../../WINGs/wfilepanel.c:737
#: ../../WINGs/wfilepanel.c:768 ../../WINGs/wfilepanel.c:796
msgid "Permission denied."
msgstr "Zugriff verweigert."
#: ../../WINGs/wfilepanel.c:698
#: ../../WINGs/wfilepanel.c:701
#, c-format
msgid "'%s' already exists."
msgstr "'%s' existiert bereits."
#: ../../WINGs/wfilepanel.c:701
#: ../../WINGs/wfilepanel.c:704
msgid "Path does not exist."
msgstr "Pfad existiert nicht."
#: ../../WINGs/wfilepanel.c:731 ../../WINGs/wfilepanel.c:790
#: ../../WINGs/wfilepanel.c:734 ../../WINGs/wfilepanel.c:793
#, c-format
msgid "'%s' does not exist."
msgstr "'%s' existiert nicht."
#: ../../WINGs/wfilepanel.c:738 ../../WINGs/wfilepanel.c:797
#: ../../WINGs/wfilepanel.c:741 ../../WINGs/wfilepanel.c:800
msgid "Insufficient memory available."
msgstr "Nicht genügend Speicher verfügbar."
#: ../../WINGs/wfilepanel.c:742 ../../WINGs/wfilepanel.c:801
#: ../../WINGs/wfilepanel.c:745 ../../WINGs/wfilepanel.c:804
#, c-format
msgid "'%s' is on a read-only filesystem."
msgstr "'%s' liegt auf einem read-only Dateisystem."
msgstr "'%s' liegt auf einem nur lesbaren Dateisystem."
#: ../../WINGs/wfilepanel.c:745 ../../WINGs/wfilepanel.c:777
#: ../../WINGs/wfilepanel.c:804
#: ../../WINGs/wfilepanel.c:748 ../../WINGs/wfilepanel.c:780
#: ../../WINGs/wfilepanel.c:807
#, c-format
msgid "Can not delete '%s'."
msgstr "Kann %s nicht löschen."
#: ../../WINGs/wfilepanel.c:752
#: ../../WINGs/wfilepanel.c:755
#, c-format
msgid "Delete directory %s ?"
msgstr "Verzeichnis % s löschen?"
msgstr "Verzeichnis %s löschen?"
#: ../../WINGs/wfilepanel.c:756
#: ../../WINGs/wfilepanel.c:759
#, c-format
msgid "Delete file %s ?"
msgstr "Datei %s löschen?"
#: ../../WINGs/wfilepanel.c:768
#: ../../WINGs/wfilepanel.c:771
#, c-format
msgid "Directory '%s' does not exist."
msgstr "Verzeichnis '%s' existiert nicht."
#: ../../WINGs/wfilepanel.c:771
#: ../../WINGs/wfilepanel.c:774
#, c-format
msgid "Directory '%s' is not empty."
msgstr "Verzeichnis '%s' ist nicht leer."
#: ../../WINGs/wfilepanel.c:774
#: ../../WINGs/wfilepanel.c:777
#, c-format
msgid "Directory '%s' is busy."
msgstr "Verzeichnis '%s' ist belegt."
msgstr "Verzeichnis '%s' wird benutz."
#: ../../WINGs/wfilepanel.c:787
#: ../../WINGs/wfilepanel.c:790
#, c-format
msgid "'%s' is a directory."
msgstr "'%s' ist ein Verzeichnis."
#: ../../WINGs/wfilepanel.c:829
#: ../../WINGs/wfilepanel.c:832
#, c-format
msgid "An error occured browsing '%s'."
msgstr "Fehler beim Lesen von '%s'."
#: ../../WINGs/wfilepanel.c:833
#: ../../WINGs/wfilepanel.c:836
#, c-format
msgid "'%s' is not a directory."
msgstr "'%s' ist kein Verzeichnis."
#: ../../WINGs/wfilepanel.c:970
#: ../../WINGs/wfilepanel.c:973
msgid "File does not exist."
msgstr "Datei existiert nicht."
#: ../../WINGs/wfont.c:129
#: ../../WINGs/wfont.c:40
#, c-format
msgid "the following character sets are missing in %s:"
msgstr "die folgenden Zeichensätze fehlen in %s:"
msgid "invalid font: %s. Trying '%s'"
msgstr "Ungültige Schriftart: %s. Wird ersetzt durch %s."
#: ../../WINGs/wfont.c:136
#: ../../WINGs/wfont.c:257 ../../WINGs/wfont.c:277
#, c-format
msgid ""
"the string \"%s\" will be used in place of any characters from those sets."
msgid "could not load font: %s."
msgstr "Schriftart konnte nicht geladen werden: %s"
#. WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr));
#: ../../WINGs/wfontpanel.c:203
msgid "Font Panel"
msgstr "Schrift-Panel"
#: ../../WINGs/wfontpanel.c:239
msgid "The quick brown fox jumps over the lazy dog"
msgstr ""
"die Zeichenkette \"%s\" ersetzt alle anderen Zeichen dieser Zeichensätze."
#: ../../WINGs/wfont.c:287 ../../WINGs/wfont.c:323
#, c-format
msgid "could not load font set %s. Trying fixed."
msgstr "konnte Fonts %s nicht laden. Nehme fixed-Font."
#: ../../WINGs/wfont.c:293 ../../WINGs/wfont.c:329
#, c-format
msgid "could not load font %s. Trying fixed."
msgstr "Konnte Font %s nicht laden. Nehme fixed-Font."
#: ../../WINGs/wfont.c:297 ../../WINGs/wfont.c:333
msgid "could not load fixed font!"
msgstr "konnte fixed-Font nicht laden!"
#: ../../WINGs/wfont.c:428
#, c-format
msgid "font description %s is too large."
msgstr "Fontbeschreibung %s ist zu groß."
#: ../../WINGs/wfontpanel.c:205
msgid "Test!!!"
msgstr "Test!"
#: ../../WINGs/wfontpanel.c:211
#: ../../WINGs/wfontpanel.c:245
msgid "Family"
msgstr "Familie"
#: ../../WINGs/wfontpanel.c:222
#: ../../WINGs/wfontpanel.c:256
msgid "Typeface"
msgstr "Schriftart"
#: ../../WINGs/wfontpanel.c:233
#: ../../WINGs/wfontpanel.c:267
msgid "Size"
msgstr "Größe"
#: ../../WINGs/wfontpanel.c:252
#: ../../WINGs/wfontpanel.c:286
msgid "Set"
msgstr "Setzen"
#: ../../WINGs/wfontpanel.c:257
#: ../../WINGs/wfontpanel.c:292
msgid "Revert"
msgstr "Zurückn."
msgstr "Zurücksetzen"
#: ../../WINGs/wfontpanel.c:709
msgid "Could not retrieve font list"
msgstr "Konnte Fontliste nicht wiederherstellen"
#: ../../WINGs/wfontpanel.c:591
msgid "Could not init font config library\n"
msgstr "\"font-config\"-Bibliothek konnte nicht initialisiert werden\n"
#: ../../WINGs/wfontpanel.c:721
#, c-format
msgid "font name %s is longer than 256, which is invalid."
msgstr "Fontname %s ist ungültig, da länger als 256 Zeichen."
#: ../../WINGs/wfontpanel.c:868
msgid "Roman"
msgstr "Roman"
#: ../../WINGs/wfontpanel.c:871
msgid "Italic"
msgstr "Kursiv"
#: ../../WINGs/wfontpanel.c:873
msgid "Oblique"
msgstr "Schräg"
#: ../../WINGs/wfontpanel.c:875
msgid "Rev Italic"
msgstr ""
#: ../../WINGs/wfontpanel.c:877
msgid "Rev Oblique"
msgstr ""
#: ../../WINGs/wfontpanel.c:883
msgid "Normal"
msgstr "Normal"
#: ../../WINGs/widgets.c:415
#: ../../WINGs/widgets.c:419
#, c-format
msgid "WINGs: could not load widget images file: %s"
msgstr "WINGs: Konnte Widget-Bildatei %s nicht laden."
msgstr "WINGs: Widget-Bilderdatei konnte nicht geladen werden: %s"
#: ../../WINGs/widgets.c:763
#: ../../WINGs/widgets.c:767
msgid ""
"could not load any fonts. Make sure your font installationand locale "
"could not load any fonts. Make sure your font installation and locale "
"settings are correct."
msgstr ""
"Konnte keine Fonts laden. Überprüfen Sie, ob Ihre Fontinstallation und "
"-einstellungen korrekt sind."
"Keine Schrifen konnten geladen werden. Überprüfen Sie, ob Ihre Schrifteninstallation und -"
"Lokalisierungseinstellungen korrekt sind."
#: ../../WINGs/wruler.c:189
#: ../../WINGs/wruler.c:192
msgid "0 inches"
msgstr "0 Inch"

File diff suppressed because it is too large Load Diff

View File

@@ -1,241 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <WINGs.h>
#define MAX_SIZE 10*10
WMWindow *win;
WMButton *Button[MAX_SIZE];
char Map[MAX_SIZE];
int Size = 4;
int MoveCount;
#define MAP(x,y) Map[(x)+(y)*Size]
int WinSize = 120;
Bool CheckWin(void)
{
int i;
for (i = 0; i < Size*Size-1; i++) {
if (Map[i] != i)
return False;
}
return True;
}
void MoveButton(int button, int x, int y)
{
WMMoveWidget(Button[button], x*(WinSize/Size), y*(WinSize/Size));
}
Bool SlideButton(int button)
{
int x, y, done = 0;
/* locate the button */
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x,y) == button) {
done = 1;
break;
}
}
if (done)
break;
}
if (x > 0 && MAP(x-1, y) < 0) {
MAP(x,y) = -1;
MoveButton(button, x-1, y);
MAP(x-1,y) = button;
} else if (x < Size-1 && MAP(x+1, y) < 0) {
MAP(x,y) = -1;
MoveButton(button, x+1, y);
MAP(x+1,y) = button;
} else if (y > 0 && MAP(x, y-1) < 0) {
MAP(x,y) = -1;
MoveButton(button, x, y-1);
MAP(x,y-1) = button;
} else if (y < Size-1 && MAP(x, y+1) < 0) {
MAP(x,y) = -1;
MoveButton(button, x, y+1);
MAP(x,y+1) = button;
} else {
return False;
}
return True;
}
#define SWAP(a,b) {int tmp; tmp=a; a=b; b=tmp;}
void ResetGame(void)
{
int i, x, y, ox, oy;
MoveCount = 0;
for (i = 0; i < Size*Size-1; i++) {
Map[i] = i;
}
Map[i] = -1;
ox = x = Size-1;
oy = y = Size-1;
for (i = 0; i < 5; i++) {
int ok;
ok = 1;
switch (rand()%4) {
case 0:
if (x > 0) x--; else ok = 0;
break;
case 2:
if (x < Size-1) x++; else ok = 0;
break;
case 1:
if (y > 0) y--; else ok = 0;
break;
case 3:
if (y < Size-1) y++; else ok = 0;
break;
}
if (ok) {
MoveButton(MAP(x,y), ox, oy);
SWAP(MAP(ox, oy), MAP(x, y));
while (XPending(WMScreenDisplay(WMWidgetScreen(win)))) {
XEvent ev;
WMNextEvent(WMScreenDisplay(WMWidgetScreen(win)), &ev);
WMHandleEvent(&ev);
}
ox = x;
oy = y;
}
}
}
void buttonClick(WMWidget *w, void *ptr)
{
char buffer[300];
if (SlideButton((int)ptr)) {
MoveCount++;
if (CheckWin()) {
sprintf(buffer, "You finished the game in %i moves.", MoveCount);
if (WMRunAlertPanel(WMWidgetScreen(w), win, "You Won!", buffer,
"Wee!", "Gah! Lemme retry!", NULL) == WAPRDefault) {
exit(0);
}
ResetGame();
}
}
}
static void resizeObserver(void *self, WMNotification *notif)
{
WMSize size = WMGetViewSize(WMWidgetView(win));
int x, y;
WinSize = size.width;
for (y = 0; y < Size; y++) {
for (x = 0; x < Size; x++) {
if (MAP(x,y) >= 0) {
WMResizeWidget(Button[(int)MAP(x,y)],
WinSize/Size, WinSize/Size);
WMMoveWidget(Button[(int)MAP(x,y)],
x*(WinSize/Size), y*(WinSize/Size));
}
}
}
}
int main(int argc, char **argv)
{
Display *dpy;
WMScreen *scr;
int x, y, i;
WMInitializeApplication("Puzzle", &argc, argv);
dpy = XOpenDisplay("");
if (!dpy) {
printf("could not open display\n");
exit(1);
}
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
win = WMCreateWindow(scr, "puzzle");
WMResizeWidget(win, WinSize, WinSize);
WMSetWindowTitle(win, "zuPzel");
WMSetWindowMinSize(win, 80, 80);
WMSetWindowAspectRatio(win, 2, 2, 2, 2);
WMSetWindowResizeIncrements(win, Size, Size);
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
WMAddNotificationObserver(resizeObserver, NULL,
WMViewSizeDidChangeNotification,
WMWidgetView(win));
for (i = y = 0; y < Size && i < Size*Size-1; y++) {
for (x = 0; x < Size && i < Size*Size-1; x++) {
char buf[32];
WMColor *color;
RColor col;
RHSVColor hsv;
hsv.hue = i*360/(Size*Size-1);
hsv.saturation = 120;
hsv.value = 200;
RHSVtoRGB(&hsv, &col);
color = WMCreateRGBColor(scr, col.red<<8, col.green<<8,
col.blue<<8, False);
MAP(x,y) = i;
Button[i] = WMCreateButton(win, WBTMomentaryLight);
WMSetWidgetBackgroundColor(Button[i], color);
WMReleaseColor(color);
WMSetButtonAction(Button[i], buttonClick, (void*)i);
WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
sprintf(buf, "%i", i+1);
WMSetButtonText(Button[i], buf);
WMSetButtonTextAlignment(Button[i], WACenter);
i++;
}
}
WMMapSubwidgets(win);
WMMapWidget(win);
WMRealizeWidget(win);
ResetGame();
WMScreenMainLoop(scr);
return 0;
}

View File

@@ -1,5 +0,0 @@
build
WINGs.c
wings.so
*.pyc
*.pyo

View File

@@ -1,17 +0,0 @@
all: WINGs.c
python setup.py build
ln -sf `find build/ -name wings.so` .
install: WINGs.c
python setup.py install
clean:
rm -rf build dist WINGs.c *.o *~ *.so MANIFEST wings.py *.pyc *.pyo core
dist:
python setup.py sdist
WINGs.c: WINGs.i
swig -python -noproxy `get-wings-flags --cflags` -I.. -o WINGs.c WINGs.i

View File

@@ -1,20 +0,0 @@
This is a python wrapper for the WINGs library, that can be used to write python
based programs with WINGs-based graphic interfaces.
This module in not built by default. To build it you need python2.1 or later
and swig-1.3.14 or later.
To build it, first compile and install WINGs. after that run 'make' in this
directory. 'make install' will install the python module into the python tree.
run test.py or WINGs.py for an example.
the code is not finished yet and may fail to work as expected in some cases.
Note: currently the module expects WINGs installed to build. it won't take
the WINGs libraries and header files from the source tree. You need to
install WINGs first. Even if an old version of WINGs is already installed,
you still need to install the newly built WINGs, else the python module will
be built against the old version.

View File

@@ -1,699 +0,0 @@
%module wings
%{
#include "WINGs/WINGsP.h"
%}
%include typemaps.i
// This tells SWIG to treat char ** as a special case
%typemap(python, in) char ** {
/* Check if is a list */
if (PyList_Check($input)) {
int size = PyList_Size($input);
int i = 0;
$1 = (char **) wmalloc((size+1)*sizeof(char *));
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem($input, i);
if (PyString_Check(o))
$1[i] = PyString_AsString(PyList_GetItem($input, i));
else {
PyErr_SetString(PyExc_TypeError, "list must contain strings");
wfree($1);
return NULL;
}
}
$1[i] = 0;
} else {
PyErr_SetString(PyExc_TypeError, "not a list");
return NULL;
}
}
// This cleans up the char ** array we malloc-ed before the function call
%typemap(python, freearg) char ** {
wfree($1);
}
// This allows a C function to return a char ** as a Python list
%typemap(python, out) char ** {
int len,i;
len = 0;
while ($1[len]) len++;
$result = PyList_New(len);
for (i = 0; i < len; i++) {
PyList_SetItem($result, i, PyString_FromString($1[i]));
}
}
// Now for some callbacks
%typemap(python, in) PyObject *pyacArgs {
if (PyTuple_Check($input)) {
if (PyTuple_Size($input) != 3) {
PyErr_SetString(PyExc_ValueError,
"wrong number of parameters in tuple. should be 3.");
return NULL;
} else {
PyObject *func = PyTuple_GetItem($input, 1);
if (func!=Py_None && !PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError,
"'action' needs to be a callable object!");
return NULL;
}
}
} else {
PyErr_SetString(PyExc_TypeError, "2nd argument not a tuple!");
return NULL;
}
$1 = $input;
}
%typemap(python, in) PyObject *pycArgs {
if (PyTuple_Check($input)) {
if (PyTuple_Size($input) != 2) {
PyErr_SetString(PyExc_ValueError,
"wrong number of parameters in tuple. should be 2.");
return NULL;
} else {
PyObject *func = PyTuple_GetItem($input, 0);
if (func!=Py_None && !PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError,
"'action' needs to be a callable object!");
return NULL;
}
}
} else {
PyErr_SetString(PyExc_TypeError, "2nd argument not a tuple!");
return NULL;
}
$1 = $input;
}
// Type mapping for grabbing a FILE * from Python
%typemap(python, in) FILE * {
if (!PyFile_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Need a file!");
return NULL;
}
$1 = PyFile_AsFile($input);
}
/* These are for free-ing the return of functions that need to be freed
* before returning control to python. */
%typemap(python, ret) char* WMGetTextFieldText { wfree($1); };
%include exception.i
%exception pyWMScreenMainLoop {
$function
if (PyErr_Occurred())
return NULL;
}
%exception pyWMRunModalLoop {
$function
if (PyErr_Occurred())
return NULL;
}
%{
static int mainLoopDone = 0;
%}
%inline %{
WMScreen *pyWMOpenScreen(const char *display, int simpleapp)
{
Display *dpy = XOpenDisplay(display);
if (!dpy) {
wwarning("WINGs: could not open display %s", XDisplayName(display));
return NULL;
}
if (simpleapp) {
return WMCreateSimpleApplicationScreen(dpy);
} else {
return WMCreateScreen(dpy, DefaultScreen(dpy));
}
}
void pyWMScreenMainLoop(WMScreen *scr)
{
XEvent event;
while (!PyErr_Occurred() && !mainLoopDone) {
WMNextEvent(((W_Screen*)scr)->display, &event);
WMHandleEvent(&event);
}
}
void pyWMBreakScreenMainLoop(WMScreen *scr)
{
mainLoopDone = 1;
}
void pyWMRunModalLoop(WMScreen *scr, WMView *view)
{
int oldModalLoop = scr->modalLoop;
WMView *oldModalView = scr->modalView;
scr->modalView = view;
scr->modalLoop = 1;
while (!PyErr_Occurred() && scr->modalLoop) {
XEvent event;
WMNextEvent(scr->display, &event);
WMHandleEvent(&event);
}
scr->modalView = oldModalView;
scr->modalLoop = oldModalLoop;
}
%}
//%rename WMScreenMainLoop _WMScreenMainLoop;
//%rename(_WMScreenMainLoop) WMScreenMainLoop;
//%rename WMRunModalLoop _WMRunModalLoop;
%{
/* These functions match the prototypes of the normal C callback
* functions. However, we use the clientdata pointer for holding a
* reference to a Python tuple containing (object, funct, clientData).
*/
static void PythonWMActionCallback(WMWidget *widget, void *cdata)
{
PyObject *pyobj, *func, *pydata, *arglist, *tuple, *result;
tuple = (PyObject*) cdata;
pyobj = PyTuple_GetItem(tuple, 0);
func = PyTuple_GetItem(tuple, 1);
if (func && func!=Py_None) {
pydata = PyTuple_GetItem(tuple, 2);
arglist = Py_BuildValue("(OO)", pyobj, pydata);
result = PyEval_CallObject(func, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
}
}
static void PythonWMCallback(void *data)
{
PyObject *func, *pydata, *arglist, *tuple, *result;
tuple = (PyObject*) data;
func = PyTuple_GetItem(tuple, 0);
if (func && func!=Py_None) {
pydata = PyTuple_GetItem(tuple, 1);
arglist = Py_BuildValue("(O)", pydata);
result = PyEval_CallObject(func, arglist);
Py_DECREF(arglist);
Py_XDECREF(result);
}
}
static void
pyTextFieldDidBeginEditing(WMTextFieldDelegate *self, WMNotification *notif)
{
PyObject *pyobj, *delegate, *func, *pydata, *arglist, *tuple, *result;
int action;
tuple = (PyObject*) self->data;
pyobj = PyTuple_GetItem(tuple, 0);
delegate = PyTuple_GetItem(tuple, 1);
if (delegate != Py_None) {
// should we call PyObject_HasAttrString()?? rather not and let
// python raise an exception because the object doesn't has the
// attribute
func = PyObject_GetAttrString(delegate, "didBeginEditing");
if (func!=NULL && func!=Py_None) {
pydata = PyObject_GetAttrString(delegate, "data");
if (!pydata) {
Py_INCREF(Py_None);
pydata = Py_None;
}
action = (int)WMGetNotificationClientData(notif);
arglist = Py_BuildValue("(OOi)", pyobj, pydata, action);
result = PyEval_CallObject(func, arglist);
Py_DECREF(pydata);
Py_DECREF(arglist);
Py_XDECREF(result);
}
Py_XDECREF(func);
}
}
static void
pyTextFieldDidChange(WMTextFieldDelegate *self, WMNotification *notif)
{
PyObject *pyobj, *delegate, *func, *pydata, *arglist, *tuple, *result;
int action;
tuple = (PyObject*) self->data;
pyobj = PyTuple_GetItem(tuple, 0);
delegate = PyTuple_GetItem(tuple, 1);
if (delegate != Py_None) {
func = PyObject_GetAttrString(delegate, "didChange");
if (func!=NULL && func!=Py_None) {
pydata = PyObject_GetAttrString(delegate, "data");
if (!pydata) {
Py_INCREF(Py_None);
pydata = Py_None;
}
action = (int)WMGetNotificationClientData(notif);
arglist = Py_BuildValue("(OOi)", pyobj, pydata, action);
result = PyEval_CallObject(func, arglist);
Py_DECREF(pydata);
Py_DECREF(arglist);
Py_XDECREF(result);
}
Py_XDECREF(func);
}
}
static void
pyTextFieldDidEndEditing(WMTextFieldDelegate *self, WMNotification *notif)
{
PyObject *pyobj, *delegate, *func, *pydata, *arglist, *tuple, *result;
int action;
tuple = (PyObject*) self->data;
pyobj = PyTuple_GetItem(tuple, 0);
delegate = PyTuple_GetItem(tuple, 1);
if (delegate != Py_None) {
func = PyObject_GetAttrString(delegate, "didEndEditing");
if (func!=NULL && func!=Py_None) {
pydata = PyObject_GetAttrString(delegate, "data");
if (!pydata) {
Py_INCREF(Py_None);
pydata = Py_None;
}
action = (int)WMGetNotificationClientData(notif);
arglist = Py_BuildValue("(OOi)", pyobj, pydata, action);
result = PyEval_CallObject(func, arglist);
Py_DECREF(pydata);
Py_DECREF(arglist);
Py_XDECREF(result);
}
Py_XDECREF(func);
}
}
static Bool
pyTextFieldShouldBeginEditing(WMTextFieldDelegate *self, WMTextField *tPtr)
{
PyObject *pyobj, *delegate, *func, *pydata, *arglist, *tuple, *result;
Bool retval = False;
tuple = (PyObject*) self->data;
pyobj = PyTuple_GetItem(tuple, 0);
delegate = PyTuple_GetItem(tuple, 1);
if (delegate != Py_None) {
func = PyObject_GetAttrString(delegate, "shouldBeginEditing");
if (func!=NULL && func!=Py_None) {
pydata = PyObject_GetAttrString(delegate, "data");
if (!pydata) {
Py_INCREF(Py_None);
pydata = Py_None;
}
arglist = Py_BuildValue("(OO)", pyobj, pydata);
result = PyEval_CallObject(func, arglist);
if (result!=Py_None && PyInt_AsLong(result)!=0) {
retval = True;
}
Py_DECREF(pydata);
Py_DECREF(arglist);
Py_XDECREF(result);
}
Py_XDECREF(func);
}
return retval;
}
static Bool
pyTextFieldShouldEndEditing(WMTextFieldDelegate *self, WMTextField *tPtr)
{
PyObject *pyobj, *delegate, *func, *pydata, *arglist, *tuple, *result;
Bool retval = False;
tuple = (PyObject*) self->data;
pyobj = PyTuple_GetItem(tuple, 0);
delegate = PyTuple_GetItem(tuple, 1);
if (delegate != Py_None) {
func = PyObject_GetAttrString(delegate, "shouldEndEditing");
if (func!=NULL && func!=Py_None) {
pydata = PyObject_GetAttrString(delegate, "data");
if (!pydata) {
Py_INCREF(Py_None);
pydata = Py_None;
}
arglist = Py_BuildValue("(OO)", pyobj, pydata);
result = PyEval_CallObject(func, arglist);
if (result!=Py_None && PyInt_AsLong(result)!=0) {
retval = True;
}
Py_DECREF(pydata);
Py_DECREF(arglist);
Py_XDECREF(result);
}
Py_XDECREF(func);
}
return retval;
}
%}
%inline %{
void pyWMSetWindowCloseAction(WMWindow *win, PyObject *pyacArgs) {
WMSetWindowCloseAction(win, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetButtonAction(WMButton *bPtr, PyObject *pyacArgs) {
WMSetButtonAction(bPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetScrollerAction(WMScroller *sPtr, PyObject *pyacArgs) {
WMSetScrollerAction(sPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetListAction(WMList *lPtr, PyObject *pyacArgs) {
WMSetListAction(lPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetListDoubleAction(WMList *lPtr, PyObject *pyacArgs) {
WMSetListDoubleAction(lPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetBrowserAction(WMBrowser *bPtr, PyObject *pyacArgs) {
WMSetBrowserAction(bPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetBrowserDoubleAction(WMBrowser *bPtr, PyObject *pyacArgs) {
WMSetBrowserDoubleAction(bPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetMenuItemAction(WMMenuItem *miPtr, PyObject *pyacArgs) {
WMSetMenuItemAction(miPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetPopUpButtonAction(WMPopUpButton *pPtr, PyObject *pyacArgs) {
WMSetPopUpButtonAction(pPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetSliderAction(WMSlider *sPtr, PyObject *pyacArgs) {
WMSetSliderAction(sPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetRulerMoveAction(WMRuler *rPtr, PyObject *pyacArgs) {
WMSetRulerMoveAction(rPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetRulerReleaseAction(WMRuler *rPtr, PyObject *pyacArgs) {
WMSetRulerReleaseAction(rPtr, PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void pyWMSetColorPanelAction(WMColorPanel *panel, PyObject *pyacArgs) {
WMSetColorPanelAction(panel, (WMAction2*)PythonWMActionCallback, (void*)pyacArgs);
Py_INCREF(pyacArgs);
}
void* pyWMAddTimerHandler(int miliseconds, PyObject *pycArgs) {
Py_INCREF(pycArgs);
return (void*)WMAddTimerHandler(miliseconds, PythonWMCallback,
(void*)pycArgs);
}
void* pyWMAddPersistentTimerHandler(int miliseconds, PyObject *pycArgs) {
Py_INCREF(pycArgs);
return (void*)WMAddPersistentTimerHandler(miliseconds, PythonWMCallback,
(void*)pycArgs);
}
/* this doesn't work. we pass (func, data) as cdata at creation time, but
* only data at destruction, so it won't find it unless we change
* WMDeleteTimerWithClientData() to extract data from the tuple, and this
* requires access to the internals of WINGs
void pyWMDeleteTimerWithClientData(PyObject *pycData) {
WMDeleteTimerWithClientData((void*)pycData);
}*/
void pyWMDeleteTimerHandler(void *handlerID) {
WMDeleteTimerHandler((WMHandlerID)handlerID);
}
void* pyWMAddIdleHandler(PyObject *pycArgs) {
Py_INCREF(pycArgs);
return (void*)WMAddIdleHandler(PythonWMCallback, (void*)pycArgs);
}
void pyWMDeleteIdleHandler(void *handlerID) {
WMDeleteIdleHandler((WMHandlerID)handlerID);
}
%}
%exception pyWMSetTextFieldDelegate {
$function
if (PyErr_Occurred()) {
return NULL;
}
}
%inline %{
void pyWMSetTextFieldDelegate(WMTextField *tPtr, PyObject *txtArgs) {
WMTextFieldDelegate *td;
if (!txtArgs || !PyTuple_Check(txtArgs) || PyTuple_Size(txtArgs)!=2) {
PyErr_SetString(PyExc_TypeError, "invalid setting of WMTextField "
"delegate. Should be '(self, delegate)'");
return;
}
// how do I check if txtArgs[1] is an instance of WMTextFieldDelegate?
td = WMGetTextFieldDelegate(tPtr);
if (!td) {
td = (WMTextFieldDelegate*)wmalloc(sizeof(WMTextFieldDelegate));
td->didBeginEditing = pyTextFieldDidBeginEditing;
td->didChange = pyTextFieldDidChange;
td->didEndEditing = pyTextFieldDidEndEditing;
td->shouldBeginEditing = pyTextFieldShouldBeginEditing;
td->shouldEndEditing = pyTextFieldShouldEndEditing;
} else {
Py_XDECREF((PyObject*)td->data);
}
Py_INCREF(txtArgs);
td->data = txtArgs;
WMSetTextFieldDelegate(tPtr, td);
}
%}
%inline %{
PyObject* pyWMGetTextFieldDelegate(WMTextField *tPtr) {
WMTextFieldDelegate *td;
PyObject *result, *tuple;
td = WMGetTextFieldDelegate(tPtr);
if (!td) {
Py_INCREF(Py_None);
return Py_None;
}
tuple = (PyObject*)td->data;
if (!tuple || !PyTuple_Check(tuple) || PyTuple_Size(tuple)!=2) {
PyErr_SetString(PyExc_TypeError, "invalid TextField delegate");
return NULL;
}
result = PyTuple_GetItem(tuple, 1);
if (!result)
result = Py_None;
Py_INCREF(result);
return result;
}
%}
/* ignore structures we will not use */
%ignore ConnectionDelegate;
/* ignore functions we don't need */
// should we ignore vararg functions, or just convert them to functions with
// a fixed number of parameters?
%varargs(char*) wmessage;
//%ignore wmessage;
%ignore wwarning;
%ignore wfatal;
%ignore wsyserror;
%ignore wsyserrorwithcode;
%ignore WMCreatePLArray;
%ignore WMCreatePLDictionary;
%apply int *INPUT { int *argc };
#define Bool int
%include "WINGs/WUtil.h"
/* ignore structures we will not use */
/* ignore functions we don't need */
%include "WINGs/WINGs.h"
%{
void
WHandleEvents()
{
/* Check any expired timers */
W_CheckTimerHandlers();
/* Do idle and timer stuff while there are no input events */
/* Do not wait for input here. just peek to se if input is available */
while (!W_HandleInputEvents(False, -1) && W_CheckIdleHandlers()) {
/* dispatch timer events */
W_CheckTimerHandlers();
}
W_HandleInputEvents(True, -1);
/* Check any expired timers */
W_CheckTimerHandlers();
}
%}
/* rewrite functions originally defined as macros */
%inline %{
#undef WMDuplicateArray
WMArray* WMDuplicateArray(WMArray* array) {
return WMCreateArrayWithArray(array);
}
#undef WMPushInArray
void WMPushInArray(WMArray *array, void *item) {
WMAddToArray(array, item);
}
#undef WMSetInArray
void* WMSetInArray(WMArray *array, int index, void *item) {
return WMReplaceInArray(array, index, item);
}
#undef WMRemoveFromArray
int WMRemoveFromArray(WMArray *array, void *item) {
return WMRemoveFromArrayMatching(array, NULL, item);
}
#undef WMGetFirstInArray
int WMGetFirstInArray(WMArray *array, void *item) {
return WMFindInArray(array, NULL, item);
}
#undef WMCreateBag
WMBag* WMCreateBag(int size) {
return WMCreateTreeBag();
}
#undef WMCreateBagWithDestructor
WMBag* WMCreateBagWithDestructor(int size, WMFreeDataProc *destructor) {
return WMCreateTreeBagWithDestructor(destructor);
}
#undef WMSetInBag
void* WMSetInBag(WMBag *bag, int index, void *item) {
return WMReplaceInBag(bag, index, item);
}
#undef WMAddItemToTree
WMTreeNode* WMAddItemToTree(WMTreeNode *parent, void *item) {
return WMInsertItemInTree(parent, -1, item);
}
#undef WMAddNodeToTree
WMTreeNode* WMAddNodeToTree(WMTreeNode *parent, WMTreeNode *aNode) {
return WMInsertNodeInTree(parent, -1, aNode);
}
#undef WMGetFirstInTree
/* Returns first tree node that has data == cdata */
WMTreeNode* WMGetFirstInTree(WMTreeNode *aTree, void *cdata) {
return WMFindInTree(aTree, NULL, cdata);
}
#undef WMFlushConnection
int WMFlushConnection(WMConnection *cPtr) {
return WMSendConnectionData(cPtr, NULL);
}
#undef WMGetConnectionQueuedData
WMArray* WMGetConnectionQueuedData(WMConnection *cPtr) {
return WMGetConnectionUnsentData(cPtr);
}
#undef WMWidgetClass
W_Class WMWidgetClass(WMWidget *widget) {
return (((W_WidgetType*)(widget))->widgetClass);
}
#undef WMWidgetView
WMView* WMWidgetView(WMWidget *widget) {
return (((W_WidgetType*)(widget))->view);
}
#undef WMCreateCommandButton
WMButton* WMCreateCommandButton(WMWidget *parent) {
return WMCreateCustomButton(parent, WBBSpringLoadedMask|WBBPushInMask
|WBBPushLightMask|WBBPushChangeMask);
}
#undef WMCreateRadioButton
WMButton* WMCreateRadioButton(WMWidget *parent) {
return WMCreateButton(parent, WBTRadio);
}
#undef WMCreateSwitchButton
WMButton* WMCreateSwitchButton(WMWidget *parent) {
return WMCreateButton(parent, WBTSwitch);
}
#undef WMAddListItem
WMListItem* WMAddListItem(WMList *lPtr, char *text)
{
return WMInsertListItem(lPtr, -1, text);
}
#undef WMCreateText
WMText* WMCreateText(WMWidget *parent) {
return WMCreateTextForDocumentType(parent, NULL, NULL);
}
#undef WMRefreshText
void WMRefreshText(WMText *tPtr) {
return WMThawText(tPtr);
}
#undef WMClearText
void WMClearText(WMText *tPtr) {
return WMAppendTextStream(tPtr, NULL);
}
%}

View File

@@ -1,643 +0,0 @@
#!/usr/bin/env python
import sys
import wings
# Some useful constants
False = 0
True = 1
# check about None as action for buttonAction/windowCloseAction ...
################################################################################
# Exceptions
################################################################################
from exceptions import Exception, StandardError
class Error(StandardError):
pass
del Exception, StandardError
class WMTimer:
def __init__(self, milliseconds, callback, cdata=None, persistent=False):
if persistent:
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
else:
self._o = wings.pyWMAddTimerHandler(milliseconds, (callback, cdata))
self.__WMDeleteTimerHandler = wings.pyWMDeleteTimerHandler
def __del__(self):
self.__WMDeleteTimerHandler(self._o)
class WMPersistentTimer(WMTimer):
def __init__(self, milliseconds, callback, cdata=None):
WMTimer.__init__(self, milliseconds, callback, cdata, persistent=True)
class WMScreen:
__readonly = ('display', 'width', 'height', 'depth')
def __init__(self, appname, display="", simpleapp=False):
wings.WMInitializeApplication(appname, len(sys.argv), sys.argv)
self._o = wings.pyWMOpenScreen(display, simpleapp)
if not self._o:
raise Error, "Cannot open display %s" % display
self.__dict__['display'] = wings.WMScreenDisplay(self._o)
self.__dict__['width'] = wings.WMScreenWidth(self._o)
self.__dict__['height'] = wings.WMScreenHeight(self._o)
self.__dict__['depth'] = wings.WMScreenDepth(self._o)
def __setattr__(self, name ,value):
if name in self.__readonly:
#raise AttributeError, "'%s' is a read-only WMScreen attribute" % name
raise Error, "'%s' is a read-only WMScreen attribute" % name
self.__dict__[name] = value
def __delattr__(self, name):
if name in self.__readonly:
#raise AttributeError, "'%s' attribute cannot be deleted from WMScreen instance" % name
raise Error, "'%s' attribute cannot be deleted from WMScreen instance" % name
try:
del(self.__dict__[name])
except KeyError:
raise AttributeError, "%s instance has no attribute '%s'" % \
(self.__class__.__name__, name)
def mainLoop(self):
wings.pyWMScreenMainLoop(self._o)
def breakMainLoop(self):
wings.pyWMBreakScreenMainLoop(self._o)
def runModalLoop(self, view):
wings.pyWMRunModalLoop(self._o, view)
def breakModalLoop(self):
wings.WMBreakModalLoop(self._o)
def size(self):
return (self.width, self.height)
class WMView:
pass
class WMWidget(WMView):
def __init__(self):
if self.__class__ == WMWidget:
raise Error, "a WMWidget can't be instantiated directly"
self._o = None
self.__WMDestroyWidget = wings.WMDestroyWidget
def __del__(self):
if self._o is not None:
self.__WMDestroyWidget(self._o)
def resize(self, width, height):
wings.WMResizeWidget(self._o, width, height)
def move(self, x, y):
wings.WMMoveWidget(self._o, x, y)
def realize(self):
wings.WMRealizeWidget(self._o)
def show(self):
wings.WMMapWidget(self._o)
def hide(self):
wings.WMUnmapWidget(self._o)
def redisplay(self):
wings.WMRedisplayWidget(self._o)
def width(self):
return wings.WMWidgetWidth(self._o)
def height(self):
return wings.WMWidgetHeight(self._o)
def screen(self):
return wings.WMWidgetScreen(self._o)
def view(self):
return wings.WMWidgetView(self._o)
def setFocusTo(self, other):
wings.WMSetFocusToWidget(other._o)
class WMWindow(WMWidget):
def __init__(self, screen, name, style=wings.WMTitledWindowMask
|wings.WMClosableWindowMask|wings.WMMiniaturizableWindowMask
|wings.WMResizableWindowMask):
WMWidget.__init__(self)
self._o = wings.WMCreateWindowWithStyle(screen._o, name, style)
def setMinSize(self, minWidth, minHeight):
wings.WMSetWindowMinSize(self._o, minWidth, minHeight)
def setMaxSize(self, maxWidth, maxHeight):
wings.WMSetWindowMaxSize(self._o, maxWidth, maxHeight)
def setInitialPosition(self, x, y):
wings.WMSetWindowInitialPosition(self._o, x, y)
def setTitle(self, title):
wings.WMSetWindowTitle(self._o, title)
def setCloseAction(self, action, data=None):
if action!=None and (not callable(action)):
raise Error, "action needs to be a callable object or None"
wings.pyWMSetWindowCloseAction(self._o, (self, action, data))
class WMPanel(WMWindow):
def __init__(self, owner, name, style=wings.WMTitledWindowMask
|wings.WMClosableWindowMask|wings.WMResizableWindowMask):
WMWidget.__init__(self)
self._o = wings.WMCreatePanelWithStyleForWindow(owner._o, name, style)
class WMFrame(WMWidget):
def __init__(self, parent, title=None):
WMWidget.__init__(self)
self._o = wings.WMCreateFrame(parent._o)
self.setTitle(title)
def setRelief(self, relief):
wings.WMSetFrameRelief(self._o, relief)
def setTitle(self, title=""):
wings.WMSetFrameTitle(self._o, title)
def setTitlePosition(self, position):
wings.WMSetFrameTitlePosition(self._o, position)
class WMLabel(WMWidget):
def __init__(self, parent, text=None):
WMWidget.__init__(self)
self._o = wings.WMCreateLabel(parent._o)
self.setText(text)
def setWraps(self, flag):
# bool(flag) for python2.2
wings.WMSetLabelWraps(self._o, flag)
def setRelief(self, relief):
wings.WMSetLabelRelief(self._o, relief)
def setText(self, text=""):
wings.WMSetLabelText(self._o, text)
def setTextColor(self, color):
wings.WMSetLabelTextColor(self._o, color)
def setFont(self, font):
wings.WMSetLabelFont(self._o, font)
def setTextAlignment(self, alignment):
wings.WMSetLabelTextAlignment(self._o, alignment)
def setImage(self, image):
wings.WMSetLabelImage(self._o, image)
def setImagePosition(self, position):
wings.WMSetLabelImagePosition(self._o, position)
def text(self):
return wings.WMGetLabelText(self._o)
def font(self):
return wings.WMGetLabelFont(self._o)
def image(self):
return wings.WMGetLabelImage(self._o)
class WMBox(WMWidget):
def __init__(self, parent):
WMWidget.__init__(self)
self._o = wings.WMCreateBox(parent._o)
def setHorizontal(self, flag):
# bool(flag) for python2.2
wings.WMSetBoxHorizontal(self._o, flag)
def setBorderWidth(self, width):
wings.WMSetBoxBorderWidth(self._o, width)
def addSubview(self, view, expand, fill, minSize, maxSize, space):
wings.WMAddBoxSubview(self._o, view, expand, fill, minSize, maxSixe, space)
def addSubviewAtEnd(self, view, expand, fill, minSize, maxSize, space):
wings.WMAddBoxSubviewAtEnd(self._o, view, expand, fill, minSize, maxSixe, space)
def removeSubview(self, view):
wings.WMRemoveBoxSubview(self._o, view)
class WMButton(WMWidget): # not for user instantiation
def __init__(self, parent):
WMWidget.__init__(self)
if self.__class__ == WMButton:
raise Error, "a WMButton can't be instantiated directly"
def setText(self, text=""):
wings.WMSetButtonText(self._o, text)
def setAction(self, action, data=None):
if action!=None and (not callable(action)):
raise Error, "action needs to be a callable object or None"
wings.pyWMSetButtonAction(self._o, (self, action, data))
def performClick(self):
wings.WMPerformButtonClick(self._o)
def setEnabled(self, flag):
# bool(flag) for python2.2
wings.WMSetButtonEnabled(self._o, flag)
def isEnabled(self):
return wings.WMGetButtonEnabled(self._o)
def setImageDimsWhenDisabled(self, flag):
# bool(flag)
wings.WMSetButtonImageDimsWhenDisabled(self._o, flag)
def setImage(self, image):
wings.WMSetButtonImage(self_.o, image)
def setAlternateImage(self, image):
wings.WMSetButtonAltImage(self._o, image)
def setImagePosition(self, position):
wings.WMSetButtonImagePosition(self._o, position)
def setImageDefault(self):
wings.WMSetButtonImageDefault(self._o)
class WMCommandButton(WMButton):
def __init__(self, parent):
WMButton.__init__(self, parent)
self._o = wings.WMCreateCommandButton(parent._o)
class WMSwitchButton(WMButton):
def __init__(self, parent):
WMButton.__init__(self, parent)
self._o = wings.WMCreateSwitchButton(parent._o)
class WMRadioButton(WMButton):
def __init__(self, parent, group=None):
WMButton.__init__(self, parent)
self._o = wings.WMCreateRadioButton(parent._o)
if group:
wings.WMGroupButtons(group._o, self._o)
class WMListItem:
pass
class WMList(WMWidget):
def __init__(self, parent):
WMWidget.__init__(self)
self._o = wings.WMCreateList(parent._o)
def allowEmptySelection(self, flag):
# bool(flag)
wings.WMSetListAllowEmptySelection(self._o, flag)
def allowMultipleSelection(self, flag):
# bool(flag)
wings.WMSetListAllowMultipleSelection(self._o, flag)
def addItem(self, item):
wings.WMAddListItem(self._o, item)
def insertItem(self, row, item):
wings.WMInsertListItem(self._o, row, item)
def sortItems(self):
wings.WMSortListItems(self._o)
def rowWithTitle(self, title):
return wings.WMFindRowOfListItemWithTitle(self._o, title)
def selectedItemRow(self):
return wings.WMGetListSelectedItemRow(self._o)
def selectedItem(self):
return wings.WMGetListSelectedItem(self._o)
def removeItem(self, index):
wings.WMRemoveListItem(self._o, index)
def selectItem(self, index):
wings.WMSelectListItem(self._o, index)
def unselectItem(self, index):
wings.WMUnselectListItem(self._o, index)
class WMTextFieldDelegate:
__callbacks = ('didBeginEditing', 'didChange', 'didEndEditing',
'shouldBeginEditing', 'shouldEndEditing')
def __init__(self):
self.__dict__['data'] = None
self.__dict__['didBeginEditing'] = None
self.__dict__['didChange'] = None
self.__dict__['didEndEditing'] = None
self.__dict__['shouldBeginEditing'] = None
self.__dict__['shouldEndEditing'] = None
def __setattr__(self, name ,value):
if name in self.__callbacks and value!=None and (not callable(value)):
#raise AttributeError, "%s.%s needs to be a callable object or None" % (self.__class__.__name__, name)
raise Error, "%s.%s needs to be a callable object or None" % (self.__class__.__name__, name)
else:
self.__dict__[name] = value
class WMTextField(WMWidget):
def __init__(self, parent, text=""):
WMWidget.__init__(self)
self._o = wings.WMCreateTextField(parent._o)
wings.WMSetTextFieldText(self._o, text)
def setDelegate(self, delegate):
if delegate.__class__ != WMTextFieldDelegate:
raise Error, "textfield delegate must be of type 'WMTextFieldDelegate'"
wings.pyWMSetTextFieldDelegate(self._o, (self, delegate))
def delegate(self):
return wings.pyWMGetTextFieldDelegate(self._o)
def text(self):
return wings.WMGetTextFieldText(self._o)
def setEditable(self, flag):
# bool(flag)
wings.WMSetTextFieldEditable(self._o, flag)
def setBordered(self, flag):
# bool(flag)
wings.WMSetTextFieldBordered(self._o, flag)
def setBeveled(self, flag):
# bool(flag)
wings.WMSetTextFieldBeveled(self._o, flag)
def setSecure(self, flag):
# bool(flag)
wings.WMSetTextFieldSecure(self._o, flag)
def setCursorPosition(self, position):
wings.WMSetTextFieldCursorPosition(self._o, position)
def setNextText(self, next):
wings.WMSetTextFieldNextTextField(self._o, next._o)
def setPreviousText(self, previous):
wings.WMSetTextFieldPrevTextField(self._o, previous._o)
def setTextAlignment(self, alignment):
wings.WMSetTextFieldAlignment(self._o, alignment)
def isEditable(self):
return wings.WMGetTextFieldEditable(self._o)
def insertText(self, text, position):
wings.WMInsertTextFieldText(self._o, text, position)
def deleteText(self, start, count):
wings.WMDeleteTextFieldRange(self._o, wings.wmkrange(start, count))
def selectText(self, start, count):
wings.WMSelectTextFieldRange(self._o, wings.wmkrange(start, count))
def setFont(self, font):
wings.WMSetTextFieldFont(self._o, font)
def font(self):
return wings.WMGetTextFieldFont(self._o)
################################################################################
# wrap the WINGs constants so we don't need wings.constant_name
################################################################################
# WMWindow title style
WMTitledWindowMask = wings.WMTitledWindowMask
WMClosableWindowMask = wings.WMClosableWindowMask
WMMiniaturizableWindowMask = wings.WMMiniaturizableWindowMask
WMResizableWindowMask = wings.WMResizableWindowMask
# WMFrame title positions
WTPNoTitle = wings.WTPNoTitle
WTPAboveTop = wings.WTPAboveTop
WTPAtTop = wings.WTPAtTop
WTPBelowTop = wings.WTPBelowTop
WTPAboveBottom = wings.WTPAboveBottom
WTPAtBottom = wings.WTPAtBottom
WTPBelowBottom = wings.WTPBelowBottom
# Alingments
WALeft = wings.WALeft
WACenter = wings.WACenter
WARight = wings.WARight
WAJustified = wings.WAJustified # not valid for textfields
# Image positions
WIPNoImage = wings.WIPNoImage
WIPImageOnly = wings.WIPImageOnly
WIPLeft = wings.WIPLeft
WIPRight = wings.WIPRight
WIPBelow = wings.WIPBelow
WIPAbove = wings.WIPAbove
WIPOverlaps = wings.WIPOverlaps
# Relief types
WRFlat = wings.WRFlat
WRSimple = wings.WRSimple
WRRaised = wings.WRRaised
WRSunken = wings.WRSunken
WRGroove = wings.WRGroove
WRRidge = wings.WRRidge
WRPushed = wings.WRPushed
# TextField events
WMReturnTextMovement = wings.WMReturnTextMovement
WMEscapeTextMovement = wings.WMEscapeTextMovement
WMIllegalTextMovement = wings.WMIllegalTextMovement
WMTabTextMovement = wings.WMTabTextMovement
WMBacktabTextMovement = wings.WMBacktabTextMovement
WMLeftTextMovement = wings.WMLeftTextMovement
WMRightTextMovement = wings.WMRightTextMovement
WMUpTextMovement = wings.WMUpTextMovement
WMDownTextMovement = wings.WMDownTextMovement
if __name__ == "__main__":
def quit(obj, data):
#sys.exit()
scr.breakMainLoop()
def click(btn, list):
print win.width(), win.height()
print list.selectedItemRow()
win2.show()
scr.runModalLoop(win2.view())
print txt2.text()
def sayhi(btn, data):
print "hi"
def breakLoop(btn, data):
#sys.exit()
scr.breakModalLoop()
win2.hide()
def dc(object, data, action):
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
def dee(object, data, action):
if action == wings.WMReturnTextMovement:
if object == txt:
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()
list.selectItem(list.index)
list.unselectItem(old)
list.index = (list.index+1) % 3
#print one
scr = WMScreen("foobar")
win = WMWindow(scr, "aWindow")
win.setCloseAction(quit)
win.setTitle("test window")
win.resize(400, 180)
win.setInitialPosition((scr.width-win.width())/2, (scr.height-win.height())/2)
btn = WMCommandButton(win)
btn.setText("Click Me")
btn.resize(100, 25)
btn.move(20, 20)
btn.show()
sw = WMSwitchButton(win)
sw.setText("Some option")
sw.resize(100, 25)
sw.move(20, 50)
sw.show()
radios = []
r = None
j = 0
for i in ["One", "Two", "Four"]:
r = WMRadioButton(win, r)
radios.append(r)
r.show()
r.setText(i)
r.move(20, 70+j*25)
r.resize(100, 25)
j=j+1
sw.setAction(sayhi)
list = WMList(win)
list.resize(100,100)
list.move(130, 20)
list.addItem("one")
list.addItem("two")
list.addItem("three")
list.allowMultipleSelection(1)
list.show()
list.index = 0
txtdel = WMTextFieldDelegate()
txtdel.data = 'mydata'
txtdel.didBeginEditing = dbe
txtdel.didEndEditing = dee
txtdel.didChange = dc
txt = WMTextField(win, "abc")
txt.resize(95, 20)
txt.move(295, 20)
txt.setDelegate(txtdel)
txt.show()
txt2 = WMTextField(win, "01234567890")
txt2.resize(95, 20)
txt2.move(295, 45)
txt2.setDelegate(txtdel)
txt2.show()
txt.setNextText(txt2)
txt2.setNextText(txt)
label = WMLabel(win, "Text1:")
label.setTextAlignment(WARight)
label.move(240, 20)
label.resize(55, 20)
label.show()
label2 = WMLabel(win, "mytext2:")
label2.setTextAlignment(WARight)
label2.move(240, 45)
label2.resize(55, 20)
label2.show()
btn.setAction(click, list)
frame = WMFrame(win, "My Frame")
frame.resize(150, 50)
frame.move(240, 70)
#frame.setRelief(WRPushed)
frame.show()
ebtn = WMCommandButton(win)
ebtn.setText("Exit")
ebtn.resize(100, 25)
ebtn.move(290, 147)
ebtn.setAction(quit)
ebtn.show()
win.realize()
win.show()
timer = WMPersistentTimer(1000, tcb, win)
#del(timer)
#timer.delete()
win2 = WMPanel(win, "anotherWindow", WMTitledWindowMask)
win2.setTitle("transient test window")
win2.resize(150, 50)
win2.setInitialPosition((scr.width-win2.width())/2, (scr.height-win2.height())/2)
btn7 = WMCommandButton(win2)
btn7.setText("Dismiss")
btn7.resize(100, 25)
btn7.move(27, 10)
btn7.show()
btn7.setAction(breakLoop)
win2.realize()
scr.mainLoop()

View File

@@ -1,71 +0,0 @@
#!/usr/bin/env python
"""Setup script for the WINGs module distribution."""
import os, sys
from distutils.core import setup
from distutils.extension import Extension
## Get the include dirs
wings = os.popen("get-wings-flags --cflags", "r")
flags = wings.read().split()
include_dirs = [x[2:] for x in flags]
#include_dirs += [".."]
wings.close()
## Get the library dirs
wings = os.popen("get-wings-flags --ldflags", "r")
flags = wings.read().split()
library_dirs = [x[2:] for x in flags]
#library_dirs += [".."]
wings.close()
## Get the libraries
wings = os.popen("get-wings-flags --libs", "r")
flags = wings.read().split()
libraries = [x[2:] for x in flags]
wings.close()
runtime_library_dirs = []
extra_objects = []
extra_compile_args = ['-Wno-strict-prototypes', '-Wno-unused']
long_description = \
"""Python interface to the WINGs library
Python WINGs is an interface to WINGs, 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.
"""
setup (# Distribution meta-data
name = "Python-WINGs",
version = "0.81.0",
description = "A python interface to WINGs",
long_description=long_description,
author = "Dan Pascu",
author_email = "dan@windowmaker.org",
license = "GPL",
platforms = "ALL",
url = "http://windowmaker.org/",
# Description of the modules and packages in the distribution
py_modules = ["WINGs"],
ext_modules = [Extension(
name='wings',
sources=['WINGs.c'],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=runtime_library_dirs,
libraries=libraries,
extra_objects=extra_objects,
extra_compile_args=extra_compile_args,
)],
)

View File

@@ -1,159 +0,0 @@
#!/usr/bin/env python
import sys
from WINGs import *
if __name__ == "__main__":
def quit(obj, data):
#sys.exit()
scr.breakMainLoop()
def click(btn, list):
print win.width(), win.height()
print list.selectedItemRow()
win2.show()
scr.runModalLoop(win2.view())
print txt2.text()
def sayhi(btn, data):
print "hi"
def breakLoop(btn, data):
#sys.exit()
scr.breakModalLoop()
win2.hide()
def dc(object, data, action):
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
def dee(object, data, action):
if action == wings.WMReturnTextMovement:
if object == txt:
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()
list.selectItem(list.index)
list.unselectItem(old)
list.index = (list.index+1) % 3
#print one
scr = WMScreen("foobar")
win = WMWindow(scr, "aWindow")
win.setCloseAction(quit)
win.setTitle("test window")
win.resize(400, 180)
win.setInitialPosition((scr.width-win.width())/2, (scr.height-win.height())/2)
btn = WMCommandButton(win)
btn.setText("Click Me")
btn.resize(100, 25)
btn.move(20, 20)
btn.show()
sw = WMSwitchButton(win)
sw.setText("Some option")
sw.resize(100, 25)
sw.move(20, 50)
sw.show()
radios = []
r = None
j = 0
for i in ["One", "Two", "Four"]:
r = WMRadioButton(win, r)
radios.append(r)
r.show()
r.setText(i)
r.move(20, 70+j*25)
r.resize(100, 25)
j=j+1
sw.setAction(sayhi)
list = WMList(win)
list.resize(100,100)
list.move(130, 20)
list.addItem("one")
list.addItem("two")
list.addItem("three")
list.allowMultipleSelection(1)
list.show()
list.index = 0
txtdel = WMTextFieldDelegate()
txtdel.data = 'mydata'
txtdel.didBeginEditing = dbe
txtdel.didEndEditing = dee
txtdel.didChange = dc
txt = WMTextField(win)
txt.resize(95, 20)
txt.move(295, 20)
txt.setDelegate(txtdel)
txt.show()
txt2 = WMTextField(win, "01234567890")
txt2.resize(95, 20)
txt2.move(295, 45)
txt2.setDelegate(txtdel)
txt2.show()
txt.setNextText(txt2)
txt2.setNextText(txt)
label = WMLabel(win, "Text1:")
label.setTextAlignment(WARight)
label.move(240, 20)
label.resize(55, 20)
label.show()
label2 = WMLabel(win, "mytext2:")
label2.setTextAlignment(WARight)
label2.move(240, 45)
label2.resize(55, 20)
label2.show()
btn.setAction(click, list)
frame = WMFrame(win, "My Frame")
frame.resize(150, 50)
frame.move(240, 70)
#frame.setRelief(WRPushed)
frame.show()
ebtn = WMCommandButton(win)
ebtn.setText("Exit")
ebtn.resize(100, 25)
ebtn.move(290, 147)
ebtn.setAction(quit)
ebtn.show()
win.realize()
win.show()
timer = WMPersistentTimer(1000, tcb, win)
#del(timer)
#timer.delete()
win2 = WMPanel(win, "anotherWindow", WMTitledWindowMask)
win2.setTitle("transient test window")
win2.resize(150, 50)
win2.setInitialPosition((scr.width-win2.width())/2, (scr.height-win2.height())/2)
btn7 = WMCommandButton(win2)
btn7.setText("Dismiss")
btn7.resize(100, 25)
btn7.move(27, 10)
btn7.show()
btn7.setAction(breakLoop)
win2.realize()
scr.mainLoop()

771
WINGs/rgb.h Normal file
View File

@@ -0,0 +1,771 @@
/* Automatically generated file. Do NOT edit. Regenerate it using make-rgb */
#ifndef RGB_H_
#define RGB_H_
#include <wraster.h>
typedef struct RGBColor {
RColor color;
char *name;
} RGBColor;
RGBColor rgbColors[] = {
{{255, 250, 250, 0}, "snow"},
{{248, 248, 255, 0}, "ghost"},
{{248, 248, 255, 0}, "GhostWhite"},
{{245, 245, 245, 0}, "white"},
{{245, 245, 245, 0}, "WhiteSmoke"},
{{220, 220, 220, 0}, "gainsboro"},
{{255, 250, 240, 0}, "floral"},
{{255, 250, 240, 0}, "FloralWhite"},
{{253, 245, 230, 0}, "old"},
{{253, 245, 230, 0}, "OldLace"},
{{250, 240, 230, 0}, "linen"},
{{250, 235, 215, 0}, "antique"},
{{250, 235, 215, 0}, "AntiqueWhite"},
{{255, 239, 213, 0}, "papaya"},
{{255, 239, 213, 0}, "PapayaWhip"},
{{255, 235, 205, 0}, "blanched"},
{{255, 235, 205, 0}, "BlanchedAlmond"},
{{255, 228, 196, 0}, "bisque"},
{{255, 218, 185, 0}, "peach"},
{{255, 218, 185, 0}, "PeachPuff"},
{{255, 222, 173, 0}, "navajo"},
{{255, 222, 173, 0}, "NavajoWhite"},
{{255, 228, 181, 0}, "moccasin"},
{{255, 248, 220, 0}, "cornsilk"},
{{255, 255, 240, 0}, "ivory"},
{{255, 250, 205, 0}, "lemon"},
{{255, 250, 205, 0}, "LemonChiffon"},
{{255, 245, 238, 0}, "seashell"},
{{240, 255, 240, 0}, "honeydew"},
{{245, 255, 250, 0}, "mint"},
{{245, 255, 250, 0}, "MintCream"},
{{240, 255, 255, 0}, "azure"},
{{240, 248, 255, 0}, "alice"},
{{240, 248, 255, 0}, "AliceBlue"},
{{230, 230, 250, 0}, "lavender"},
{{255, 240, 245, 0}, "lavender"},
{{255, 240, 245, 0}, "LavenderBlush"},
{{255, 228, 225, 0}, "misty"},
{{255, 228, 225, 0}, "MistyRose"},
{{255, 255, 255, 0}, "white"},
{{ 0, 0, 0, 0}, "black"},
{{ 47, 79, 79, 0}, "dark"},
{{ 47, 79, 79, 0}, "DarkSlateGray"},
{{ 47, 79, 79, 0}, "dark"},
{{ 47, 79, 79, 0}, "DarkSlateGrey"},
{{105, 105, 105, 0}, "dim"},
{{105, 105, 105, 0}, "DimGray"},
{{105, 105, 105, 0}, "dim"},
{{105, 105, 105, 0}, "DimGrey"},
{{112, 128, 144, 0}, "slate"},
{{112, 128, 144, 0}, "SlateGray"},
{{112, 128, 144, 0}, "slate"},
{{112, 128, 144, 0}, "SlateGrey"},
{{119, 136, 153, 0}, "light"},
{{119, 136, 153, 0}, "LightSlateGray"},
{{119, 136, 153, 0}, "light"},
{{119, 136, 153, 0}, "LightSlateGrey"},
{{190, 190, 190, 0}, "gray"},
{{190, 190, 190, 0}, "grey"},
{{211, 211, 211, 0}, "light"},
{{211, 211, 211, 0}, "LightGrey"},
{{211, 211, 211, 0}, "light"},
{{211, 211, 211, 0}, "LightGray"},
{{ 25, 25, 112, 0}, "midnight"},
{{ 25, 25, 112, 0}, "MidnightBlue"},
{{ 0, 0, 128, 0}, "navy"},
{{ 0, 0, 128, 0}, "navy"},
{{ 0, 0, 128, 0}, "NavyBlue"},
{{100, 149, 237, 0}, "cornflower"},
{{100, 149, 237, 0}, "CornflowerBlue"},
{{ 72, 61, 139, 0}, "dark"},
{{ 72, 61, 139, 0}, "DarkSlateBlue"},
{{106, 90, 205, 0}, "slate"},
{{106, 90, 205, 0}, "SlateBlue"},
{{123, 104, 238, 0}, "medium"},
{{123, 104, 238, 0}, "MediumSlateBlue"},
{{132, 112, 255, 0}, "light"},
{{132, 112, 255, 0}, "LightSlateBlue"},
{{ 0, 0, 205, 0}, "medium"},
{{ 0, 0, 205, 0}, "MediumBlue"},
{{ 65, 105, 225, 0}, "royal"},
{{ 65, 105, 225, 0}, "RoyalBlue"},
{{ 0, 0, 255, 0}, "blue"},
{{ 30, 144, 255, 0}, "dodger"},
{{ 30, 144, 255, 0}, "DodgerBlue"},
{{ 0, 191, 255, 0}, "deep"},
{{ 0, 191, 255, 0}, "DeepSkyBlue"},
{{135, 206, 235, 0}, "sky"},
{{135, 206, 235, 0}, "SkyBlue"},
{{135, 206, 250, 0}, "light"},
{{135, 206, 250, 0}, "LightSkyBlue"},
{{ 70, 130, 180, 0}, "steel"},
{{ 70, 130, 180, 0}, "SteelBlue"},
{{176, 196, 222, 0}, "light"},
{{176, 196, 222, 0}, "LightSteelBlue"},
{{173, 216, 230, 0}, "light"},
{{173, 216, 230, 0}, "LightBlue"},
{{176, 224, 230, 0}, "powder"},
{{176, 224, 230, 0}, "PowderBlue"},
{{175, 238, 238, 0}, "pale"},
{{175, 238, 238, 0}, "PaleTurquoise"},
{{ 0, 206, 209, 0}, "dark"},
{{ 0, 206, 209, 0}, "DarkTurquoise"},
{{ 72, 209, 204, 0}, "medium"},
{{ 72, 209, 204, 0}, "MediumTurquoise"},
{{ 64, 224, 208, 0}, "turquoise"},
{{ 0, 255, 255, 0}, "cyan"},
{{224, 255, 255, 0}, "light"},
{{224, 255, 255, 0}, "LightCyan"},
{{ 95, 158, 160, 0}, "cadet"},
{{ 95, 158, 160, 0}, "CadetBlue"},
{{102, 205, 170, 0}, "medium"},
{{102, 205, 170, 0}, "MediumAquamarine"},
{{127, 255, 212, 0}, "aquamarine"},
{{ 0, 100, 0, 0}, "dark"},
{{ 0, 100, 0, 0}, "DarkGreen"},
{{ 85, 107, 47, 0}, "dark"},
{{ 85, 107, 47, 0}, "DarkOliveGreen"},
{{143, 188, 143, 0}, "dark"},
{{143, 188, 143, 0}, "DarkSeaGreen"},
{{ 46, 139, 87, 0}, "sea"},
{{ 46, 139, 87, 0}, "SeaGreen"},
{{ 60, 179, 113, 0}, "medium"},
{{ 60, 179, 113, 0}, "MediumSeaGreen"},
{{ 32, 178, 170, 0}, "light"},
{{ 32, 178, 170, 0}, "LightSeaGreen"},
{{152, 251, 152, 0}, "pale"},
{{152, 251, 152, 0}, "PaleGreen"},
{{ 0, 255, 127, 0}, "spring"},
{{ 0, 255, 127, 0}, "SpringGreen"},
{{124, 252, 0, 0}, "lawn"},
{{124, 252, 0, 0}, "LawnGreen"},
{{ 0, 255, 0, 0}, "green"},
{{127, 255, 0, 0}, "chartreuse"},
{{ 0, 250, 154, 0}, "medium"},
{{ 0, 250, 154, 0}, "MediumSpringGreen"},
{{173, 255, 47, 0}, "green"},
{{173, 255, 47, 0}, "GreenYellow"},
{{ 50, 205, 50, 0}, "lime"},
{{ 50, 205, 50, 0}, "LimeGreen"},
{{154, 205, 50, 0}, "yellow"},
{{154, 205, 50, 0}, "YellowGreen"},
{{ 34, 139, 34, 0}, "forest"},
{{ 34, 139, 34, 0}, "ForestGreen"},
{{107, 142, 35, 0}, "olive"},
{{107, 142, 35, 0}, "OliveDrab"},
{{189, 183, 107, 0}, "dark"},
{{189, 183, 107, 0}, "DarkKhaki"},
{{240, 230, 140, 0}, "khaki"},
{{238, 232, 170, 0}, "pale"},
{{238, 232, 170, 0}, "PaleGoldenrod"},
{{250, 250, 210, 0}, "light"},
{{250, 250, 210, 0}, "LightGoldenrodYellow"},
{{255, 255, 224, 0}, "light"},
{{255, 255, 224, 0}, "LightYellow"},
{{255, 255, 0, 0}, "yellow"},
{{255, 215, 0, 0}, "gold"},
{{238, 221, 130, 0}, "light"},
{{238, 221, 130, 0}, "LightGoldenrod"},
{{218, 165, 32, 0}, "goldenrod"},
{{184, 134, 11, 0}, "dark"},
{{184, 134, 11, 0}, "DarkGoldenrod"},
{{188, 143, 143, 0}, "rosy"},
{{188, 143, 143, 0}, "RosyBrown"},
{{205, 92, 92, 0}, "indian"},
{{205, 92, 92, 0}, "IndianRed"},
{{139, 69, 19, 0}, "saddle"},
{{139, 69, 19, 0}, "SaddleBrown"},
{{160, 82, 45, 0}, "sienna"},
{{205, 133, 63, 0}, "peru"},
{{222, 184, 135, 0}, "burlywood"},
{{245, 245, 220, 0}, "beige"},
{{245, 222, 179, 0}, "wheat"},
{{244, 164, 96, 0}, "sandy"},
{{244, 164, 96, 0}, "SandyBrown"},
{{210, 180, 140, 0}, "tan"},
{{210, 105, 30, 0}, "chocolate"},
{{178, 34, 34, 0}, "firebrick"},
{{165, 42, 42, 0}, "brown"},
{{233, 150, 122, 0}, "dark"},
{{233, 150, 122, 0}, "DarkSalmon"},
{{250, 128, 114, 0}, "salmon"},
{{255, 160, 122, 0}, "light"},
{{255, 160, 122, 0}, "LightSalmon"},
{{255, 165, 0, 0}, "orange"},
{{255, 140, 0, 0}, "dark"},
{{255, 140, 0, 0}, "DarkOrange"},
{{255, 127, 80, 0}, "coral"},
{{240, 128, 128, 0}, "light"},
{{240, 128, 128, 0}, "LightCoral"},
{{255, 99, 71, 0}, "tomato"},
{{255, 69, 0, 0}, "orange"},
{{255, 69, 0, 0}, "OrangeRed"},
{{255, 0, 0, 0}, "red"},
{{255, 105, 180, 0}, "hot"},
{{255, 105, 180, 0}, "HotPink"},
{{255, 20, 147, 0}, "deep"},
{{255, 20, 147, 0}, "DeepPink"},
{{255, 192, 203, 0}, "pink"},
{{255, 182, 193, 0}, "light"},
{{255, 182, 193, 0}, "LightPink"},
{{219, 112, 147, 0}, "pale"},
{{219, 112, 147, 0}, "PaleVioletRed"},
{{176, 48, 96, 0}, "maroon"},
{{199, 21, 133, 0}, "medium"},
{{199, 21, 133, 0}, "MediumVioletRed"},
{{208, 32, 144, 0}, "violet"},
{{208, 32, 144, 0}, "VioletRed"},
{{255, 0, 255, 0}, "magenta"},
{{238, 130, 238, 0}, "violet"},
{{221, 160, 221, 0}, "plum"},
{{218, 112, 214, 0}, "orchid"},
{{186, 85, 211, 0}, "medium"},
{{186, 85, 211, 0}, "MediumOrchid"},
{{153, 50, 204, 0}, "dark"},
{{153, 50, 204, 0}, "DarkOrchid"},
{{148, 0, 211, 0}, "dark"},
{{148, 0, 211, 0}, "DarkViolet"},
{{138, 43, 226, 0}, "blue"},
{{138, 43, 226, 0}, "BlueViolet"},
{{160, 32, 240, 0}, "purple"},
{{147, 112, 219, 0}, "medium"},
{{147, 112, 219, 0}, "MediumPurple"},
{{216, 191, 216, 0}, "thistle"},
{{255, 250, 250, 0}, "snow1"},
{{238, 233, 233, 0}, "snow2"},
{{205, 201, 201, 0}, "snow3"},
{{139, 137, 137, 0}, "snow4"},
{{255, 245, 238, 0}, "seashell1"},
{{238, 229, 222, 0}, "seashell2"},
{{205, 197, 191, 0}, "seashell3"},
{{139, 134, 130, 0}, "seashell4"},
{{255, 239, 219, 0}, "AntiqueWhite1"},
{{238, 223, 204, 0}, "AntiqueWhite2"},
{{205, 192, 176, 0}, "AntiqueWhite3"},
{{139, 131, 120, 0}, "AntiqueWhite4"},
{{255, 228, 196, 0}, "bisque1"},
{{238, 213, 183, 0}, "bisque2"},
{{205, 183, 158, 0}, "bisque3"},
{{139, 125, 107, 0}, "bisque4"},
{{255, 218, 185, 0}, "PeachPuff1"},
{{238, 203, 173, 0}, "PeachPuff2"},
{{205, 175, 149, 0}, "PeachPuff3"},
{{139, 119, 101, 0}, "PeachPuff4"},
{{255, 222, 173, 0}, "NavajoWhite1"},
{{238, 207, 161, 0}, "NavajoWhite2"},
{{205, 179, 139, 0}, "NavajoWhite3"},
{{139, 121, 94, 0}, "NavajoWhite4"},
{{255, 250, 205, 0}, "LemonChiffon1"},
{{238, 233, 191, 0}, "LemonChiffon2"},
{{205, 201, 165, 0}, "LemonChiffon3"},
{{139, 137, 112, 0}, "LemonChiffon4"},
{{255, 248, 220, 0}, "cornsilk1"},
{{238, 232, 205, 0}, "cornsilk2"},
{{205, 200, 177, 0}, "cornsilk3"},
{{139, 136, 120, 0}, "cornsilk4"},
{{255, 255, 240, 0}, "ivory1"},
{{238, 238, 224, 0}, "ivory2"},
{{205, 205, 193, 0}, "ivory3"},
{{139, 139, 131, 0}, "ivory4"},
{{240, 255, 240, 0}, "honeydew1"},
{{224, 238, 224, 0}, "honeydew2"},
{{193, 205, 193, 0}, "honeydew3"},
{{131, 139, 131, 0}, "honeydew4"},
{{255, 240, 245, 0}, "LavenderBlush1"},
{{238, 224, 229, 0}, "LavenderBlush2"},
{{205, 193, 197, 0}, "LavenderBlush3"},
{{139, 131, 134, 0}, "LavenderBlush4"},
{{255, 228, 225, 0}, "MistyRose1"},
{{238, 213, 210, 0}, "MistyRose2"},
{{205, 183, 181, 0}, "MistyRose3"},
{{139, 125, 123, 0}, "MistyRose4"},
{{240, 255, 255, 0}, "azure1"},
{{224, 238, 238, 0}, "azure2"},
{{193, 205, 205, 0}, "azure3"},
{{131, 139, 139, 0}, "azure4"},
{{131, 111, 255, 0}, "SlateBlue1"},
{{122, 103, 238, 0}, "SlateBlue2"},
{{105, 89, 205, 0}, "SlateBlue3"},
{{ 71, 60, 139, 0}, "SlateBlue4"},
{{ 72, 118, 255, 0}, "RoyalBlue1"},
{{ 67, 110, 238, 0}, "RoyalBlue2"},
{{ 58, 95, 205, 0}, "RoyalBlue3"},
{{ 39, 64, 139, 0}, "RoyalBlue4"},
{{ 0, 0, 255, 0}, "blue1"},
{{ 0, 0, 238, 0}, "blue2"},
{{ 0, 0, 205, 0}, "blue3"},
{{ 0, 0, 139, 0}, "blue4"},
{{ 30, 144, 255, 0}, "DodgerBlue1"},
{{ 28, 134, 238, 0}, "DodgerBlue2"},
{{ 24, 116, 205, 0}, "DodgerBlue3"},
{{ 16, 78, 139, 0}, "DodgerBlue4"},
{{ 99, 184, 255, 0}, "SteelBlue1"},
{{ 92, 172, 238, 0}, "SteelBlue2"},
{{ 79, 148, 205, 0}, "SteelBlue3"},
{{ 54, 100, 139, 0}, "SteelBlue4"},
{{ 0, 191, 255, 0}, "DeepSkyBlue1"},
{{ 0, 178, 238, 0}, "DeepSkyBlue2"},
{{ 0, 154, 205, 0}, "DeepSkyBlue3"},
{{ 0, 104, 139, 0}, "DeepSkyBlue4"},
{{135, 206, 255, 0}, "SkyBlue1"},
{{126, 192, 238, 0}, "SkyBlue2"},
{{108, 166, 205, 0}, "SkyBlue3"},
{{ 74, 112, 139, 0}, "SkyBlue4"},
{{176, 226, 255, 0}, "LightSkyBlue1"},
{{164, 211, 238, 0}, "LightSkyBlue2"},
{{141, 182, 205, 0}, "LightSkyBlue3"},
{{ 96, 123, 139, 0}, "LightSkyBlue4"},
{{198, 226, 255, 0}, "SlateGray1"},
{{185, 211, 238, 0}, "SlateGray2"},
{{159, 182, 205, 0}, "SlateGray3"},
{{108, 123, 139, 0}, "SlateGray4"},
{{202, 225, 255, 0}, "LightSteelBlue1"},
{{188, 210, 238, 0}, "LightSteelBlue2"},
{{162, 181, 205, 0}, "LightSteelBlue3"},
{{110, 123, 139, 0}, "LightSteelBlue4"},
{{191, 239, 255, 0}, "LightBlue1"},
{{178, 223, 238, 0}, "LightBlue2"},
{{154, 192, 205, 0}, "LightBlue3"},
{{104, 131, 139, 0}, "LightBlue4"},
{{224, 255, 255, 0}, "LightCyan1"},
{{209, 238, 238, 0}, "LightCyan2"},
{{180, 205, 205, 0}, "LightCyan3"},
{{122, 139, 139, 0}, "LightCyan4"},
{{187, 255, 255, 0}, "PaleTurquoise1"},
{{174, 238, 238, 0}, "PaleTurquoise2"},
{{150, 205, 205, 0}, "PaleTurquoise3"},
{{102, 139, 139, 0}, "PaleTurquoise4"},
{{152, 245, 255, 0}, "CadetBlue1"},
{{142, 229, 238, 0}, "CadetBlue2"},
{{122, 197, 205, 0}, "CadetBlue3"},
{{ 83, 134, 139, 0}, "CadetBlue4"},
{{ 0, 245, 255, 0}, "turquoise1"},
{{ 0, 229, 238, 0}, "turquoise2"},
{{ 0, 197, 205, 0}, "turquoise3"},
{{ 0, 134, 139, 0}, "turquoise4"},
{{ 0, 255, 255, 0}, "cyan1"},
{{ 0, 238, 238, 0}, "cyan2"},
{{ 0, 205, 205, 0}, "cyan3"},
{{ 0, 139, 139, 0}, "cyan4"},
{{151, 255, 255, 0}, "DarkSlateGray1"},
{{141, 238, 238, 0}, "DarkSlateGray2"},
{{121, 205, 205, 0}, "DarkSlateGray3"},
{{ 82, 139, 139, 0}, "DarkSlateGray4"},
{{127, 255, 212, 0}, "aquamarine1"},
{{118, 238, 198, 0}, "aquamarine2"},
{{102, 205, 170, 0}, "aquamarine3"},
{{ 69, 139, 116, 0}, "aquamarine4"},
{{193, 255, 193, 0}, "DarkSeaGreen1"},
{{180, 238, 180, 0}, "DarkSeaGreen2"},
{{155, 205, 155, 0}, "DarkSeaGreen3"},
{{105, 139, 105, 0}, "DarkSeaGreen4"},
{{ 84, 255, 159, 0}, "SeaGreen1"},
{{ 78, 238, 148, 0}, "SeaGreen2"},
{{ 67, 205, 128, 0}, "SeaGreen3"},
{{ 46, 139, 87, 0}, "SeaGreen4"},
{{154, 255, 154, 0}, "PaleGreen1"},
{{144, 238, 144, 0}, "PaleGreen2"},
{{124, 205, 124, 0}, "PaleGreen3"},
{{ 84, 139, 84, 0}, "PaleGreen4"},
{{ 0, 255, 127, 0}, "SpringGreen1"},
{{ 0, 238, 118, 0}, "SpringGreen2"},
{{ 0, 205, 102, 0}, "SpringGreen3"},
{{ 0, 139, 69, 0}, "SpringGreen4"},
{{ 0, 255, 0, 0}, "green1"},
{{ 0, 238, 0, 0}, "green2"},
{{ 0, 205, 0, 0}, "green3"},
{{ 0, 139, 0, 0}, "green4"},
{{127, 255, 0, 0}, "chartreuse1"},
{{118, 238, 0, 0}, "chartreuse2"},
{{102, 205, 0, 0}, "chartreuse3"},
{{ 69, 139, 0, 0}, "chartreuse4"},
{{192, 255, 62, 0}, "OliveDrab1"},
{{179, 238, 58, 0}, "OliveDrab2"},
{{154, 205, 50, 0}, "OliveDrab3"},
{{105, 139, 34, 0}, "OliveDrab4"},
{{202, 255, 112, 0}, "DarkOliveGreen1"},
{{188, 238, 104, 0}, "DarkOliveGreen2"},
{{162, 205, 90, 0}, "DarkOliveGreen3"},
{{110, 139, 61, 0}, "DarkOliveGreen4"},
{{255, 246, 143, 0}, "khaki1"},
{{238, 230, 133, 0}, "khaki2"},
{{205, 198, 115, 0}, "khaki3"},
{{139, 134, 78, 0}, "khaki4"},
{{255, 236, 139, 0}, "LightGoldenrod1"},
{{238, 220, 130, 0}, "LightGoldenrod2"},
{{205, 190, 112, 0}, "LightGoldenrod3"},
{{139, 129, 76, 0}, "LightGoldenrod4"},
{{255, 255, 224, 0}, "LightYellow1"},
{{238, 238, 209, 0}, "LightYellow2"},
{{205, 205, 180, 0}, "LightYellow3"},
{{139, 139, 122, 0}, "LightYellow4"},
{{255, 255, 0, 0}, "yellow1"},
{{238, 238, 0, 0}, "yellow2"},
{{205, 205, 0, 0}, "yellow3"},
{{139, 139, 0, 0}, "yellow4"},
{{255, 215, 0, 0}, "gold1"},
{{238, 201, 0, 0}, "gold2"},
{{205, 173, 0, 0}, "gold3"},
{{139, 117, 0, 0}, "gold4"},
{{255, 193, 37, 0}, "goldenrod1"},
{{238, 180, 34, 0}, "goldenrod2"},
{{205, 155, 29, 0}, "goldenrod3"},
{{139, 105, 20, 0}, "goldenrod4"},
{{255, 185, 15, 0}, "DarkGoldenrod1"},
{{238, 173, 14, 0}, "DarkGoldenrod2"},
{{205, 149, 12, 0}, "DarkGoldenrod3"},
{{139, 101, 8, 0}, "DarkGoldenrod4"},
{{255, 193, 193, 0}, "RosyBrown1"},
{{238, 180, 180, 0}, "RosyBrown2"},
{{205, 155, 155, 0}, "RosyBrown3"},
{{139, 105, 105, 0}, "RosyBrown4"},
{{255, 106, 106, 0}, "IndianRed1"},
{{238, 99, 99, 0}, "IndianRed2"},
{{205, 85, 85, 0}, "IndianRed3"},
{{139, 58, 58, 0}, "IndianRed4"},
{{255, 130, 71, 0}, "sienna1"},
{{238, 121, 66, 0}, "sienna2"},
{{205, 104, 57, 0}, "sienna3"},
{{139, 71, 38, 0}, "sienna4"},
{{255, 211, 155, 0}, "burlywood1"},
{{238, 197, 145, 0}, "burlywood2"},
{{205, 170, 125, 0}, "burlywood3"},
{{139, 115, 85, 0}, "burlywood4"},
{{255, 231, 186, 0}, "wheat1"},
{{238, 216, 174, 0}, "wheat2"},
{{205, 186, 150, 0}, "wheat3"},
{{139, 126, 102, 0}, "wheat4"},
{{255, 165, 79, 0}, "tan1"},
{{238, 154, 73, 0}, "tan2"},
{{205, 133, 63, 0}, "tan3"},
{{139, 90, 43, 0}, "tan4"},
{{255, 127, 36, 0}, "chocolate1"},
{{238, 118, 33, 0}, "chocolate2"},
{{205, 102, 29, 0}, "chocolate3"},
{{139, 69, 19, 0}, "chocolate4"},
{{255, 48, 48, 0}, "firebrick1"},
{{238, 44, 44, 0}, "firebrick2"},
{{205, 38, 38, 0}, "firebrick3"},
{{139, 26, 26, 0}, "firebrick4"},
{{255, 64, 64, 0}, "brown1"},
{{238, 59, 59, 0}, "brown2"},
{{205, 51, 51, 0}, "brown3"},
{{139, 35, 35, 0}, "brown4"},
{{255, 140, 105, 0}, "salmon1"},
{{238, 130, 98, 0}, "salmon2"},
{{205, 112, 84, 0}, "salmon3"},
{{139, 76, 57, 0}, "salmon4"},
{{255, 160, 122, 0}, "LightSalmon1"},
{{238, 149, 114, 0}, "LightSalmon2"},
{{205, 129, 98, 0}, "LightSalmon3"},
{{139, 87, 66, 0}, "LightSalmon4"},
{{255, 165, 0, 0}, "orange1"},
{{238, 154, 0, 0}, "orange2"},
{{205, 133, 0, 0}, "orange3"},
{{139, 90, 0, 0}, "orange4"},
{{255, 127, 0, 0}, "DarkOrange1"},
{{238, 118, 0, 0}, "DarkOrange2"},
{{205, 102, 0, 0}, "DarkOrange3"},
{{139, 69, 0, 0}, "DarkOrange4"},
{{255, 114, 86, 0}, "coral1"},
{{238, 106, 80, 0}, "coral2"},
{{205, 91, 69, 0}, "coral3"},
{{139, 62, 47, 0}, "coral4"},
{{255, 99, 71, 0}, "tomato1"},
{{238, 92, 66, 0}, "tomato2"},
{{205, 79, 57, 0}, "tomato3"},
{{139, 54, 38, 0}, "tomato4"},
{{255, 69, 0, 0}, "OrangeRed1"},
{{238, 64, 0, 0}, "OrangeRed2"},
{{205, 55, 0, 0}, "OrangeRed3"},
{{139, 37, 0, 0}, "OrangeRed4"},
{{255, 0, 0, 0}, "red1"},
{{238, 0, 0, 0}, "red2"},
{{205, 0, 0, 0}, "red3"},
{{139, 0, 0, 0}, "red4"},
{{255, 20, 147, 0}, "DeepPink1"},
{{238, 18, 137, 0}, "DeepPink2"},
{{205, 16, 118, 0}, "DeepPink3"},
{{139, 10, 80, 0}, "DeepPink4"},
{{255, 110, 180, 0}, "HotPink1"},
{{238, 106, 167, 0}, "HotPink2"},
{{205, 96, 144, 0}, "HotPink3"},
{{139, 58, 98, 0}, "HotPink4"},
{{255, 181, 197, 0}, "pink1"},
{{238, 169, 184, 0}, "pink2"},
{{205, 145, 158, 0}, "pink3"},
{{139, 99, 108, 0}, "pink4"},
{{255, 174, 185, 0}, "LightPink1"},
{{238, 162, 173, 0}, "LightPink2"},
{{205, 140, 149, 0}, "LightPink3"},
{{139, 95, 101, 0}, "LightPink4"},
{{255, 130, 171, 0}, "PaleVioletRed1"},
{{238, 121, 159, 0}, "PaleVioletRed2"},
{{205, 104, 137, 0}, "PaleVioletRed3"},
{{139, 71, 93, 0}, "PaleVioletRed4"},
{{255, 52, 179, 0}, "maroon1"},
{{238, 48, 167, 0}, "maroon2"},
{{205, 41, 144, 0}, "maroon3"},
{{139, 28, 98, 0}, "maroon4"},
{{255, 62, 150, 0}, "VioletRed1"},
{{238, 58, 140, 0}, "VioletRed2"},
{{205, 50, 120, 0}, "VioletRed3"},
{{139, 34, 82, 0}, "VioletRed4"},
{{255, 0, 255, 0}, "magenta1"},
{{238, 0, 238, 0}, "magenta2"},
{{205, 0, 205, 0}, "magenta3"},
{{139, 0, 139, 0}, "magenta4"},
{{255, 131, 250, 0}, "orchid1"},
{{238, 122, 233, 0}, "orchid2"},
{{205, 105, 201, 0}, "orchid3"},
{{139, 71, 137, 0}, "orchid4"},
{{255, 187, 255, 0}, "plum1"},
{{238, 174, 238, 0}, "plum2"},
{{205, 150, 205, 0}, "plum3"},
{{139, 102, 139, 0}, "plum4"},
{{224, 102, 255, 0}, "MediumOrchid1"},
{{209, 95, 238, 0}, "MediumOrchid2"},
{{180, 82, 205, 0}, "MediumOrchid3"},
{{122, 55, 139, 0}, "MediumOrchid4"},
{{191, 62, 255, 0}, "DarkOrchid1"},
{{178, 58, 238, 0}, "DarkOrchid2"},
{{154, 50, 205, 0}, "DarkOrchid3"},
{{104, 34, 139, 0}, "DarkOrchid4"},
{{155, 48, 255, 0}, "purple1"},
{{145, 44, 238, 0}, "purple2"},
{{125, 38, 205, 0}, "purple3"},
{{ 85, 26, 139, 0}, "purple4"},
{{171, 130, 255, 0}, "MediumPurple1"},
{{159, 121, 238, 0}, "MediumPurple2"},
{{137, 104, 205, 0}, "MediumPurple3"},
{{ 93, 71, 139, 0}, "MediumPurple4"},
{{255, 225, 255, 0}, "thistle1"},
{{238, 210, 238, 0}, "thistle2"},
{{205, 181, 205, 0}, "thistle3"},
{{139, 123, 139, 0}, "thistle4"},
{{ 0, 0, 0, 0}, "gray0"},
{{ 0, 0, 0, 0}, "grey0"},
{{ 3, 3, 3, 0}, "gray1"},
{{ 3, 3, 3, 0}, "grey1"},
{{ 5, 5, 5, 0}, "gray2"},
{{ 5, 5, 5, 0}, "grey2"},
{{ 8, 8, 8, 0}, "gray3"},
{{ 8, 8, 8, 0}, "grey3"},
{{ 10, 10, 10, 0}, "gray4"},
{{ 10, 10, 10, 0}, "grey4"},
{{ 13, 13, 13, 0}, "gray5"},
{{ 13, 13, 13, 0}, "grey5"},
{{ 15, 15, 15, 0}, "gray6"},
{{ 15, 15, 15, 0}, "grey6"},
{{ 18, 18, 18, 0}, "gray7"},
{{ 18, 18, 18, 0}, "grey7"},
{{ 20, 20, 20, 0}, "gray8"},
{{ 20, 20, 20, 0}, "grey8"},
{{ 23, 23, 23, 0}, "gray9"},
{{ 23, 23, 23, 0}, "grey9"},
{{ 26, 26, 26, 0}, "gray10"},
{{ 26, 26, 26, 0}, "grey10"},
{{ 28, 28, 28, 0}, "gray11"},
{{ 28, 28, 28, 0}, "grey11"},
{{ 31, 31, 31, 0}, "gray12"},
{{ 31, 31, 31, 0}, "grey12"},
{{ 33, 33, 33, 0}, "gray13"},
{{ 33, 33, 33, 0}, "grey13"},
{{ 36, 36, 36, 0}, "gray14"},
{{ 36, 36, 36, 0}, "grey14"},
{{ 38, 38, 38, 0}, "gray15"},
{{ 38, 38, 38, 0}, "grey15"},
{{ 41, 41, 41, 0}, "gray16"},
{{ 41, 41, 41, 0}, "grey16"},
{{ 43, 43, 43, 0}, "gray17"},
{{ 43, 43, 43, 0}, "grey17"},
{{ 46, 46, 46, 0}, "gray18"},
{{ 46, 46, 46, 0}, "grey18"},
{{ 48, 48, 48, 0}, "gray19"},
{{ 48, 48, 48, 0}, "grey19"},
{{ 51, 51, 51, 0}, "gray20"},
{{ 51, 51, 51, 0}, "grey20"},
{{ 54, 54, 54, 0}, "gray21"},
{{ 54, 54, 54, 0}, "grey21"},
{{ 56, 56, 56, 0}, "gray22"},
{{ 56, 56, 56, 0}, "grey22"},
{{ 59, 59, 59, 0}, "gray23"},
{{ 59, 59, 59, 0}, "grey23"},
{{ 61, 61, 61, 0}, "gray24"},
{{ 61, 61, 61, 0}, "grey24"},
{{ 64, 64, 64, 0}, "gray25"},
{{ 64, 64, 64, 0}, "grey25"},
{{ 66, 66, 66, 0}, "gray26"},
{{ 66, 66, 66, 0}, "grey26"},
{{ 69, 69, 69, 0}, "gray27"},
{{ 69, 69, 69, 0}, "grey27"},
{{ 71, 71, 71, 0}, "gray28"},
{{ 71, 71, 71, 0}, "grey28"},
{{ 74, 74, 74, 0}, "gray29"},
{{ 74, 74, 74, 0}, "grey29"},
{{ 77, 77, 77, 0}, "gray30"},
{{ 77, 77, 77, 0}, "grey30"},
{{ 79, 79, 79, 0}, "gray31"},
{{ 79, 79, 79, 0}, "grey31"},
{{ 82, 82, 82, 0}, "gray32"},
{{ 82, 82, 82, 0}, "grey32"},
{{ 84, 84, 84, 0}, "gray33"},
{{ 84, 84, 84, 0}, "grey33"},
{{ 87, 87, 87, 0}, "gray34"},
{{ 87, 87, 87, 0}, "grey34"},
{{ 89, 89, 89, 0}, "gray35"},
{{ 89, 89, 89, 0}, "grey35"},
{{ 92, 92, 92, 0}, "gray36"},
{{ 92, 92, 92, 0}, "grey36"},
{{ 94, 94, 94, 0}, "gray37"},
{{ 94, 94, 94, 0}, "grey37"},
{{ 97, 97, 97, 0}, "gray38"},
{{ 97, 97, 97, 0}, "grey38"},
{{ 99, 99, 99, 0}, "gray39"},
{{ 99, 99, 99, 0}, "grey39"},
{{102, 102, 102, 0}, "gray40"},
{{102, 102, 102, 0}, "grey40"},
{{105, 105, 105, 0}, "gray41"},
{{105, 105, 105, 0}, "grey41"},
{{107, 107, 107, 0}, "gray42"},
{{107, 107, 107, 0}, "grey42"},
{{110, 110, 110, 0}, "gray43"},
{{110, 110, 110, 0}, "grey43"},
{{112, 112, 112, 0}, "gray44"},
{{112, 112, 112, 0}, "grey44"},
{{115, 115, 115, 0}, "gray45"},
{{115, 115, 115, 0}, "grey45"},
{{117, 117, 117, 0}, "gray46"},
{{117, 117, 117, 0}, "grey46"},
{{120, 120, 120, 0}, "gray47"},
{{120, 120, 120, 0}, "grey47"},
{{122, 122, 122, 0}, "gray48"},
{{122, 122, 122, 0}, "grey48"},
{{125, 125, 125, 0}, "gray49"},
{{125, 125, 125, 0}, "grey49"},
{{127, 127, 127, 0}, "gray50"},
{{127, 127, 127, 0}, "grey50"},
{{130, 130, 130, 0}, "gray51"},
{{130, 130, 130, 0}, "grey51"},
{{133, 133, 133, 0}, "gray52"},
{{133, 133, 133, 0}, "grey52"},
{{135, 135, 135, 0}, "gray53"},
{{135, 135, 135, 0}, "grey53"},
{{138, 138, 138, 0}, "gray54"},
{{138, 138, 138, 0}, "grey54"},
{{140, 140, 140, 0}, "gray55"},
{{140, 140, 140, 0}, "grey55"},
{{143, 143, 143, 0}, "gray56"},
{{143, 143, 143, 0}, "grey56"},
{{145, 145, 145, 0}, "gray57"},
{{145, 145, 145, 0}, "grey57"},
{{148, 148, 148, 0}, "gray58"},
{{148, 148, 148, 0}, "grey58"},
{{150, 150, 150, 0}, "gray59"},
{{150, 150, 150, 0}, "grey59"},
{{153, 153, 153, 0}, "gray60"},
{{153, 153, 153, 0}, "grey60"},
{{156, 156, 156, 0}, "gray61"},
{{156, 156, 156, 0}, "grey61"},
{{158, 158, 158, 0}, "gray62"},
{{158, 158, 158, 0}, "grey62"},
{{161, 161, 161, 0}, "gray63"},
{{161, 161, 161, 0}, "grey63"},
{{163, 163, 163, 0}, "gray64"},
{{163, 163, 163, 0}, "grey64"},
{{166, 166, 166, 0}, "gray65"},
{{166, 166, 166, 0}, "grey65"},
{{168, 168, 168, 0}, "gray66"},
{{168, 168, 168, 0}, "grey66"},
{{171, 171, 171, 0}, "gray67"},
{{171, 171, 171, 0}, "grey67"},
{{173, 173, 173, 0}, "gray68"},
{{173, 173, 173, 0}, "grey68"},
{{176, 176, 176, 0}, "gray69"},
{{176, 176, 176, 0}, "grey69"},
{{179, 179, 179, 0}, "gray70"},
{{179, 179, 179, 0}, "grey70"},
{{181, 181, 181, 0}, "gray71"},
{{181, 181, 181, 0}, "grey71"},
{{184, 184, 184, 0}, "gray72"},
{{184, 184, 184, 0}, "grey72"},
{{186, 186, 186, 0}, "gray73"},
{{186, 186, 186, 0}, "grey73"},
{{189, 189, 189, 0}, "gray74"},
{{189, 189, 189, 0}, "grey74"},
{{191, 191, 191, 0}, "gray75"},
{{191, 191, 191, 0}, "grey75"},
{{194, 194, 194, 0}, "gray76"},
{{194, 194, 194, 0}, "grey76"},
{{196, 196, 196, 0}, "gray77"},
{{196, 196, 196, 0}, "grey77"},
{{199, 199, 199, 0}, "gray78"},
{{199, 199, 199, 0}, "grey78"},
{{201, 201, 201, 0}, "gray79"},
{{201, 201, 201, 0}, "grey79"},
{{204, 204, 204, 0}, "gray80"},
{{204, 204, 204, 0}, "grey80"},
{{207, 207, 207, 0}, "gray81"},
{{207, 207, 207, 0}, "grey81"},
{{209, 209, 209, 0}, "gray82"},
{{209, 209, 209, 0}, "grey82"},
{{212, 212, 212, 0}, "gray83"},
{{212, 212, 212, 0}, "grey83"},
{{214, 214, 214, 0}, "gray84"},
{{214, 214, 214, 0}, "grey84"},
{{217, 217, 217, 0}, "gray85"},
{{217, 217, 217, 0}, "grey85"},
{{219, 219, 219, 0}, "gray86"},
{{219, 219, 219, 0}, "grey86"},
{{222, 222, 222, 0}, "gray87"},
{{222, 222, 222, 0}, "grey87"},
{{224, 224, 224, 0}, "gray88"},
{{224, 224, 224, 0}, "grey88"},
{{227, 227, 227, 0}, "gray89"},
{{227, 227, 227, 0}, "grey89"},
{{229, 229, 229, 0}, "gray90"},
{{229, 229, 229, 0}, "grey90"},
{{232, 232, 232, 0}, "gray91"},
{{232, 232, 232, 0}, "grey91"},
{{235, 235, 235, 0}, "gray92"},
{{235, 235, 235, 0}, "grey92"},
{{237, 237, 237, 0}, "gray93"},
{{237, 237, 237, 0}, "grey93"},
{{240, 240, 240, 0}, "gray94"},
{{240, 240, 240, 0}, "grey94"},
{{242, 242, 242, 0}, "gray95"},
{{242, 242, 242, 0}, "grey95"},
{{245, 245, 245, 0}, "gray96"},
{{245, 245, 245, 0}, "grey96"},
{{247, 247, 247, 0}, "gray97"},
{{247, 247, 247, 0}, "grey97"},
{{250, 250, 250, 0}, "gray98"},
{{250, 250, 250, 0}, "grey98"},
{{252, 252, 252, 0}, "gray99"},
{{252, 252, 252, 0}, "grey99"},
{{255, 255, 255, 0}, "gray100"},
{{255, 255, 255, 0}, "grey100"},
{{169, 169, 169, 0}, "dark"},
{{169, 169, 169, 0}, "DarkGrey"},
{{169, 169, 169, 0}, "dark"},
{{169, 169, 169, 0}, "DarkGray"},
{{ 0, 0, 139, 0}, "dark"},
{{ 0, 0, 139, 0}, "DarkBlue"},
{{ 0, 139, 139, 0}, "dark"},
{{ 0, 139, 139, 0}, "DarkCyan"},
{{139, 0, 139, 0}, "dark"},
{{139, 0, 139, 0}, "DarkMagenta"},
{{139, 0, 0, 0}, "dark"},
{{139, 0, 0, 0}, "DarkRed"},
{{144, 238, 144, 0}, "light"},
{{144, 238, 144, 0}, "LightGreen"},
{{ 0, 0, 0, 0}, NULL}
};
#endif

View File

@@ -1,5 +1,4 @@
#include <stdlib.h>
#include <X11/Xatom.h>
@@ -8,436 +7,383 @@
#define MAX_PROPERTY_SIZE 8*1024
char *WMSelectionOwnerDidChangeNotification = "WMSelectionOwnerDidChange";
typedef struct SelectionHandler {
WMView *view;
Atom selection;
Time timestamp;
WMSelectionProcs procs;
void *data;
WMView *view;
Atom selection;
Time timestamp;
WMSelectionProcs procs;
void *data;
struct {
unsigned delete_pending:1;
unsigned done_pending:1;
} flags;
struct {
unsigned delete_pending:1;
unsigned done_pending:1;
} flags;
} SelectionHandler;
typedef struct SelectionCallback {
WMView *view;
Atom selection;
Atom target;
Time timestamp;
WMSelectionCallback *callback;
void *data;
WMView *view;
Atom selection;
Atom target;
Time timestamp;
WMSelectionCallback *callback;
void *data;
struct {
unsigned delete_pending:1;
unsigned done_pending:1;
} flags;
struct {
unsigned delete_pending:1;
unsigned done_pending:1;
} flags;
} SelectionCallback;
static WMArray *selCallbacks = NULL;
static WMArray *selHandlers = NULL;
static Bool gotXError = False;
void
WMDeleteSelectionHandler(WMView *view, Atom selection, Time timestamp)
void WMDeleteSelectionHandler(WMView * view, Atom selection, Time timestamp)
{
SelectionHandler *handler;
Display *dpy = W_VIEW_SCREEN(view)->display;
Window win = W_VIEW_DRAWABLE(view);
WMArrayIterator iter;
SelectionHandler *handler;
Display *dpy = W_VIEW_SCREEN(view)->display;
Window win = W_VIEW_DRAWABLE(view);
WMArrayIterator iter;
if (!selHandlers)
return;
if (!selHandlers)
return;
/*//printf("deleting selection handler for %d", win);*/
/*//printf("deleting selection handler for %d", win); */
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
if (handler->view == view
&& (handler->selection == selection || selection == None)
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
if (handler->view == view && (handler->selection == selection || selection == None)
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
if (handler->flags.done_pending) {
handler->flags.delete_pending = 1;
/*//puts(": postponed because still pending");*/
return;
}
/*//printf(": found & removed");*/
WMRemoveFromArray(selHandlers, handler);
break;
}
}
if (handler->flags.done_pending) {
handler->flags.delete_pending = 1;
/*//puts(": postponed because still pending"); */
return;
}
/*//printf(": found & removed"); */
WMRemoveFromArray(selHandlers, handler);
break;
}
}
/*//printf("\n");*/
/*//printf("\n"); */
XGrabServer(dpy);
if (XGetSelectionOwner(dpy, selection) == win) {
XSetSelectionOwner(dpy, selection, None, timestamp);
}
XUngrabServer(dpy);
XGrabServer(dpy);
if (XGetSelectionOwner(dpy, selection) == win) {
XSetSelectionOwner(dpy, selection, None, timestamp);
}
XUngrabServer(dpy);
}
void
WMDeleteSelectionCallback(WMView *view, Atom selection, Time timestamp)
void WMDeleteSelectionCallback(WMView * view, Atom selection, Time timestamp)
{
SelectionCallback *handler;
WMArrayIterator iter;
SelectionCallback *handler;
WMArrayIterator iter;
if (!selCallbacks)
return;
if (!selCallbacks)
return;
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
if (handler->view == view
&& (handler->selection == selection || selection == None)
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
if (handler->view == view && (handler->selection == selection || selection == None)
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
if (handler->flags.done_pending) {
handler->flags.delete_pending = 1;
return;
}
WMRemoveFromArray(selCallbacks, handler);
break;
}
}
if (handler->flags.done_pending) {
handler->flags.delete_pending = 1;
return;
}
WMRemoveFromArray(selCallbacks, handler);
break;
}
}
}
static int
handleXError(Display *dpy, XErrorEvent *ev)
static int handleXError(Display * dpy, XErrorEvent * ev)
{
gotXError = True;
gotXError = True;
return 1;
return 1;
}
static Bool
writeSelection(Display *dpy, Window requestor, Atom property, Atom type,
WMData *data)
static Bool writeSelection(Display * dpy, Window requestor, Atom property, Atom type, WMData * data)
{
static void *oldHandler;
int format, bpi;
static void *oldHandler;
int format, bpi;
format = WMGetDataFormat(data);
if (format == 0)
format = 8;
format = WMGetDataFormat(data);
if (format == 0)
format = 8;
bpi = format/8;
bpi = format / 8;
/* printf("write to %x: %s\n", requestor, XGetAtomName(dpy, property)); */
/* printf("write to %x: %s\n", requestor, XGetAtomName(dpy, property)); */
oldHandler = XSetErrorHandler(handleXError);
oldHandler = XSetErrorHandler(handleXError);
gotXError = False;
gotXError = False;
XChangeProperty(dpy, requestor, property, type, format, PropModeReplace,
WMDataBytes(data), WMGetDataLength(data)/bpi);
XChangeProperty(dpy, requestor, property, type, format, PropModeReplace,
WMDataBytes(data), WMGetDataLength(data) / bpi);
XFlush(dpy);
XFlush(dpy);
XSetErrorHandler(oldHandler);
XSetErrorHandler(oldHandler);
return !gotXError;
return !gotXError;
}
static void
notifySelection(XEvent *event, Atom prop)
static void notifySelection(XEvent * event, Atom prop)
{
XEvent ev;
XEvent ev;
/* printf("event to %x\n", event->xselectionrequest.requestor); */
/* printf("event to %x\n", event->xselectionrequest.requestor); */
ev.xselection.type = SelectionNotify;
ev.xselection.serial = 0;
ev.xselection.send_event = True;
ev.xselection.display = event->xselectionrequest.display;
ev.xselection.requestor = event->xselectionrequest.requestor;
ev.xselection.target = event->xselectionrequest.target;
ev.xselection.selection = event->xselectionrequest.selection;
ev.xselection.property = prop;
ev.xselection.time = event->xselectionrequest.time;
ev.xselection.type = SelectionNotify;
ev.xselection.serial = 0;
ev.xselection.send_event = True;
ev.xselection.display = event->xselectionrequest.display;
ev.xselection.requestor = event->xselectionrequest.requestor;
ev.xselection.target = event->xselectionrequest.target;
ev.xselection.selection = event->xselectionrequest.selection;
ev.xselection.property = prop;
ev.xselection.time = event->xselectionrequest.time;
XSendEvent(event->xany.display, event->xselectionrequest.requestor,
False, 0, &ev);
XFlush(event->xany.display);
XSendEvent(event->xany.display, event->xselectionrequest.requestor, False, 0, &ev);
XFlush(event->xany.display);
}
static void
handleRequestEvent(XEvent *event)
static void handleRequestEvent(XEvent * event)
{
SelectionHandler *handler;
WMArrayIterator iter;
WMArray *copy;
Bool handledRequest;
SelectionHandler *handler;
WMArrayIterator iter;
WMArray *copy;
Bool handledRequest;
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
switch (event->type) {
case SelectionClear:
if (W_VIEW_DRAWABLE(handler->view)
!= event->xselectionclear.window) {
break;
}
switch (event->type) {
case SelectionClear:
if (W_VIEW_DRAWABLE(handler->view)
!= event->xselectionclear.window) {
break;
}
handler->flags.done_pending = 1;
if (handler->procs.selectionLost)
handler->procs.selectionLost(handler->view,
handler->selection,
handler->data);
handler->flags.done_pending = 0;
handler->flags.delete_pending = 1;
break;
handler->flags.done_pending = 1;
if (handler->procs.selectionLost)
handler->procs.selectionLost(handler->view, handler->selection, handler->data);
handler->flags.done_pending = 0;
handler->flags.delete_pending = 1;
break;
case SelectionRequest:
if (W_VIEW_DRAWABLE(handler->view)!=event->xselectionrequest.owner) {
break;
}
case SelectionRequest:
if (W_VIEW_DRAWABLE(handler->view) != event->xselectionrequest.owner) {
break;
}
if (handler->procs.convertSelection != NULL
&& handler->selection == event->xselectionrequest.selection) {
Atom atom;
WMData *data;
Atom prop;
if (handler->procs.convertSelection != NULL
&& handler->selection == event->xselectionrequest.selection) {
Atom atom;
WMData *data;
Atom prop;
/* they're requesting for something old.. maybe another handler
* can handle it */
if (event->xselectionrequest.time < handler->timestamp
&& event->xselectionrequest.time != CurrentTime) {
break;
}
/* they're requesting for something old.. maybe another handler
* can handle it */
if (event->xselectionrequest.time < handler->timestamp
&& event->xselectionrequest.time != CurrentTime) {
break;
}
handledRequest = False;
handledRequest = False;
handler->flags.done_pending = 1;
handler->flags.done_pending = 1;
data = handler->procs.convertSelection(handler->view,
handler->selection,
event->xselectionrequest.target,
handler->data,
&atom);
data = handler->procs.convertSelection(handler->view,
handler->selection,
event->xselectionrequest.target,
handler->data, &atom);
prop = event->xselectionrequest.property;
/* obsolete clients that don't set the property field */
if (prop == None)
prop = event->xselectionrequest.target;
prop = event->xselectionrequest.property;
/* obsolete clients that don't set the property field */
if (prop == None)
prop = event->xselectionrequest.target;
if (data) {
if (writeSelection(event->xselectionrequest.display,
event->xselectionrequest.requestor,
prop, atom, data)) {
handledRequest = True;
}
WMReleaseData(data);
}
if (data) {
if (writeSelection(event->xselectionrequest.display,
event->xselectionrequest.requestor, prop, atom, data)) {
handledRequest = True;
}
WMReleaseData(data);
}
notifySelection(event, (handledRequest==True ? prop : None));
notifySelection(event, (handledRequest == True ? prop : None));
if (handler->procs.selectionDone != NULL) {
handler->procs.selectionDone(handler->view,
handler->selection,
event->xselectionrequest.target,
handler->data);
}
if (handler->procs.selectionDone != NULL) {
handler->procs.selectionDone(handler->view,
handler->selection,
event->xselectionrequest.target,
handler->data);
}
handler->flags.done_pending = 0;
}
break;
}
}
handler->flags.done_pending = 0;
}
break;
}
}
/* delete handlers */
copy = WMDuplicateArray(selHandlers);
WM_ITERATE_ARRAY(copy, handler, iter) {
if (handler && handler->flags.delete_pending) {
WMDeleteSelectionHandler(handler->view, handler->selection,
handler->timestamp);
}
}
WMFreeArray(copy);
/* delete handlers */
copy = WMDuplicateArray(selHandlers);
WM_ITERATE_ARRAY(copy, handler, iter) {
if (handler && handler->flags.delete_pending) {
WMDeleteSelectionHandler(handler->view, handler->selection, handler->timestamp);
}
}
WMFreeArray(copy);
}
static WMData*
getSelectionData(Display *dpy, Window win, Atom where)
static WMData *getSelectionData(Display * dpy, Window win, Atom where)
{
WMData *wdata;
unsigned char *data;
Atom rtype;
unsigned bits, bpi;
unsigned long len, bytes;
WMData *wdata;
unsigned char *data;
Atom rtype;
int bits, bpi;
unsigned long len, bytes;
if (XGetWindowProperty(dpy, win, where, 0, MAX_PROPERTY_SIZE,
False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) != Success) {
return NULL;
}
if (XGetWindowProperty(dpy, win, where, 0, MAX_PROPERTY_SIZE,
False, AnyPropertyType, &rtype, &bits, &len,
&bytes, &data)!=Success) {
return NULL;
}
bpi = bits / 8;
bpi = bits/8;
wdata = WMCreateDataWithBytesNoCopy(data, len * bpi, (WMFreeDataProc *) XFree);
WMSetDataFormat(wdata, bits);
wdata = WMCreateDataWithBytesNoCopy(data, len*bpi, (WMFreeDataProc*)XFree);
WMSetDataFormat(wdata, bits);
return wdata;
return wdata;
}
static void
handleNotifyEvent(XEvent *event)
static void handleNotifyEvent(XEvent * event)
{
SelectionCallback *handler;
WMArrayIterator iter;
WMArray *copy;
WMData *data;
SelectionCallback *handler;
WMArrayIterator iter;
WMArray *copy;
WMData *data;
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
if (W_VIEW_DRAWABLE(handler->view) != event->xselection.requestor
|| handler->selection != event->xselection.selection) {
continue;
}
handler->flags.done_pending = 1;
if (W_VIEW_DRAWABLE(handler->view) != event->xselection.requestor
|| handler->selection != event->xselection.selection) {
continue;
}
handler->flags.done_pending = 1;
if (event->xselection.property == None) {
data = NULL;
} else {
data = getSelectionData(event->xselection.display,
event->xselection.requestor,
event->xselection.property);
}
if (event->xselection.property == None) {
data = NULL;
} else {
data = getSelectionData(event->xselection.display,
event->xselection.requestor, event->xselection.property);
}
(*handler->callback)(handler->view, handler->selection,
handler->target, handler->timestamp,
handler->data, data);
(*handler->callback) (handler->view, handler->selection,
handler->target, handler->timestamp, handler->data, data);
if (data != NULL) {
WMReleaseData(data);
}
handler->flags.done_pending = 0;
handler->flags.delete_pending = 1;
}
if (data != NULL) {
WMReleaseData(data);
}
handler->flags.done_pending = 0;
handler->flags.delete_pending = 1;
}
/* delete callbacks */
copy = WMDuplicateArray(selCallbacks);
WM_ITERATE_ARRAY(copy, handler, iter) {
if (handler && handler->flags.delete_pending) {
WMDeleteSelectionCallback(handler->view, handler->selection,
handler->timestamp);
}
}
WMFreeArray(copy);
/* delete callbacks */
copy = WMDuplicateArray(selCallbacks);
WM_ITERATE_ARRAY(copy, handler, iter) {
if (handler && handler->flags.delete_pending) {
WMDeleteSelectionCallback(handler->view, handler->selection, handler->timestamp);
}
}
WMFreeArray(copy);
}
void
W_HandleSelectionEvent(XEvent *event)
void W_HandleSelectionEvent(XEvent * event)
{
/*//printf("%d received selection ", event->xany.window);*/
/*//switch(event->type) {
case SelectionNotify:
puts("notify"); break;
case SelectionRequest:
puts("request"); break;
case SelectionClear:
puts("clear"); break;
default:
puts("unknown"); break;
}*/
/*//printf("%d received selection ", event->xany.window); */
/*//switch(event->type) {
case SelectionNotify:
puts("notify"); break;
case SelectionRequest:
puts("request"); break;
case SelectionClear:
puts("clear"); break;
default:
puts("unknown"); break;
} */
if (event->type == SelectionNotify) {
handleNotifyEvent(event);
} else {
handleRequestEvent(event);
}
if (event->type == SelectionNotify) {
handleNotifyEvent(event);
} else {
handleRequestEvent(event);
}
}
Bool WMCreateSelectionHandler(WMView * view, Atom selection, Time timestamp, WMSelectionProcs * procs, void *cdata)
{
SelectionHandler *handler;
Display *dpy = W_VIEW_SCREEN(view)->display;
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
if (XGetSelectionOwner(dpy, selection) != W_VIEW_DRAWABLE(view)) {
return False;
}
WMPostNotificationName(WMSelectionOwnerDidChangeNotification, (void *)selection, (void *)view);
/*//printf("created selection handler for %d\n", W_VIEW_DRAWABLE(view)); */
handler = wmalloc(sizeof(SelectionHandler));
handler->view = view;
handler->selection = selection;
handler->timestamp = timestamp;
handler->procs = *procs;
handler->data = cdata;
memset(&handler->flags, 0, sizeof(handler->flags));
if (selHandlers == NULL) {
selHandlers = WMCreateArrayWithDestructor(4, wfree);
}
WMAddToArray(selHandlers, handler);
return True;
}
Bool
WMCreateSelectionHandler(WMView *view, Atom selection, Time timestamp,
WMSelectionProcs *procs, void *cdata)
WMRequestSelection(WMView * view, Atom selection, Atom target, Time timestamp,
WMSelectionCallback * callback, void *cdata)
{
SelectionHandler *handler;
Display *dpy = W_VIEW_SCREEN(view)->display;
SelectionCallback *handler;
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
if (XGetSelectionOwner(dpy, selection) != W_VIEW_DRAWABLE(view)) {
return False;
}
if (XGetSelectionOwner(W_VIEW_SCREEN(view)->display, selection) == None)
return False;
WMPostNotificationName(WMSelectionOwnerDidChangeNotification,
(void*)selection, (void*)view);
if (!XConvertSelection(W_VIEW_SCREEN(view)->display, selection, target,
W_VIEW_SCREEN(view)->clipboardAtom, W_VIEW_DRAWABLE(view), timestamp)) {
return False;
}
/*//printf("created selection handler for %d\n", W_VIEW_DRAWABLE(view));*/
handler = wmalloc(sizeof(SelectionCallback));
handler->view = view;
handler->selection = selection;
handler->target = target;
handler->timestamp = timestamp;
handler->callback = callback;
handler->data = cdata;
handler = wmalloc(sizeof(SelectionHandler));
if (selCallbacks == NULL) {
selCallbacks = WMCreateArrayWithDestructor(4, wfree);
}
handler->view = view;
handler->selection = selection;
handler->timestamp = timestamp;
handler->procs = *procs;
handler->data = cdata;
memset(&handler->flags, 0, sizeof(handler->flags));
WMAddToArray(selCallbacks, handler);
if (selHandlers == NULL) {
selHandlers = WMCreateArrayWithDestructor(4, wfree);
}
WMAddToArray(selHandlers, handler);
return True;
return True;
}
Bool
WMRequestSelection(WMView *view, Atom selection, Atom target, Time timestamp,
WMSelectionCallback *callback, void *cdata)
{
SelectionCallback *handler;
if (XGetSelectionOwner(W_VIEW_SCREEN(view)->display, selection) == None)
return False;
if (!XConvertSelection(W_VIEW_SCREEN(view)->display, selection, target,
W_VIEW_SCREEN(view)->clipboardAtom,
W_VIEW_DRAWABLE(view), timestamp)) {
return False;
}
handler = wmalloc(sizeof(SelectionCallback));
handler->view = view;
handler->selection = selection;
handler->target = target;
handler->timestamp = timestamp;
handler->callback = callback;
handler->data = cdata;
memset(&handler->flags, 0, sizeof(handler->flags));
if (selCallbacks == NULL) {
selCallbacks = WMCreateArrayWithDestructor(4, wfree);
}
WMAddToArray(selCallbacks, handler);
return True;
}

View File

@@ -1,938 +0,0 @@
/*
* Copyright Patrick Powell 1995
* This code is based on code written by Patrick Powell (papowell@astart.com)
* It may be used for any purpose as long as this notice remains intact
* on all source code distributions
*/
/**************************************************************
* Original:
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
* A bombproof version of doprnt (dopr) included.
* Sigh. This sort of thing is always nasty do deal with. Note that
* the version here does not include floating point...
*
* snprintf() is used instead of sprintf() as it does limit checks
* for string length. This covers a nasty loophole.
*
* The other functions are there to prevent NULL pointers from
* causing nast effects.
*
* More Recently:
* Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
* This was ugly. It is still ugly. I opted out of floating point
* numbers, but the formatter understands just about everything
* from the normal C string format, at least as far as I can tell from
* the Solaris 2.5 printf(3S) man page.
*
* Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
* Ok, added some minimal floating point support, which means this
* probably requires libm on most operating systems. Don't yet
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
* was pretty badly broken, it just wasn't being exercised in ways
* which showed it, so that's been fixed. Also, formated the code
* to mutt conventions, and removed dead code left over from the
* original. Also, there is now a builtin-test, just compile with:
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
* and run snprintf for results.
*
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
* The PGP code was using unsigned hexadecimal formats.
* Unfortunately, unsigned formats simply didn't work.
*
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
* The original code assumed that both snprintf() and vsnprintf() were
* missing. Some systems only have snprintf() but not vsnprintf(), so
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
*
* Andrew Tridgell (tridge@samba.org) Oct 1998
* fixed handling of %.0f
* added test for HAVE_LONG_DOUBLE
*
* tridge@samba.org, idra@samba.org, April 2001
* got rid of fcvt code (twas buggy and made testing harder)
* added C99 semantics
*
**************************************************************/
#ifndef NO_CONFIG_H /* for some tests */
#include "config.h"
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <sys/types.h>
#include <stdarg.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
#include <stdio.h>
/* make the compiler happy with an empty file */
void dummy_snprintf(void) {}
#else
#ifdef HAVE_LONG_DOUBLE
#define LDOUBLE long double
#else
#define LDOUBLE double
#endif
#ifdef HAVE_LONG_LONG
#define LLONG long long
#else
#define LLONG long
#endif
static size_t dopr(char *buffer, size_t maxlen, const char *format,
va_list args);
static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
char *value, int flags, int min, int max);
static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
long value, int base, int min, int max, int flags);
static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
LDOUBLE fvalue, int min, int max, int flags);
static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
/*
* dopr(): poor man's version of doprintf
*/
/* format read states */
#define DP_S_DEFAULT 0
#define DP_S_FLAGS 1
#define DP_S_MIN 2
#define DP_S_DOT 3
#define DP_S_MAX 4
#define DP_S_MOD 5
#define DP_S_CONV 6
#define DP_S_DONE 7
/* format flags - Bits */
#define DP_F_MINUS (1 << 0)
#define DP_F_PLUS (1 << 1)
#define DP_F_SPACE (1 << 2)
#define DP_F_NUM (1 << 3)
#define DP_F_ZERO (1 << 4)
#define DP_F_UP (1 << 5)
#define DP_F_UNSIGNED (1 << 6)
/* Conversion Flags */
#define DP_C_SHORT 1
#define DP_C_LONG 2
#define DP_C_LDOUBLE 3
#define DP_C_LLONG 4
#define char_to_int(p) ((p)- '0')
#ifndef MAX
#define MAX(p,q) (((p) >= (q)) ? (p) : (q))
#endif
static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args)
{
char ch;
LLONG value;
LDOUBLE fvalue;
char *strvalue;
int min;
int max;
int state;
int flags;
int cflags;
size_t currlen;
state = DP_S_DEFAULT;
currlen = flags = cflags = min = 0;
max = -1;
ch = *format++;
while (state != DP_S_DONE) {
if (ch == '\0')
state = DP_S_DONE;
switch(state) {
case DP_S_DEFAULT:
if (ch == '%')
state = DP_S_FLAGS;
else
dopr_outch (buffer, &currlen, maxlen, ch);
ch = *format++;
break;
case DP_S_FLAGS:
switch (ch) {
case '-':
flags |= DP_F_MINUS;
ch = *format++;
break;
case '+':
flags |= DP_F_PLUS;
ch = *format++;
break;
case ' ':
flags |= DP_F_SPACE;
ch = *format++;
break;
case '#':
flags |= DP_F_NUM;
ch = *format++;
break;
case '0':
flags |= DP_F_ZERO;
ch = *format++;
break;
default:
state = DP_S_MIN;
break;
}
break;
case DP_S_MIN:
if (isdigit((unsigned char)ch)) {
min = 10*min + char_to_int (ch);
ch = *format++;
} else if (ch == '*') {
min = va_arg (args, int);
ch = *format++;
state = DP_S_DOT;
} else {
state = DP_S_DOT;
}
break;
case DP_S_DOT:
if (ch == '.') {
state = DP_S_MAX;
ch = *format++;
} else {
state = DP_S_MOD;
}
break;
case DP_S_MAX:
if (isdigit((unsigned char)ch)) {
if (max < 0)
max = 0;
max = 10*max + char_to_int (ch);
ch = *format++;
} else if (ch == '*') {
max = va_arg (args, int);
ch = *format++;
state = DP_S_MOD;
} else {
state = DP_S_MOD;
}
break;
case DP_S_MOD:
switch (ch) {
case 'h':
cflags = DP_C_SHORT;
ch = *format++;
break;
case 'l':
cflags = DP_C_LONG;
ch = *format++;
if (ch == 'l') { /* It's a long long */
cflags = DP_C_LLONG;
ch = *format++;
}
break;
case 'L':
cflags = DP_C_LDOUBLE;
ch = *format++;
break;
default:
break;
}
state = DP_S_CONV;
break;
case DP_S_CONV:
switch (ch) {
case 'd':
case 'i':
if (cflags == DP_C_SHORT)
value = va_arg (args, int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
else if (cflags == DP_C_LLONG)
value = va_arg (args, LLONG);
else
value = va_arg (args, int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
break;
case 'o':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)
value = (long)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
break;
case 'u':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)
value = (LLONG)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
break;
case 'X':
flags |= DP_F_UP;
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
else if (cflags == DP_C_LLONG)
value = (LLONG)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
break;
case 'f':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
else
fvalue = va_arg (args, double);
/* um, floating point? */
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
break;
case 'E':
flags |= DP_F_UP;
case 'e':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
else
fvalue = va_arg (args, double);
break;
case 'G':
flags |= DP_F_UP;
case 'g':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
else
fvalue = va_arg (args, double);
break;
case 'c':
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
break;
case 's':
strvalue = va_arg (args, char *);
if (max == -1) {
max = strlen(strvalue);
}
if (min > 0 && max >= 0 && min > max) max = min;
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
break;
case 'p':
strvalue = va_arg (args, void *);
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
break;
case 'n':
if (cflags == DP_C_SHORT) {
short int *num;
num = va_arg (args, short int *);
*num = currlen;
} else if (cflags == DP_C_LONG) {
long int *num;
num = va_arg (args, long int *);
*num = (long int)currlen;
} else if (cflags == DP_C_LLONG) {
LLONG *num;
num = va_arg (args, LLONG *);
*num = (LLONG)currlen;
} else {
int *num;
num = va_arg (args, int *);
*num = currlen;
}
break;
case '%':
dopr_outch (buffer, &currlen, maxlen, ch);
break;
case 'w':
/* not supported yet, treat as next char */
ch = *format++;
break;
default:
/* Unknown, skip */
break;
}
ch = *format++;
state = DP_S_DEFAULT;
flags = cflags = min = 0;
max = -1;
break;
case DP_S_DONE:
break;
default:
/* hmm? */
break; /* some picky compilers need this */
}
}
if (maxlen != 0) {
if (currlen < maxlen - 1)
buffer[currlen] = '\0';
else if (maxlen > 0)
buffer[maxlen - 1] = '\0';
}
return currlen;
}
static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
char *value, int flags, int min, int max)
{
int padlen, strln; /* amount to pad */
int cnt = 0;
#ifdef DEBUG_SNPRINTF
printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value);
#endif
if (value == 0) {
value = "<NULL>";
}
for (strln = 0; value[strln]; ++strln); /* strlen */
padlen = min - strln;
if (padlen < 0)
padlen = 0;
if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justify */
while ((padlen > 0) && (cnt < max)) {
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
++cnt;
}
while (*value && (cnt < max)) {
dopr_outch (buffer, currlen, maxlen, *value++);
++cnt;
}
while ((padlen < 0) && (cnt < max)) {
dopr_outch (buffer, currlen, maxlen, ' ');
++padlen;
++cnt;
}
}
/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
long value, int base, int min, int max, int flags)
{
int signvalue = 0;
unsigned long uvalue;
char convert[20];
int place = 0;
int spadlen = 0; /* amount to space pad */
int zpadlen = 0; /* amount to zero pad */
int caps = 0;
if (max < 0)
max = 0;
uvalue = value;
if(!(flags & DP_F_UNSIGNED)) {
if( value < 0 ) {
signvalue = '-';
uvalue = -value;
} else {
if (flags & DP_F_PLUS) /* Do a sign (+/i) */
signvalue = '+';
else if (flags & DP_F_SPACE)
signvalue = ' ';
}
}
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
do {
convert[place++] =
(caps? "0123456789ABCDEF":"0123456789abcdef")
[uvalue % (unsigned)base ];
uvalue = (uvalue / (unsigned)base );
} while(uvalue && (place < 20));
if (place == 20) place--;
convert[place] = 0;
zpadlen = max - place;
spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
if (zpadlen < 0) zpadlen = 0;
if (spadlen < 0) spadlen = 0;
if (flags & DP_F_ZERO) {
zpadlen = MAX(zpadlen, spadlen);
spadlen = 0;
}
if (flags & DP_F_MINUS)
spadlen = -spadlen; /* Left Justifty */
#ifdef DEBUG_SNPRINTF
printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
zpadlen, spadlen, min, max, place);
#endif
/* Spaces */
while (spadlen > 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
--spadlen;
}
/* Sign */
if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
/* Zeros */
if (zpadlen > 0) {
while (zpadlen > 0) {
dopr_outch (buffer, currlen, maxlen, '0');
--zpadlen;
}
}
/* Digits */
while (place > 0)
dopr_outch (buffer, currlen, maxlen, convert[--place]);
/* Left Justified spaces */
while (spadlen < 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
++spadlen;
}
}
static LDOUBLE abs_val(LDOUBLE value)
{
LDOUBLE result = value;
if (value < 0)
result = -value;
return result;
}
static LDOUBLE POW10(int exp)
{
LDOUBLE result = 1;
while (exp) {
result *= 10;
exp--;
}
return result;
}
static LLONG ROUND(LDOUBLE value)
{
LLONG intpart;
intpart = (LLONG)value;
value = value - intpart;
if (value >= 0.5) intpart++;
return intpart;
}
/* a replacement for modf that doesn't need the math library. Should
be portable, but slow */
static double my_modf(double x0, double *iptr)
{
int i;
long l;
double x = x0;
double f = 1.0;
for (i=0;i<100;i++) {
l = (long)x;
if (l <= (x+1) && l >= (x-1)) break;
x *= 0.1;
f *= 10.0;
}
if (i == 100) {
/* yikes! the number is beyond what we can handle. What do we do? */
(*iptr) = 0;
return 0;
}
if (i != 0) {
double i2;
double ret;
ret = my_modf(x0-l*f, &i2);
(*iptr) = l*f + i2;
return ret;
}
(*iptr) = l;
return x - (*iptr);
}
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
LDOUBLE fvalue, int min, int max, int flags)
{
int signvalue = 0;
double ufvalue;
char iconvert[311];
char fconvert[311];
int iplace = 0;
int fplace = 0;
int padlen = 0; /* amount to pad */
int zpadlen = 0;
int caps = 0;
int index;
double intpart;
double fracpart;
double temp;
/*
* AIX manpage says the default is 0, but Solaris says the default
* is 6, and sprintf on AIX defaults to 6
*/
if (max < 0)
max = 6;
ufvalue = abs_val (fvalue);
if (fvalue < 0) {
signvalue = '-';
} else {
if (flags & DP_F_PLUS) { /* Do a sign (+/i) */
signvalue = '+';
} else {
if (flags & DP_F_SPACE)
signvalue = ' ';
}
}
#if 0
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
#endif
#if 0
if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
#endif
/*
* Sorry, we only support 16 digits past the decimal because of our
* conversion method
*/
if (max > 16)
max = 16;
/* We "cheat" by converting the fractional part to integer by
* multiplying by a factor of 10
*/
temp = ufvalue;
my_modf(temp, &intpart);
fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
if (fracpart >= POW10(max)) {
intpart++;
fracpart -= POW10(max);
}
/* Convert integer part */
do {
temp = intpart;
my_modf(intpart*0.1, &intpart);
temp = temp*0.1;
index = (int) ((temp -intpart +0.05)* 10.0);
/* index = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
/* printf ("%llf, %f, %x\n", temp, intpart, index); */
iconvert[iplace++] =
(caps? "0123456789ABCDEF":"0123456789abcdef")[index];
} while (intpart && (iplace < 311));
if (iplace == 311) iplace--;
iconvert[iplace] = 0;
/* Convert fractional part */
if (fracpart)
{
do {
temp = fracpart;
my_modf(fracpart*0.1, &fracpart);
temp = temp*0.1;
index = (int) ((temp -fracpart +0.05)* 10.0);
/* index = (int) ((((temp/10) -fracpart) +0.05) *10); */
/* printf ("%lf, %lf, %ld\n", temp, fracpart, index); */
fconvert[fplace++] =
(caps? "0123456789ABCDEF":"0123456789abcdef")[index];
} while(fracpart && (fplace < 311));
if (fplace == 311) fplace--;
}
fconvert[fplace] = 0;
/* -1 for decimal point, another -1 if we are printing a sign */
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
zpadlen = max - fplace;
if (zpadlen < 0) zpadlen = 0;
if (padlen < 0)
padlen = 0;
if (flags & DP_F_MINUS)
padlen = -padlen; /* Left Justifty */
if ((flags & DP_F_ZERO) && (padlen > 0)) {
if (signvalue) {
dopr_outch (buffer, currlen, maxlen, signvalue);
--padlen;
signvalue = 0;
}
while (padlen > 0) {
dopr_outch (buffer, currlen, maxlen, '0');
--padlen;
}
}
while (padlen > 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
--padlen;
}
if (signvalue)
dopr_outch (buffer, currlen, maxlen, signvalue);
while (iplace > 0)
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
#ifdef DEBUG_SNPRINTF
printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
#endif
/*
* Decimal point. This should probably use locale to find the correct
* char to print out.
*/
if (max > 0) {
dopr_outch (buffer, currlen, maxlen, '.');
while (fplace > 0)
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
}
while (zpadlen > 0) {
dopr_outch (buffer, currlen, maxlen, '0');
--zpadlen;
}
while (padlen < 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
++padlen;
}
}
static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
{
if (*currlen < maxlen) {
buffer[(*currlen)] = c;
}
(*currlen)++;
}
#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
{
return dopr(str, count, fmt, args);
}
#endif
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
int snprintf(char *str,size_t count,const char *fmt,...)
{
size_t ret;
va_list ap;
va_start(ap, fmt);
ret = vsnprintf(str, count, fmt, ap);
va_end(ap);
return ret;
}
#endif
#endif
#ifndef HAVE_VASPRINTF
int vasprintf(char **ptr, const char *format, va_list ap)
{
int ret;
ret = vsnprintf(NULL, 0, format, ap);
if (ret <= 0) return ret;
(*ptr) = (char *)malloc(ret+1);
if (!*ptr) return -1;
ret = vsnprintf(*ptr, ret+1, format, ap);
return ret;
}
#endif
#ifndef HAVE_ASPRINTF
int asprintf(char **ptr, const char *format, ...)
{
va_list ap;
int ret;
va_start(ap, format);
ret = vasprintf(ptr, format, ap);
va_end(ap);
return ret;
}
#endif
#ifdef TEST_SNPRINTF
int sprintf(char *str,const char *fmt,...);
int main (void)
{
char buf1[1024];
char buf2[1024];
char *fp_fmt[] = {
"%1.1f",
"%-1.5f",
"%1.5f",
"%123.9f",
"%10.5f",
"% 10.5f",
"%+22.9f",
"%+4.9f",
"%01.3f",
"%4f",
"%3.1f",
"%3.2f",
"%.0f",
"%f",
"-16.16f",
NULL
};
double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
0.9996, 1.996, 4.136, 0};
char *int_fmt[] = {
"%-1.5d",
"%1.5d",
"%123.9d",
"%5.5d",
"%10.5d",
"% 10.5d",
"%+22.33d",
"%01.3d",
"%4d",
"%d",
NULL
};
long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
char *str_fmt[] = {
"10.5s",
"5.10s",
"10.1s",
"0.10s",
"10.0s",
"1.10s",
"%s",
"%.1s",
"%.10s",
"%10s",
NULL
};
char *str_vals[] = {"hello", "a", "", "a longer string", NULL};
int x, y;
int fail = 0;
int num = 0;
printf ("Testing snprintf format codes against system sprintf...\n");
for (x = 0; fp_fmt[x] ; x++) {
for (y = 0; fp_nums[y] != 0 ; y++) {
int l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]);
int l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
sprintf (buf2, fp_fmt[x], fp_nums[y]);
if (strcmp (buf1, buf2)) {
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
fp_fmt[x], buf1, buf2);
fail++;
}
if (l1 != l2) {
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, fp_fmt[x]);
fail++;
}
num++;
}
}
for (x = 0; int_fmt[x] ; x++) {
for (y = 0; int_nums[y] != 0 ; y++) {
int l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]);
int l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
sprintf (buf2, int_fmt[x], int_nums[y]);
if (strcmp (buf1, buf2)) {
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
int_fmt[x], buf1, buf2);
fail++;
}
if (l1 != l2) {
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, int_fmt[x]);
fail++;
}
num++;
}
}
for (x = 0; str_fmt[x] ; x++) {
for (y = 0; str_vals[y] != 0 ; y++) {
int l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]);
int l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]);
sprintf (buf2, str_fmt[x], str_vals[y]);
if (strcmp (buf1, buf2)) {
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
str_fmt[x], buf1, buf2);
fail++;
}
if (l1 != l2) {
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, str_fmt[x]);
fail++;
}
num++;
}
}
printf ("%d tests failed out of %d.\n", fail, num);
printf("seeing how many digits we support\n");
{
double v0 = 0.12345678901234567890123456789012345678901;
for (x=0; x<100; x++) {
snprintf(buf1, sizeof(buf1), "%1.1f", v0*pow(10, x));
sprintf(buf2, "%1.1f", v0*pow(10, x));
if (strcmp(buf1, buf2)) {
printf("we seem to support %d digits\n", x-1);
break;
}
}
}
return 0;
}
#endif /* SNPRINTF_TEST */

View File

@@ -1,14 +1,22 @@
/*
* Until FreeBSD gets their act together;
* http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg69469.html
*/
#if defined( FREEBSD )
# undef _XOPEN_SOURCE
#endif
#include "wconfig.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef HAVE_BSD_STRING_H
#include <bsd/string.h>
#endif
#include "WUtil.h"
#define PRC_ALPHA 0
#define PRC_BLANK 1
#define PRC_ESCAPE 2
@@ -17,234 +25,403 @@
#define PRC_SQUOTE 5
typedef struct {
short nstate;
short output;
short nstate;
short output;
} DFA;
static DFA mtable[9][6] = {
{{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
{{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
{{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
{{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
{{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
{{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
{{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
{{3, 1}, {0, 0}, {4, 0}, {1, 0}, {8, 0}, {6, 0}},
{{1, 1}, {1, 1}, {2, 0}, {3, 0}, {5, 0}, {1, 1}},
{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {5, 0}, {1, 1}},
{{3, 1}, {5, 0}, {4, 0}, {1, 0}, {5, 0}, {6, 0}},
{{3, 1}, {3, 1}, {3, 1}, {3, 1}, {5, 0}, {3, 1}},
{{-1, -1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, /* final state */
{{6, 1}, {6, 1}, {7, 0}, {6, 1}, {5, 0}, {3, 0}},
{{6, 1}, {6, 1}, {6, 1}, {6, 1}, {5, 0}, {6, 1}},
{{-1, -1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, /* final state */
};
char*
wtokennext(char *word, char **next)
char *wtokennext(char *word, char **next)
{
char *ptr;
char *ret, *t;
int state, ctype;
char *ptr;
char *ret, *t;
int state, ctype;
t = ret = wmalloc(strlen(word)+1);
ptr = word;
t = ret = wmalloc(strlen(word) + 1);
ptr = word;
state = 0;
*t = 0;
while (1) {
if (*ptr==0)
ctype = PRC_EOS;
else if (*ptr=='\\')
ctype = PRC_ESCAPE;
else if (*ptr=='"')
ctype = PRC_DQUOTE;
else if (*ptr=='\'')
ctype = PRC_SQUOTE;
else if (*ptr==' ' || *ptr=='\t')
ctype = PRC_BLANK;
else
ctype = PRC_ALPHA;
state = 0;
while (1) {
if (*ptr == 0)
ctype = PRC_EOS;
else if (*ptr == '\\')
ctype = PRC_ESCAPE;
else if (*ptr == '"')
ctype = PRC_DQUOTE;
else if (*ptr == '\'')
ctype = PRC_SQUOTE;
else if (*ptr == ' ' || *ptr == '\t')
ctype = PRC_BLANK;
else
ctype = PRC_ALPHA;
if (mtable[state][ctype].output) {
*t = *ptr; t++;
*t = 0;
}
state = mtable[state][ctype].nstate;
ptr++;
if (mtable[state][0].output<0) {
break;
}
}
if (mtable[state][ctype].output) {
*t = *ptr;
t++;
*t = 0;
}
state = mtable[state][ctype].nstate;
ptr++;
if (mtable[state][0].output < 0) {
break;
}
}
if (*ret==0)
t = NULL;
else
t = wstrdup(ret);
if (*ret == 0)
t = NULL;
else
t = wstrdup(ret);
wfree(ret);
wfree(ret);
if (ctype==PRC_EOS)
*next = NULL;
else
*next = ptr;
if (ctype == PRC_EOS)
*next = NULL;
else
*next = ptr;
return t;
return t;
}
/* separate a string in tokens, taking " and ' into account */
void
wtokensplit(char *command, char ***argv, int *argc)
void wtokensplit(char *command, char ***argv, int *argc)
{
char *token, *line;
int count;
char *token, *line;
int count;
count = 0;
line = command;
do {
token = wtokennext(line, &line);
if (token) {
if (count == 0)
*argv = wmalloc(sizeof(char**));
else
*argv = wrealloc(*argv, (count+1)*sizeof(char**));
(*argv)[count++] = token;
}
} while (token!=NULL && line!=NULL);
count = 0;
line = command;
do {
token = wtokennext(line, &line);
if (token) {
if (count == 0)
*argv = wmalloc(sizeof(char **));
else
*argv = wrealloc(*argv, (count + 1) * sizeof(char **));
(*argv)[count++] = token;
}
} while (token != NULL && line != NULL);
*argc = count;
*argc = count;
}
char *wtokenjoin(char **list, int count)
{
int i, j;
char *flat_string, *wspace;
j = 0;
for (i = 0; i < count; i++) {
if (list[i] != NULL && list[i][0] != 0) {
j += strlen(list[i]);
if (strpbrk(list[i], " \t"))
j += 2;
}
}
flat_string = wmalloc(j + count + 1);
for (i = 0; i < count; i++) {
if (list[i] != NULL && list[i][0] != 0) {
if (i > 0 &&
wstrlcat(flat_string, " ", j + count + 1) >= j + count + 1)
goto error;
wspace = strpbrk(list[i], " \t");
if (wspace &&
wstrlcat(flat_string, "\"", j + count + 1) >= j + count + 1)
goto error;
if (wstrlcat(flat_string, list[i], j + count + 1) >= j + count + 1)
goto error;
if (wspace &&
wstrlcat(flat_string, "\"", j + count + 1) >= j + count + 1)
goto error;
}
}
return flat_string;
error:
wfree(flat_string);
return NULL;
}
void wtokenfree(char **tokens, int count)
{
while (count--)
wfree(tokens[count]);
wfree(tokens);
}
char *wtrimspace(const char *s)
{
char *t;
if (s == NULL)
return NULL;
while (isspace(*s) && *s)
s++;
t = (char *)s + strlen(s) - 1;
while (t > s && isspace(*t))
t--;
return wstrndup(s, t - s + 1);
}
char *wstrdup(const char *str)
{
assert(str != NULL);
return strcpy(wmalloc(strlen(str) + 1), str);
}
char *wstrndup(const char *str, size_t len)
{
char *copy;
assert(str != NULL);
len = WMIN(len, strlen(str));
copy = strncpy(wmalloc(len + 1), str, len);
copy[len] = 0;
return copy;
}
char *wstrconcat(char *str1, char *str2)
{
char *str;
size_t slen;
if (!str1)
return wstrdup(str2);
else if (!str2)
return wstrdup(str1);
slen = strlen(str1) + strlen(str2) + 1;
str = wmalloc(slen);
if (wstrlcpy(str, str1, slen) >= slen ||
wstrlcat(str, str2, slen) >= slen) {
wfree(str);
return NULL;
}
return str;
}
char *wstrappend(char *dst, char *src)
{
size_t slen;
if (!dst)
return wstrdup(src);
else if (!src || *src == 0)
return dst;
slen = strlen(dst) + strlen(src) + 1;
dst = wrealloc(dst, slen);
if (wstrlcat(dst, src, slen) >= slen)
return NULL;
return dst;
}
char*
wtokenjoin(char **list, int count)
#if HAVE_STRLCAT
size_t
wstrlcat(char *dst, const char *src, size_t siz)
{
int i, j;
char *flat_string, *wspace;
j = 0;
for (i=0; i<count; i++) {
if (list[i]!=NULL && list[i][0]!=0) {
j += strlen(list[i]);
if (strpbrk(list[i], " \t"))
j += 2;
}
}
flat_string = wmalloc(j+count+1);
*flat_string = 0;
for (i=0; i<count; i++) {
if (list[i]!=NULL && list[i][0]!=0) {
if (i>0)
strcat(flat_string, " ");
wspace = strpbrk(list[i], " \t");
if (wspace)
strcat(flat_string, "\"");
strcat(flat_string, list[i]);
if (wspace)
strcat(flat_string, "\"");
}
}
return flat_string;
return strlcat(dst, src, siz);
}
#else
/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void
wtokenfree(char **tokens, int count)
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred.
*/
size_t
wstrlcat(char *dst, const char *src, size_t siz)
{
while (--count) wfree(tokens[count]);
wfree(tokens);
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
#endif /* HAVE_STRLCAT */
char*
wtrimspace(char *s)
#if HAVE_STRLCPY
size_t
wstrlcpy(char *dst, const char *src, size_t siz)
{
char *t;
char *c;
while (isspace(*s) && *s) s++;
t = s+strlen(s)-1;
while (t > s && isspace(*t)) t--;
c = wmalloc(t-s+2);
memcpy(c, s, t-s+1);
c[t-s+1] = 0;
return c;
return strlcpy(dst, src, siz);
}
#else
/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
char*
wstrdup(char *str)
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
wstrlcpy(char *dst, const char *src, size_t siz)
{
assert(str!=NULL);
char *d = dst;
const char *s = src;
size_t n = siz;
return strcpy(wmalloc(strlen(str)+1), str);
/* Copy as many bytes as will fit */
if (n != 0) {
while (--n != 0) {
if ((*d++ = *s++) == '\0')
break;
}
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0) {
if (siz != 0)
*d = '\0'; /* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1); /* count does not include NUL */
}
#endif /* HAVE_STRLCPY */
char*
wstrndup(char *str, size_t len)
/* transform `s' so that the result is safe to pass to the shell as an argument.
* returns a newly allocated string.
* with very heavy inspirations from NetBSD's shquote(3).
*/
char *wshellquote(const char *s)
{
char *copy;
char *p, *r, *last, *ret;
size_t slen;
int needs_quoting;
assert(str!=NULL);
if (!s)
return NULL;
len = WMIN(len, strlen(str));
copy = strncpy(wmalloc(len+1), str, len);
copy[len] = 0;
needs_quoting = !*s; /* the empty string does need quoting */
return copy;
/* do not quote if consists only of the following characters */
for (p = (char *)s; *p && !needs_quoting; p++) {
needs_quoting = !(isalnum(*p) || (*p == '+') || (*p == '/') ||
(*p == '.') || (*p == ',') || (*p == '-'));
}
if (!needs_quoting)
return wstrdup(s);
for (slen = 0, p = (char *)s; *p; p++) /* count space needed (worst case) */
slen += *p == '\'' ? 4 : 1; /* every single ' becomes ''\' */
slen += 2 /* leading + trailing "'" */ + 1 /* NULL */;
ret = r = wmalloc(slen);
p = (char *)s;
last = p;
if (*p != '\'') /* if string doesn't already begin with "'" */
*r++ ='\''; /* start putting it in quotes */
while (*p) {
last = p;
if (*p == '\'') { /* turn each ' into ''\' */
if (p != s) /* except if it's the first ', in which case */
*r++ = '\''; /* only escape it */
*r++ = '\\';
*r++ = '\'';
while (*++p && *p == '\'') { /* keep turning each consecutive 's into \' */
*r++ = '\\';
*r++ = '\'';
}
if (*p) /* if more input follows, terminate */
*r++ = '\''; /* what we have so far */
} else {
*r++ = *p++;
}
}
if (*last != '\'') /* if the last one isn't already a ' */
*r++ = '\''; /* terminate the whole shebang */
*r = '\0';
return ret; /* technically, we lose (but not leak) a couple of */
/* bytes (twice the number of consecutive 's in the */
/* input or so), but since these are relatively rare */
/* and short-lived strings, not sure if a trip to */
/* wstrdup+wfree worths the gain. */
}
char*
wstrconcat(char *str1, char *str2)
{
char *str;
if (!str1)
return wstrdup(str2);
else if (!str2)
return wstrdup(str1);
str = wmalloc(strlen(str1)+strlen(str2)+1);
strcpy(str, str1);
strcat(str, str2);
return str;
}
char*
wstrappend(char *dst, char *src)
{
if (!dst)
return wstrdup(src);
else if (!src || *src==0)
return dst;
dst = wrealloc(dst, strlen(dst)+strlen(src)+1);
strcat(dst, src);
return dst;
}
#ifndef HAVE_STRCASECMP
int
strcasecmp(const char *s1, const char *s2)
{
while (*s1 && *s2 && (tolower(*s1)==tolower(*s2))) {
s1++;
s2++;
}
return (tolower(*s1) - tolower(*s2));
}
#endif

View File

@@ -1,279 +1,255 @@
#include <string.h>
#include "WUtil.h"
typedef struct W_TreeNode {
void *data;
void *data;
/*unsigned int uflags:16;*/
/*unsigned int uflags:16; */
WMArray *leaves;
WMArray *leaves;
int depth;
int depth;
struct W_TreeNode *parent;
struct W_TreeNode *parent;
WMFreeDataProc *destructor;
WMFreeDataProc *destructor;
} W_TreeNode;
void
destroyNode(void *data)
void destroyNode(void *data)
{
WMTreeNode *aNode = (WMTreeNode*) data;
WMTreeNode *aNode = (WMTreeNode *) data;
if (aNode->destructor) {
(*aNode->destructor)(aNode->data);
}
if (aNode->leaves) {
WMFreeArray(aNode->leaves);
}
wfree(aNode);
if (aNode->destructor) {
(*aNode->destructor) (aNode->data);
}
if (aNode->leaves) {
WMFreeArray(aNode->leaves);
}
wfree(aNode);
}
WMTreeNode*
WMCreateTreeNode(void *data)
WMTreeNode *WMCreateTreeNode(void *data)
{
return WMCreateTreeNodeWithDestructor(data, NULL);
return WMCreateTreeNodeWithDestructor(data, NULL);
}
WMTreeNode*
WMCreateTreeNodeWithDestructor(void *data, WMFreeDataProc *destructor)
WMTreeNode *WMCreateTreeNodeWithDestructor(void *data, WMFreeDataProc * destructor)
{
WMTreeNode *aNode;
WMTreeNode *aNode;
aNode = (WMTreeNode*) wmalloc(sizeof(W_TreeNode));
memset(aNode, 0, sizeof(W_TreeNode));
aNode = (WMTreeNode *) wmalloc(sizeof(W_TreeNode));
aNode->destructor = destructor;
aNode->data = data;
aNode->parent = NULL;
aNode->depth = 0;
aNode->leaves = NULL;
/*aNode->leaves = WMCreateArrayWithDestructor(1, destroyNode); */
aNode->destructor = destructor;
aNode->data = data;
aNode->parent = NULL;
aNode->depth = 0;
aNode->leaves = NULL;
/*aNode->leaves = WMCreateArrayWithDestructor(1, destroyNode);*/
return aNode;
return aNode;
}
WMTreeNode*
WMInsertItemInTree(WMTreeNode *parent, int index, void *item)
WMTreeNode *WMInsertItemInTree(WMTreeNode * parent, int index, void *item)
{
WMTreeNode *aNode;
WMTreeNode *aNode;
wassertrv(parent!=NULL, NULL);
wassertrv(parent != NULL, NULL);
aNode = WMCreateTreeNodeWithDestructor(item, parent->destructor);
aNode->parent = parent;
aNode->depth = parent->depth+1;
if (!parent->leaves) {
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
}
if (index < 0) {
WMAddToArray(parent->leaves, aNode);
} else {
WMInsertInArray(parent->leaves, index, aNode);
}
aNode = WMCreateTreeNodeWithDestructor(item, parent->destructor);
aNode->parent = parent;
aNode->depth = parent->depth + 1;
if (!parent->leaves) {
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
}
if (index < 0) {
WMAddToArray(parent->leaves, aNode);
} else {
WMInsertInArray(parent->leaves, index, aNode);
}
return aNode;
return aNode;
}
static void
updateNodeDepth(WMTreeNode *aNode, int depth)
static void updateNodeDepth(WMTreeNode * aNode, int depth)
{
int i;
int i;
aNode->depth = depth;
aNode->depth = depth;
if (aNode->leaves) {
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
updateNodeDepth(WMGetFromArray(aNode->leaves, i), depth+1);
}
}
if (aNode->leaves) {
for (i = 0; i < WMGetArrayItemCount(aNode->leaves); i++) {
updateNodeDepth(WMGetFromArray(aNode->leaves, i), depth + 1);
}
}
}
WMTreeNode*
WMInsertNodeInTree(WMTreeNode *parent, int index, WMTreeNode *aNode)
WMTreeNode *WMInsertNodeInTree(WMTreeNode * parent, int index, WMTreeNode * aNode)
{
wassertrv(parent!=NULL, NULL);
wassertrv(aNode!=NULL, NULL);
wassertrv(parent != NULL, NULL);
wassertrv(aNode != NULL, NULL);
aNode->parent = parent;
updateNodeDepth(aNode, parent->depth+1);
if (!parent->leaves) {
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
}
if (index < 0) {
WMAddToArray(parent->leaves, aNode);
} else {
WMInsertInArray(parent->leaves, index, aNode);
}
aNode->parent = parent;
updateNodeDepth(aNode, parent->depth + 1);
if (!parent->leaves) {
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
}
if (index < 0) {
WMAddToArray(parent->leaves, aNode);
} else {
WMInsertInArray(parent->leaves, index, aNode);
}
return aNode;
return aNode;
}
void
WMDestroyTreeNode(WMTreeNode *aNode)
void WMDestroyTreeNode(WMTreeNode * aNode)
{
wassertr(aNode!=NULL);
wassertr(aNode != NULL);
if (aNode->parent && aNode->parent->leaves) {
WMRemoveFromArray(aNode->parent->leaves, aNode);
} else {
destroyNode(aNode);
}
if (aNode->parent && aNode->parent->leaves) {
WMRemoveFromArray(aNode->parent->leaves, aNode);
} else {
destroyNode(aNode);
}
}
void
WMDeleteLeafForTreeNode(WMTreeNode *aNode, int index)
void WMDeleteLeafForTreeNode(WMTreeNode * aNode, int index)
{
wassertr(aNode!=NULL);
wassertr(aNode->leaves!=NULL);
wassertr(aNode != NULL);
wassertr(aNode->leaves != NULL);
WMDeleteFromArray(aNode->leaves, index);
WMDeleteFromArray(aNode->leaves, index);
}
static int
sameData(void *item, void *data)
static int sameData(const void *item, const void *data)
{
return (((WMTreeNode*)item)->data == data);
return (((WMTreeNode *) item)->data == data);
}
void
WMRemoveLeafForTreeNode(WMTreeNode *aNode, void *leaf)
void WMRemoveLeafForTreeNode(WMTreeNode * aNode, void *leaf)
{
int index;
int index;
wassertr(aNode!=NULL);
wassertr(aNode->leaves!=NULL);
wassertr(aNode != NULL);
wassertr(aNode->leaves != NULL);
index = WMFindInArray(aNode->leaves, sameData, leaf);
if (index != WANotFound) {
WMDeleteFromArray(aNode->leaves, index);
}
index = WMFindInArray(aNode->leaves, sameData, leaf);
if (index != WANotFound) {
WMDeleteFromArray(aNode->leaves, index);
}
}
void*
WMReplaceDataForTreeNode(WMTreeNode *aNode, void *newData)
void *WMReplaceDataForTreeNode(WMTreeNode * aNode, void *newData)
{
void *old;
void *old;
wassertrv(aNode!=NULL, NULL);
wassertrv(aNode != NULL, NULL);
old = aNode->data;
aNode->data = newData;
old = aNode->data;
aNode->data = newData;
return old;
return old;
}
void*
WMGetDataForTreeNode(WMTreeNode *aNode)
void *WMGetDataForTreeNode(WMTreeNode * aNode)
{
return aNode->data;
return aNode->data;
}
int
WMGetTreeNodeDepth(WMTreeNode *aNode)
int WMGetTreeNodeDepth(WMTreeNode * aNode)
{
return aNode->depth;
return aNode->depth;
}
WMTreeNode*
WMGetParentForTreeNode(WMTreeNode *aNode)
WMTreeNode *WMGetParentForTreeNode(WMTreeNode * aNode)
{
return aNode->parent;
return aNode->parent;
}
void
WMSortLeavesForTreeNode(WMTreeNode *aNode, WMCompareDataProc *comparer)
void WMSortLeavesForTreeNode(WMTreeNode * aNode, WMCompareDataProc * comparer)
{
wassertr(aNode!=NULL);
wassertr(aNode != NULL);
if (aNode->leaves) {
WMSortArray(aNode->leaves, comparer);
}
if (aNode->leaves) {
WMSortArray(aNode->leaves, comparer);
}
}
static void
sortLeavesForNode(WMTreeNode *aNode, WMCompareDataProc *comparer)
static void sortLeavesForNode(WMTreeNode * aNode, WMCompareDataProc * comparer)
{
int i;
int i;
if (!aNode->leaves)
return;
if (!aNode->leaves)
return;
WMSortArray(aNode->leaves, comparer);
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
sortLeavesForNode(WMGetFromArray(aNode->leaves, i), comparer);
}
WMSortArray(aNode->leaves, comparer);
for (i = 0; i < WMGetArrayItemCount(aNode->leaves); i++) {
sortLeavesForNode(WMGetFromArray(aNode->leaves, i), comparer);
}
}
void
WMSortTree(WMTreeNode *aNode, WMCompareDataProc *comparer)
void WMSortTree(WMTreeNode * aNode, WMCompareDataProc * comparer)
{
wassertr(aNode!=NULL);
wassertr(aNode != NULL);
sortLeavesForNode(aNode, comparer);
sortLeavesForNode(aNode, comparer);
}
static WMTreeNode*
findNodeInTree(WMTreeNode *aNode, WMMatchDataProc *match, void *cdata)
static WMTreeNode *findNodeInTree(WMTreeNode * aNode, WMMatchDataProc * match, void *cdata, int limit)
{
if (match==NULL) {
if (aNode->data == cdata) {
return aNode;
}
} else {
if ((*match)(aNode->data, cdata)) {
return aNode;
}
}
if (match == NULL && aNode->data == cdata)
return aNode;
else if ((*match) (aNode->data, cdata))
return aNode;
if (aNode->leaves) {
WMTreeNode *leaf;
int i;
if (aNode->leaves && limit != 0) {
WMTreeNode *leaf;
int i;
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
leaf = findNodeInTree(WMGetFromArray(aNode->leaves, i), match, cdata);
if (leaf) {
return leaf;
}
}
}
for (i = 0; i < WMGetArrayItemCount(aNode->leaves); i++) {
leaf = findNodeInTree(WMGetFromArray(aNode->leaves, i),
match, cdata, limit > 0 ? limit - 1 : limit);
if (leaf)
return leaf;
}
}
return NULL;
return NULL;
}
WMTreeNode*
WMFindInTree(WMTreeNode *aTree, WMMatchDataProc *match, void *cdata)
WMTreeNode *WMFindInTree(WMTreeNode * aTree, WMMatchDataProc * match, void *cdata)
{
wassertrv(aTree!=NULL, NULL);
wassertrv(aTree != NULL, NULL);
return findNodeInTree(aTree, match, cdata);
return findNodeInTree(aTree, match, cdata, -1);
}
WMTreeNode *WMFindInTreeWithDepthLimit(WMTreeNode * aTree, WMMatchDataProc * match, void *cdata, int limit)
{
wassertrv(aTree != NULL, NULL);
wassertrv(limit >= 0, NULL);
return findNodeInTree(aTree, match, cdata, limit);
}
void WMTreeWalk(WMTreeNode * aNode, WMTreeWalkProc * walk, void *data, Bool DepthFirst)
{
int i;
WMTreeNode *leaf;
wassertr(aNode != NULL);
if (DepthFirst)
(*walk)(aNode, data);
if (aNode->leaves) {
for (i = 0; i < WMGetArrayItemCount(aNode->leaves); i++) {
leaf = (WMTreeNode *)WMGetFromArray(aNode->leaves, i);
WMTreeWalk(leaf, walk, data, DepthFirst);
}
}
if (!DepthFirst)
(*walk)(aNode, data);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,52 +1,25 @@
#include <errno.h>
#include <time.h>
#include "wconfig.h"
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <unistd.h>
#include <string.h>
#if defined(HAVE_SELECT)
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
void
wusleep(unsigned int microsecs)
void wusleep(unsigned int usec)
{
struct timeval tv;
fd_set rd, wr, ex;
FD_ZERO(&rd);
FD_ZERO(&wr);
FD_ZERO(&ex);
tv.tv_sec = microsecs / 1000000u;
tv.tv_usec = microsecs % 1000000u;
select(1, &rd, &wr, &ex, &tv);
struct timespec tm;
/* An arbitrary limit of 10 minutes -- in WM, if
* somethings wants to sleep anything even close to
* this, it's most likely an error.
*/
if (usec > 600000000)
return;
tm.tv_sec = usec / 1000000;
tm.tv_nsec = (usec % 1000000) * 1000;
while (nanosleep(&tm, &tm) == -1 && errno == EINTR)
;
}
#else /* not HAVE_SELECT */
# ifdef HAVE_POLL
void
wusleep(unsigned int microsecs)
{
poll((struct poll *) 0, (size_t) 0, microsecs/1000);
}
# else /* ! HAVE_POLL */
oops!
# endif /* !HAVE_POLL */
#endif /* !HAVE_SELECT */

View File

@@ -1,202 +1,180 @@
#include <unistd.h>
#include <X11/Xlocale.h>
#include "WINGsP.h"
#include "wconfig.h"
#include "X11/Xlocale.h"
extern void W_InitNotificationCenter(void);
struct W_Application WMApplication;
char *_WINGS_progname = NULL;
Bool
W_ApplicationInitialized(void)
Bool W_ApplicationInitialized(void)
{
return _WINGS_progname!=NULL;
return _WINGS_progname != NULL;
}
void
WMInitializeApplication(char *applicationName, int *argc, char **argv)
void WMInitializeApplication(char *applicationName, int *argc, char **argv)
{
int i;
int i;
assert(argc!=NULL);
assert(argv!=NULL);
assert(applicationName!=NULL);
assert(argc != NULL);
assert(argv != NULL);
assert(applicationName != NULL);
setlocale(LC_ALL, "");
setlocale(LC_ALL, "");
#ifdef I18N
if (getenv("NLSPATH"))
bindtextdomain("WINGs", getenv("NLSPATH"));
else
bindtextdomain("WINGs", LOCALEDIR);
bind_textdomain_codeset("WINGs", "UTF-8");
if (getenv("NLSPATH"))
bindtextdomain("WINGs", getenv("NLSPATH"));
else
bindtextdomain("WINGs", LOCALEDIR);
bind_textdomain_codeset("WINGs", "UTF-8");
#endif
_WINGS_progname = argv[0];
_WINGS_progname = argv[0];
WMApplication.applicationName = wstrdup(applicationName);
WMApplication.argc = *argc;
WMApplication.applicationName = wstrdup(applicationName);
WMApplication.argc = *argc;
WMApplication.argv = wmalloc((*argc+1)*sizeof(char*));
for (i=0; i<*argc; i++) {
WMApplication.argv[i] = wstrdup(argv[i]);
}
WMApplication.argv[i] = NULL;
WMApplication.argv = wmalloc((*argc + 1) * sizeof(char *));
for (i = 0; i < *argc; i++) {
WMApplication.argv[i] = wstrdup(argv[i]);
}
WMApplication.argv[i] = NULL;
/* initialize notification center */
W_InitNotificationCenter();
/* initialize notification center */
W_InitNotificationCenter();
}
void
WMSetResourcePath(char *path)
void WMSetResourcePath(char *path)
{
if (WMApplication.resourcePath)
wfree(WMApplication.resourcePath);
WMApplication.resourcePath = wstrdup(path);
if (WMApplication.resourcePath)
wfree(WMApplication.resourcePath);
WMApplication.resourcePath = wstrdup(path);
}
char*
WMGetApplicationName()
char *WMGetApplicationName()
{
return WMApplication.applicationName;
return WMApplication.applicationName;
}
static char*
checkFile(char *path, char *folder, char *ext, char *resource)
static char *checkFile(char *path, char *folder, char *ext, char *resource)
{
char *ret;
int extralen;
char *ret;
int extralen;
size_t slen;
extralen = (ext ? strlen(ext) : 0) + (folder ? strlen(folder) : 0) + 4;
ret = wmalloc(strlen(path)+strlen(resource)+extralen+8);
strcpy(ret, path);
if (folder) {
strcat(ret, "/");
strcat(ret, folder);
}
if (ext) {
strcat(ret, "/");
strcat(ret, ext);
}
strcat(ret, "/");
strcat(ret, resource);
if (!path || !resource)
return NULL;
if (access(ret, F_OK)!=0) {
wfree(ret);
ret = NULL;
}
extralen = (ext ? strlen(ext) + 1 : 0) + (folder ? strlen(folder) + 1 : 0) + 1;
slen = strlen(path) + strlen(resource) + 1 + extralen;
ret = wmalloc(slen);
return ret;
if (wstrlcpy(ret, path, slen) >= slen)
goto error;
if (folder &&
(wstrlcat(ret, "/", slen) >= slen ||
wstrlcat(ret, folder, slen) >= slen))
goto error;
if (ext &&
(wstrlcat(ret, "/", slen) >= slen ||
wstrlcat(ret, ext, slen) >= slen))
goto error;
if (wstrlcat(ret, "/", slen) >= slen ||
wstrlcat(ret, resource, slen) >= slen)
goto error;
if (access(ret, F_OK) != 0)
goto error;
return ret;
error:
if (ret)
wfree(ret);
return NULL;
}
char*
WMPathForResourceOfType(char *resource, char *ext)
char *WMPathForResourceOfType(char *resource, char *ext)
{
char *path = NULL;
char *tmp, *appdir;
int i;
char *path, *tmp, *appdir;
int i;
size_t slen;
/*
* Paths are searched in this order:
* - resourcePath/ext
* - argv[0]/ext
* - GNUSTEP_USER_ROOT/Applications/ApplicationName.app/ext
* - ~/GNUstep/Applications/ApplicationName.app/ext
* - GNUSTEP_LOCAL_ROOT/Applications/ApplicationName.app/ext
* - /usr/local/GNUstep/Applications/ApplicationName.app/ext
* - GNUSTEP_SYSTEM_ROOT/Applications/ApplicationName.app/ext
* - /usr/GNUstep/Applications/ApplicationName.app/ext
*/
path = tmp = appdir = NULL;
if (WMApplication.resourcePath) {
path = checkFile(WMApplication.resourcePath, NULL, ext, resource);
if (path)
return path;
}
/*
* Paths are searched in this order:
* - resourcePath/ext
* - dirname(argv[0])/ext
* - GNUSTEP_USER_ROOT/Applications/ApplicationName.app/ext
* - ~/GNUstep/Applications/ApplicationName.app/ext
* - GNUSTEP_LOCAL_ROOT/Applications/ApplicationName.app/ext
* - /usr/local/GNUstep/Applications/ApplicationName.app/ext
* - GNUSTEP_SYSTEM_ROOT/Applications/ApplicationName.app/ext
* - /usr/GNUstep/Applications/ApplicationName.app/ext
*/
if (WMApplication.argv[0]) {
tmp = wstrdup(WMApplication.argv[0]);
i = strlen(tmp);
while (i > 0 && tmp[i]!='/')
i--;
tmp[i] = 0;
if (i>0) {
path = checkFile(tmp, NULL, ext, resource);
} else {
path = NULL;
}
wfree(tmp);
if (path)
return path;
}
if (WMApplication.resourcePath) {
path = checkFile(WMApplication.resourcePath, NULL, ext, resource);
if (path)
goto out;
}
appdir = wmalloc(strlen(WMApplication.applicationName)+20);
sprintf(appdir, "Applications/%s.app", WMApplication.applicationName);
if (WMApplication.argv[0]) {
tmp = wstrdup(WMApplication.argv[0]);
i = strlen(tmp);
while (i > 0 && tmp[i] != '/')
i--;
tmp[i] = 0;
if (i > 0) {
path = checkFile(tmp, NULL, ext, resource);
} else {
path = NULL;
}
goto out;
}
if (getenv("GNUSTEP_USER_ROOT")) {
path = checkFile(getenv("GNUSTEP_USER_ROOT"), appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
}
slen = strlen(WMApplication.applicationName) + sizeof("Applications/.app");
appdir = wmalloc(slen);
if (snprintf(appdir, slen, "Applications/%s.app", WMApplication.applicationName) >= slen)
goto out;
tmp = wusergnusteppath();
if (tmp) {
path = checkFile(tmp, appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
}
path = checkFile(getenv("GNUSTEP_USER_ROOT"), appdir, ext, resource);
if (path)
goto out;
if (getenv("GNUSTEP_LOCAL_ROOT")) {
path = checkFile(getenv("GNUSTEP_LOCAL_ROOT"), appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
}
path = checkFile(wusergnusteppath(), appdir, ext, resource);
if (path)
goto out;
path = checkFile("/usr/local/GNUstep", appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
path = checkFile(getenv("GNUSTEP_LOCAL_ROOT"), appdir, ext, resource);
if (path)
goto out;
path = checkFile("/usr/local/GNUstep", appdir, ext, resource);
if (path)
goto out;
if (getenv("GNUSTEP_SYSTEM_ROOT")) {
path = checkFile(getenv("GNUSTEP_SYSTEM_ROOT"), appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
}
path = checkFile(getenv("GNUSTEP_SYSTEM_ROOT"), appdir, ext, resource);
if (path)
goto out;
path = checkFile("/usr/GNUstep", appdir, ext, resource);
if (path) {
wfree(appdir);
return path;
}
path = checkFile("/usr/GNUstep", appdir, ext, resource); /* falls through */
out:
if (tmp)
wfree(tmp);
if (appdir)
wfree(appdir);
return path;
return NULL;
}

Some files were not shown because too many files have changed in this diff Show More