Compare commits

...

100 Commits

Author SHA1 Message Date
Adrian Chadd
d7e7a8a6a2 Merge pull request #32 from phillbush/focus-issue
do not reparent client window; fix amiwm#29
2026-02-20 07:04:15 -08:00
Adrian Chadd
f13edf56fd Merge pull request #33 from phillbush/fix-utf8
fix broken UTF-8 character
2026-02-20 07:03:00 -08:00
Lucas de Sena
bf4806c066 fix broken UTF-8 character 2026-02-20 08:35:40 +00:00
Lucas de Sena
beccf8b0fb do not reparent client window; fix amiwm#29
reparenting the client's window creates a few issues:
• We get bogus UnmapNotify and MapNotify events that are ultimately
  generated by amiwm itself.
• We do not get button events from the window, since its frame
  (c->parent) that we have called XGrabButtons(3) onto, is not
  its parent anymore.

To fix this, do not reparent the client window, but its frame window.
And keep the client window always inside the frame.
2026-02-19 20:46:57 +00:00
Adrian Chadd
f3fc2a7015 Merge pull request #26 from phillbush/localize
Localize
2026-02-05 03:38:04 +00:00
Adrian Chadd
0c23eb0126 Merge pull request #27 from phillbush/dialogs
make dialog clients be iconified/re-screened with their respective leader client
2026-02-05 03:37:04 +00:00
Lucas de Sena
6685043266 make dialog clients be iconified/re-screened with their respective leader client 2026-02-04 16:12:48 +00:00
Lucas de Sena
8a59e5cc9e localize control flow and variables
State and control flow for modal mouse actions (dragging/resizing/etc)
was fragmented and scattered through main.c, making code convoluted and
hard to maintain.

I fixed that by applying good structured programming practics:
implementing sub-event-loops for those modal actions, rather than
checking which modal action is currently in action at the main
event-loop.

That commit took me more time than i expected... abstract out all
spaghettish, global-state control flow into a single, encapsulated
scope for each modal action… test if i broke anything… find any dead
code that is not used anymore (implementing that global state we had
before)…

I also put some `static` in global variables and routines, so the
compile can warn whether an unused variable/function is defined (and
help me on removing dead code).
2026-01-31 01:52:24 +00:00
Lucas de Sena
5bbae05fec icc: use compound literal rather than static object to return pointer
thus make mkcmessage reentrant (and a macro, rather than a function)
2026-01-31 01:25:50 +00:00
Lucas de Sena
1212e7a78c document OpaqueResize/OpaqueMove 2026-01-30 01:54:19 +00:00
Adrian Chadd
0a400a366a Merge pull request #22 from phillbush/fullscreen
Make fullscreen work on GTK applications
2026-01-18 18:33:36 -08:00
Adrian Chadd
38913a983d Merge pull request #23 from phillbush/mandoc
ameliorate and rewrite manual in -mdoc format
2026-01-15 20:28:51 -08:00
Lucas de Sena
a33d487fab ameliorate and rewrite manual in -mdoc format
The AmiWM manual was kinda incomplete.  It does not describe how the WM
works, does not list all the configuration commands, nor the modules.

This commit rewrites the manual into the mandoc format, fill in the
gaps, and makes its section structure more standardized.
2026-01-16 00:43:57 +00:00
Lucas de Sena
a8f92b4e5b Make fullscreen work on GTK applications
This commit implements the _NET_SUPPORTING_WM_CHECK property, defined
by the EWMH[1] (Extended Window Management Hints, aka wm-spec), which
indicates that a EWMH-compliant window manager is running.

A GTK application, when set to go fullscreen, first checks root window's
_NET_SUPPORTING_WM_CHECK property to determine whether a EWMH-compliant
window manager is running; and then checks the _NET_SUPPORTED property
to determine the supported protocols.

_NET_SUPPORTED was previously implemented, but _NET_SUPPORTING_WM_CHECK
was not.


This commit also fixes a misconception of the code related to screens.

The code deals with two different, unrelated concepts of screens: the
X11 screen, and the AmiWM screen.

The X11 screen, created by the X server independently of whether a
window manager is running, is a kind of “subdisplay”.  A X11 display
structure, which describes a connection to the X server, has one or more
screens.  Each X11 screen has its own root window and its own set of
clients that are specific to it, and cannot move to another X11 screen.
The user can even run two different window managers at the same time in
the same display, given that each is run in a different X11 screen.
Usually, there is only one X11 screen.

The _NET_SUPPORTING_WM_CHECK and _NET_SUPPORTED properties must be set
on the root window of each screen that AmiWM is managing.  Previously,
however, they were set everytime an AmiWM screen (a totally different
concept) was realized.  So, if i had 4 AmiWM screens configured in my
~/.amiwmrc file, setsupports() were called four times, even if i only
have a single X11 screen.

[1]: https://specifications.freedesktop.org/wm/latest/index.html
2026-01-10 02:58:39 +00:00
Adrian Chadd
d3be9b113f Merge pull request #21 from chewi/bmake-yacc
Fix GNUism in Makefile regarding yacc
2023-12-22 17:31:26 -08:00
James Le Cuirot
d148a44402 Fix GNUism in Makefile regarding yacc
Tested with bmake.
2023-12-22 23:39:47 +00:00
Adrian Chadd
78b416044c Merge pull request #19 from chewi/yacc
Adjust yacc builds to support the original yacc (as opposed to bison)
2023-12-21 22:13:14 -08:00
Adrian Chadd
00025ae390 Merge pull request #20 from erikarn/main
[amiwm] Update to 0.22pl2
2023-12-21 22:11:13 -08:00
Adrian Chadd
def62797f9 [amiwm] Update to 0.22pl2
This notably includes full screen support!

Addresses Issue #12
2023-12-21 22:09:25 -08:00
James Le Cuirot
5823492992 Adjust yacc builds to support the original yacc (as opposed to bison)
yacc doesn't support the arguments we've been giving to bison. byacc was
also tested.
2023-10-08 22:15:32 +01:00
James Le Cuirot
a010c4406f Drop obsolete smakefile
This appears to be for the ye olde SAS/C compiler! It wouldn't work now,
even if you did have that.
2023-10-08 22:15:28 +01:00
James Le Cuirot
f1e182de80 Add "Filesystem" and "Launcher" to git ignore file 2023-10-08 22:15:25 +01:00
Adrian Chadd
9b3846e15a Merge pull request #18 from chewi/build
Various build fixes and improvements
2023-10-07 17:55:57 -07:00
James Le Cuirot
147cb92b7f Respect ${AR} when building
Unfortunately, there is no AC_PROG_AR yet.
2023-10-07 23:03:03 +01:00
James Le Cuirot
0f16b49701 Fix implicit declaration of exit() during configure script 2023-10-07 23:03:00 +01:00
James Le Cuirot
c7b5bbe441 ksh is not installed on modern systems, assume some POSIX shell 2023-10-07 23:02:57 +01:00
James Le Cuirot
c3185246ca Use the noyywrap lex option instead of adding hacky yywrap functions 2023-10-07 23:02:54 +01:00
James Le Cuirot
d91710ba03 Fix all implicit declarations
AC_HEADER_TIME is only needed if you need to include time.h and
sys/time.h at the same time.

The truth is this codebase is an unholy mess but at least this fixes
the warnings.
2023-10-07 23:02:51 +01:00
James Le Cuirot
cf6e360a7e Respect LDFLAGS 2023-10-07 23:02:48 +01:00
James Le Cuirot
34c0c7af02 Fix parallel builds 2023-10-07 23:02:44 +01:00
James Le Cuirot
9978760d7f Fix various path issues 2023-10-07 23:02:40 +01:00
James Le Cuirot
f1bcd15eb6 Update install-sh to a more modern version 2023-10-07 23:02:19 +01:00
James Le Cuirot
798adaa45b configure.in should be named configure.ac these days 2023-10-07 23:02:14 +01:00
James Le Cuirot
a9d59a9fd4 Delete generated configure script and ignore all build/generated files
These should not be in the repository.
2023-10-02 08:44:11 +01:00
James Le Cuirot
3c29995649 Support make install DESTDIR=/foo just like Automake does
Distributions really need this.
2023-10-02 08:42:15 +01:00
Adrian Chadd
f77c715b24 Merge pull request #11 from erikarn/main
[amiwm] lots of little fixes to amiwm over the last 6 months
2023-06-12 19:16:44 -07:00
Adrian Chadd
87ba044ea4 [libami] handle EINTR from select() as a non-error
EINTR is happening during suspend/resume, which was causing all of
the modules to die (and requiring a restart of amiwm to re-run all
of its modules.)

This fixes things in FreeBSD suspend/resume so, well, the modules
keep working. :)
2023-06-12 11:39:41 -07:00
Adrian Chadd
1a8a15e24f [amiwm] add a missing Makefile depedency
This isn't completely enough to make this build with gmake -j, but it's
one of many things that are missing.
2023-06-12 11:39:41 -07:00
Adrian Chadd
ecf427324c Merge branch 'ahc_20220523_move_window_desktop' 2023-01-15 20:53:02 -08:00
Adrian Chadd
9ce1822bff [amiwm] remove now dead code. 2023-01-15 20:51:47 -08:00
Adrian Chadd
93863ec396 [amiwm] add a .gitignore so I don't see / commit .o files 2022-11-23 18:11:27 -08:00
Adrian Chadd
631176c9a2 [amiwm] Implement a keyboard shortcut to move a client to a different screen
This allows a keyboard shortcut to move a client to a different amiwm
screen.  That way when you have things like Firefox restart every window
in a single screen, you can quickly move screens to where they should be.
2022-09-05 16:06:18 -07:00
Adrian Chadd
c0450d83bc Merge branch 'main' of github.com:erikarn/amiwm-2 2022-09-05 16:05:52 -07:00
Adrian Chadd
229d2b2c4d [amiwm] Fix NULL scr issue
If the clock timer fires when global scr is NULL then we end up calling
redrawmenubar() with a NULL global scr, but a valid local scr.

So just pass in the scr used when doing "stuff" into redrawmenubar(),
making the 'scr' in redrawmenubar() also local scope.
2022-09-05 16:03:55 -07:00
Adrian Chadd
5577e78cc8 Merge pull request #10 from erikarn/20220618_fix_make
[amiwm] Fix make rules to work under BSD make
2022-06-18 19:14:59 -07:00
Adrian Chadd
918365056b [amiwm] Fix make rules to work under BSD make
* fix whitespace
* filesystem / jokefs rule implication stuff was working fine in GNU make
  but not in BSD make, so fix it there
* Remove the $(srcdir)/module thing, because it was tripping up BSD make
  rules.  The "./" is just making it angry.

Tested:

* FreeBSD, gmake and make
2022-06-18 19:13:03 -07:00
Adrian Chadd
feb42adcc6 Merge pull request #8 from justindossey/20220525_update_man_page
Correct filenames for README and MODULES
2022-05-25 10:28:43 -07:00
Justin Dossey
e6f7a1bc17 Correct filenames for README and MODULES
The README file in this repo is called README.md and the old
README.modules is now named MODULES.md. Changed references to those
files (including in the man page) to reflect what is in the repo today.
2022-05-25 10:06:37 -07:00
Adrian Chadd
21423a0c10 Merge pull request #6 from erikarn/20220511_fix_keyboard_docs
[amiwm] Fix keyboard documentation entry
2022-05-21 16:06:33 -07:00
Adrian Chadd
f116f9c335 Merge pull request #5 from erikarn/ahc_20220425_menu_widgets
This is the beginning of adding some battery display support into the menu and figuring out how to add arbitrary widgets into the menu bar.

It's going to take a bunch more commits / time to clean this up to be more flexible, but at least now we have an MVP of adding a new "thing", buggy as it is.
2022-05-21 16:05:17 -07:00
Adrian Chadd
2a9bd912a1 [amiwm] Add the basic battery info printing bits
* add a batteryinfo config option to enable whether or not to display
  the current battery info string

* populate that battery info string whenever we receive a battery
  update from the module

* document it all

This is very specific to a battery thing rather than a generic menu
widget thing, but I think I'll go and twiddle with this stuff a bit
more first and then work on a more generic "menu widget" thing later.

It'd be nice to have "menu bar things" like battery and the date/time
field on a linked list of "things".

There's also some bugs - notably, rendering artifacts when the
string length shrinks, and it only updating on the 'current' menu bar
(when you have multiple desktops visible at once.)  Those also
should be fixed for completeness. :-)
2022-05-15 19:36:03 -07:00
Adrian Chadd
fc23b3e054 [battery] Add help on how the battery module works. 2022-05-15 10:50:55 -07:00
Adrian Chadd
915b84e403 [battery] Update to not spit out debugging
Now that this actually seems to work, let's not spit out so much
debugging info.  It's not needed!

Whilst here quieten a debugging output.
2022-05-15 10:49:17 -07:00
Adrian Chadd
030f55fa2e [battery] Tie into the periodic function to update APM info
Tie into the periodic function so we can get the APM info.

For now it's not checking that some time has elapsed, the hope
is that it'll just be driven by md_main_loop() / 5 second select
timeout.
2022-05-14 22:08:55 -07:00
Adrian Chadd
4bd5a665db [libami] Add a 5 second read timeout so the periodic routine can be called
* add a basic select() loop for the read FD to see if it's ready
* optionally block in md_read() even if we timeout - this is used for
  the md_command() side of things
* md_handle_input() however doesn't block and will happily timeout
  so the loop can run and the periodic function can run.

This indeed seems to work.  It's a bit dirty, but it at least stops
the main loop from being fully blocking and that's super useful for
modules that wish to schedule background work.
2022-05-14 22:07:36 -07:00
Adrian Chadd
bfc0313ace [amiwm] Fix keyboard documentation entry
This .. didn't work.  Whoops!
2022-05-11 19:42:14 -07:00
Adrian Chadd
54adc01be4 [libami] document how the module loop works; start thinking about how to make it async
* Yeah it'd be nice to just use libevent here, alas
* Figure out how all the reading/writing works and comment it
* Add a periodic function that'll be called every trip through
  the main loop; will turn it into something more formally periodic
  later.

There's still lots to do here before I can actually schedule
periodic events and the read()s are non-blocking.  Give it time!
2022-05-08 14:04:21 -07:00
Adrian Chadd
18e858ae80 [amiwm] MVP for initial battery stuff
Totally not ready for prod, but at least I'm making progress
figuring out how to add extra bits to this thing.

* add a second widget to the menu bar, next to the title bar
* add a new module command to update the battery information
* add a freebsd specific Battery module, not linked into the
  build right now.
* amiwm will print out whenever we get battery information from the
  module.

Right now I'm trying to figure out how to get some kind of periodic
background event into the module main loop.  Launcher does it
using cx_broker(), but I dunno if I can adapt that pattern here.
2022-04-25 21:28:49 -07:00
Adrian Chadd
e42512c034 [amiwm] Don't use global scr for this iteration
The global scr is a bit of an overused thing.  It's definitely not
needed here.  Don't use it here.
2022-04-25 19:03:50 -07:00
Adrian Chadd
9ac42a9f4a Merge pull request #4 from erikarn/ahc_20220409_gadgets
Ahc 20220409 gadgets
2022-04-19 20:06:13 -07:00
Adrian Chadd
e73f47e1fb [requestchoice] refactor out gadget code
This calls the gadget code that I've refactored into libami/ .
.
2022-04-09 17:35:05 -07:00
Adrian Chadd
48f15595a4 [executecmd] migrate executecmd to use the gadgets in libami
This removes the gadget specific code in executecmd and calls
the routines I've added in libami.
2022-04-09 17:34:43 -07:00
Adrian Chadd
0e5c81f6e3 [libami] add button, textbox and textinput from requestchoice/executecmd
Marcus had written up workbench style widgets inside the two external
helper programs requestchoice and executecmd.  This ports the code over
to libami.

Note that there isn't a generic gadget or collection of gadgets yet -
this is purely a refactor of the code, and the upcoming commit that
migrates requestchoice/executecmd over to use them just handles them
directly via xlib like they have always done.
2022-04-09 17:33:21 -07:00
Adrian Chadd
161a78e648 Merge pull request #3 from erikarn/ahc_20220403_alt_tab
[amiwm] add a new command action to rotate windows
2022-04-06 13:56:17 -07:00
Adrian Chadd
e0c13213c5 [amiwm] add a new command action to rotate windows
This adds a command to iterate over the set of windows.  It's not
like alt-tab in ye olde windows world where you'd alt tab once to
switch between two windows, and then keep alt-tab'ing with alt down
to go through the window list.  For now it just literally iterates
through those windows.

This makes it a lot easier to work with a large number of open
windows without having to constantly use the mouse.
2022-04-03 08:27:14 -07:00
Adrian Chadd
72742103b5 Merge pull request #2 from erikarn/ahc_20220328_remove_global_front
[amiwm] remove the global 'front' variable
2022-04-03 08:24:23 -07:00
Adrian Chadd
d00be9ffa8 [amiwm] remove the global 'front' variable
This is a pretty straight forward change to remove the global front
variable and instead use a couple of accessor functions.

This hopefully will make it easier to keep track and debug when
the front screen changes.
2022-04-03 08:20:39 -07:00
Adrian Chadd
84caa252d1 Merge pull request #1 from erikarn/main
[amiwm] Update documentation to point to this new repository.
2022-03-24 09:18:52 -07:00
Adrian Chadd
743a7a666b [amiwm] Update documentation to point to this new repository. 2022-03-24 09:18:18 -07:00
Adrian Chadd
6bd141dec1 [amiwm] add some initial comments of structure members.
Still have a long way to go.
2022-03-18 20:56:16 -07:00
Adrian Chadd
64d540a026 [amiwm] Fix window size / position issues when asked to do something insane
* ensure newly created windows are placed somewhere visible - ie, not
  off the screen.
* ensure newly created window sizes aren't insanely large, which end up
  being unable to be moved or resized in amiwm.

This has shown up with gtk apps (kicad, firefox) with their load/save
dialog.  For some reason they want to be almost 2x my desktop size,
making them super hard to use.
2022-03-17 20:38:40 -07:00
Adrian Chadd
26cecc8487 [amiwm] Use XAllocSizeHints() for the sizehints in struct Client
Although it likely doesn't matter /that/ much, the x11 xlib manual
does say to use it rather than expecting the struct to stay the same
size.

Yeah yeah it's 2022 and we really do build things from source,
ICCCM is likely not going to change that much nowdays, etc, etc.
2022-03-12 21:04:24 -08:00
Adrian Chadd
4162377f10 [libami] more compile warning fixes
* fix 32/64 bit int size printing stuff
* more if braces
2022-02-26 11:31:37 -08:00
Adrian Chadd
2a05c6f3e4 [background] Don't use GNU sed extensions
This makes it work on freebsd!
2022-02-22 22:00:47 -08:00
Adrian Chadd
31b98f3ef0 [libami] Another if / else clause warning to clean up 2022-02-18 21:52:15 -08:00
Adrian Chadd
32cfb5ab21 amiwm: since options were removed, make the Screens menu work again 2022-02-18 19:31:55 -08:00
Adrian Chadd
9825ecbe6b [launcher] launcher install fixes.
* install it!
* install the other .info icons too!
* add some basic documentation.
2022-02-13 20:21:44 -08:00
Adrian Chadd
1ce0d7c975 [amiwm] delete files that aren't actually used; they're auto-generated. 2022-02-13 19:59:50 -08:00
Adrian Chadd
294256771a [amiwm] Fix logic for the window size when maximized.
This is from Marcus' bzr repository (rev 126).
2022-02-13 18:56:38 -08:00
Adrian Chadd
77239205d7 [launcher] Add launcher into the build 2022-02-13 18:55:40 -08:00
Adrian Chadd
b0830232ff [launcher] fix compile warning 2022-02-13 18:55:18 -08:00
Adrian Chadd
54cb67609e [filesystem] install/document the filesystem module 2022-02-10 12:50:44 -08:00
Adrian Chadd
5365f97cbe [amiwm] Do another pass to clean up build warnings
This is mostly a "dangling if" cleanup, but I did add some other
comments here and there!
2022-02-10 12:37:38 -08:00
Adrian Chadd
59eae9c029 [libami] Make 'clean' a libami target
To make it easier / cleaner to build libami by itself, make a clean
target and call into it from the top level makefile as needed.
2020-11-10 11:55:10 -08:00
Adrian Chadd
31b2a069ea [libami] Fix compile warnings in module.c 2020-11-10 11:54:56 -08:00
reddsik
8e0948ca98 ghggewrpguregew 2017-08-03 23:30:51 +02:00
reddsik
f90e57437d no one reads this anywyas 2017-08-03 23:24:17 +02:00
reddsik
8bbae1ef0b more fixes 2017-08-03 23:07:55 +02:00
reddsik
fc0ecd5ecb amiwm apparently needs xorg-dev, thx to @WPMasterofficial for reporting the issue 2017-08-03 22:33:48 +02:00
reddsik
6bde9903d9 fixed makefile 2017-08-03 22:30:57 +02:00
reddsik
b6d25b8f9b Added Background_resize again because i forgot to do it in a6cbde4 2017-07-16 00:24:07 +02:00
reddsik
910c15cece Added modules to the makefile so they will install properly 2017-07-16 00:17:29 +02:00
reddsik
a6cbde4cd7 Added two new modules for displaying backdrops, fixed lib path(again), moved modules to subdirectory, and updated MODULES.md with useful info! ^^ 2017-07-15 23:07:12 +02:00
reddsik
a6b29a59ba Revert amiwm.1 as i've copied the wrong one 2017-07-14 18:03:22 +02:00
reddsik
5e6ed1191b Added something that will be a config util later, removed some unusable options from menus(you'll be later able to re-enable them), changed module dir to /lib/amiwm 2017-07-14 13:06:22 +02:00
reddsik
03aaf742af erm, removed too many files and it didn't compile.. fixed it again.. 2017-03-26 23:20:16 +02:00
reddsik
d35ad096fc removed a few not needed files 2017-03-26 18:03:50 +02:00
reddsik
956d408386 added even more info to README.md 2017-03-26 17:33:01 +02:00
reddsik
a6ffcd2abc another small README fix 2017-03-26 17:03:58 +02:00
reddsik
9113cdefc5 README and LICENSE fixes; deleted a few not needed files 2017-03-26 17:01:37 +02:00
74 changed files with 4669 additions and 16911 deletions

26
.gitignore vendored Normal file
View File

@@ -0,0 +1,26 @@
*.a
*.o
Makefile
/Filesystem
/Keyboard
/Launcher
/Xinitrc
/Xsession
/Xsession2
/amiwm
/autom4te.cache/
/config.log
/config.status
/config_util
/configure
/executecmd
/gram.tab.c
/gram.tab.h
/kbdlexer.c
/kbdmodule.tab.c
/kbdmodule.tab.h
/lex.c
/ppmtoinfo
/requestchoice
/system.amiwmrc

7
Background_resize Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
if [ "$3" = "0x00000000" ]; then
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//") -window root "$4" > /dev/null
else
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//") -window "$3" "$4" > /dev/null
fi

6
Background_stretch Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
if [ "$3" = "0x00000000" ]; then
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//")\! -window root "$4" > /dev/null
else
display -resize $(xwininfo -root | grep geometry | sed "s/-geometry //" | sed "s/+0+0//")\! -window "$3" "$4" > /dev/null
fi

View File

@@ -1,87 +0,0 @@
PROGRAMS = amiwm requestchoice executecmd
AMIWM_HOME = /usr/X11/lib/X11/amiwm
SRCS1 = main.c drawinfo.c client.c frame.c icc.c \
icon.c menu.c diskobject.c gram.c lex.c rc.c
OBJS1 = main.o drawinfo.o client.o frame.o icc.o \
icon.o menu.o diskobject.o gram.o lex.o rc.o
SRCS2 = requestchoice.c drawinfo.c
OBJS2 = requestchoice.o drawinfo.o
SRCS3 = executecmd.c drawinfo.c
OBJS3 = executecmd.o drawinfo.o
YFLAGS = -d
all::
/* Some old implementations does not have LexFile and YaccFile... */
#ifndef LexFile
#define LexFile(file) @@\
depend:: file.c @@\
@@\
clean:: @@\
$(RM) lex.yy.c file.c
#endif /* LexFile */
#ifndef YaccFile
#define YaccFile(file,flags) @@\
depend:: file.c @@\
@@\
file.h file.c: file.y @@\
$(YACC) flags file.y @@\
$(MV) y.tab.c file.c @@\
$(MV) y.tab.h file.h @@\
@@\
clean:: @@\
$(RM) y.tab.c y.tab.h file.h file.c
#endif /* YaccFile */
LexFile(lex)
YaccFile(gram,$(YFLAGS))
ComplexProgramTarget_1(amiwm, $(XLIB) $(XMULIB), $(OTHER_LIBS))
ComplexProgramTarget_2(requestchoice, $(XLIB), $(OTHER_LIBS))
ComplexProgramTarget_3(executecmd, $(XLIB), $(OTHER_LIBS))
SpecialCObjectRule(menu,$(_NOOP_),'-DAMIWM_HOME="$(AMIWM_HOME)"')
SpecialCObjectRule(rc,$(_NOOP_),'-DAMIWM_HOME="$(AMIWM_HOME)"')
install ::
MakeDir($(AMIWM_HOME))
RemoveFile($(AMIWM_HOME)/requestchoice)
$(LN) $(BINDIR)/requestchoice $(AMIWM_HOME)/requestchoice
RemoveFile($(AMIWM_HOME)/executecmd)
$(LN) $(BINDIR)/executecmd $(AMIWM_HOME)/executecmd
InstallNonExec(system.amiwmrc, $(AMIWM_HOME)/system.amiwmrc)
InstallNonExec(def_tool.info, $(AMIWM_HOME)/def_tool.info)
/* Targets for my private use. Not very portable. // Marcus */
DISTFILES = README INSTALL Imakefile smakefile scoptions *.[chly] \
system.amiwmrc def_tool.info
patch :
mv version.h old_version.h
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
rm old_version.h
dist : version.h clean
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
tarname="amiwm$$version.tar"; \
mkdir amiwm; \
cp $(DISTFILES) amiwm/; \
rm -f $$tarname $$tarname.gz; \
tar cf $$tarname amiwm; \
rm -rf amiwm/; \
gzip $$tarname; \
)

View File

@@ -1,12 +1,11 @@
amiwm is Copyright 1995-1998 by Marcus Comstedt <marcus@lysator.liu.se>
**amiwm** is Copyright 1995-2011 by Marcus Comstedt <marcus@lysator.liu.se>
Amiga, AmigaOS and Workbench are registered trademarks of
AMIGA International Inc.
# Generic amiwm License
Generic amiwm License
=====================
This license applies to whomever receives this file. It is a generic
license to use and distribute amiwm. If you want to acquire the software
@@ -18,7 +17,7 @@ non-commercial purposes, is hereby granted without fee, provided
that this license information and copyright notice appear in all copies.
If you redistribute amiwm, the *entire* contents of this distribution
must be distributed, including the README, INSTALL and LICENSE files,
must be distributed, including the README.md and LICENSE.md files,
the sources, and the various scripts and Makefiles.
You may distribute binaries built from the unmodified amiwm sources, for
@@ -40,5 +39,4 @@ freely distribute patches against the unmodified source code.
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
arising from the use of this software.

221
Makefile
View File

@@ -1,221 +0,0 @@
srcdir = .
SHELL = /bin/sh
CC = gcc
LEX = flex
YACC = bison -y
CFLAGS = -g -O2
YFLAGS = -d
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_TERMIO_H=1 -DHAVE_X11_EXTENSIONS_SHAPE_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DRETSIGTYPE=void -DHAVE_WAIT3=1 -DHAVE_SELECT=1 -DHAVE_STRDUP=1 -DHAVE_WAITPID=1 -DHAVE_XSHAPE=1 -DBSD_STYLE_GETTIMEOFDAY=1 -DHAVE_XCREATEFONTSET=1 -DHAVE_XMBTEXTESCAPEMENT=1 -DHAVE_XUTF8DRAWIMAGESTRING=1 -DUSE_FONTSETS=1 -DLAME_ENDIAN=1
ALL_CFLAGS = -I. -I. -I./libami $(DEFS) $(CFLAGS)
LIBS = -lSM -lICE -Llibami -lami -lXext -lXmu \
-lX11
prefix = /usr/local
exec_prefix = ${prefix}
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man
INSTALL = /usr/bin/install -c
LN_S = ln -s
RM = -rm -f
LIBAMI = libami/libami.a
DT_DIR = /etc/dt
STRIPFLAG = -s
PROGS = amiwm requestchoice executecmd ppmtoinfo
MODULES = $(srcdir)/Background Keyboard Launcher
OBJS = main.o screen.o client.o frame.o icc.o \
icon.o menu.o diskobject.o gram.o lex.o rc.o \
module.o
SRCS = main.c screen.c client.c frame.c icc.c \
icon.c menu.c diskobject.c gram.c lex.c rc.c \
module.c \
requestchoice.c executecmd.c kbdmodule.c kbdlexer.c \
launchermodule.c
DISTFILES = README README.modules INSTALL LICENSE amiwm.1 \
configure configure.in Makefile.in install-sh smakefile scoptions \
*.[chly] system.amiwmrc def_*.info *.map \
Background Xresources.amiwm.in Amilogo.?m Xsession*.in Xinitrc.in \
amiwm-init libami/Makefile.in libami/*.[chly]
PACKAGENAME = amiwm
AMIWM_HOME = $(libdir)/amiwm
all : lib_all
@$(MAKE) local_all
local_all : $(PROGS) $(MODULES)
lib_all :
@( cd libami; $(MAKE) all )
.c.o:
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
menu.o : menu.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
rc.o : rc.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
diskobject.o : diskobject.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
filesystem.o : joke_fs.c
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
ppmtoinfo.o : ppmtoinfo.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
gram.h gram.c: gram.y
$(YACC) $(YFLAGS) $<
mv y.tab.c gram.c
mv y.tab.h gram.h
lex.c : lex.l
$(LEX) -t $< > lex.c
kbdmodule.h kbdmodule.c: kbdmodule.y
$(YACC) $(YFLAGS) $<
mv y.tab.c kbdmodule.c
mv y.tab.h kbdmodule.h
kbdlexer.c : kbdlexer.l
$(LEX) -t $< > kbdlexer.c
install : $(PROGS) $(MODULES) Xsession Xsession2 Xinitrc amiwm-init
-mkdir -p $(AMIWM_HOME)
$(INSTALL) $(STRIPFLAG) requestchoice $(AMIWM_HOME)/requestchoice
$(INSTALL) $(STRIPFLAG) executecmd $(AMIWM_HOME)/executecmd
for module in $(MODULES); do \
if [ "$$module" = "$(srcdir)/Background" ]; then \
$(INSTALL) $$module $(AMIWM_HOME)/Background; \
else \
$(INSTALL) $(STRIPFLAG) $$module $(AMIWM_HOME)/$$module; \
fi; \
done
$(INSTALL) -m 644 $(srcdir)/system.amiwmrc $(AMIWM_HOME)/system.amiwmrc
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(AMIWM_HOME)/def_tool.info
$(INSTALL) -m 644 $(srcdir)/system.map $(AMIWM_HOME)/system.map
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(AMIWM_HOME)/magicwb.map
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(AMIWM_HOME)/schwartz.map
$(INSTALL) -m 755 Xsession $(AMIWM_HOME)/Xsession
$(INSTALL) -m 755 Xsession2 $(AMIWM_HOME)/Xsession2
$(INSTALL) -m 755 Xinitrc $(AMIWM_HOME)/Xinitrc
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(AMIWM_HOME)/amiwm-init
-mkdir -p $(bindir)
$(INSTALL) $(STRIPFLAG) amiwm $(bindir)/amiwm
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(bindir)/ppmtoinfo
$(RM) $(bindir)/requestchoice
$(LN_S) $(AMIWM_HOME)/requestchoice $(bindir)/requestchoice
-mkdir -p $(mandir)/man1
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(mandir)/man1/amiwm.1
fs-install : Filesystem
$(INSTALL) $(STRIPFLAG) Filesystem $(AMIWM_HOME)/Filesystem
$(INSTALL) -m 644 def_disk.info $(AMIWM_HOME)/def_disk.info
$(INSTALL) -m 644 def_drawer.info $(AMIWM_HOME)/def_disk.info
cde-install : Xresources.amiwm Amilogo.bm Amilogo.pm
-mkdir -p $(DT_DIR)/config/C/Xresources.d
$(INSTALL) -m 644 Xresources.amiwm $(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
-mkdir -p $(DT_DIR)/appconfig/icons/C
$(INSTALL) -m 644 Amilogo.bm $(DT_DIR)/appconfig/icons/C/Amilogo.bm
$(INSTALL) -m 644 Amilogo.pm $(DT_DIR)/appconfig/icons/C/Amilogo.pm
amiwm : $(OBJS) $(LIBAMI)
$(CC) -o amiwm $(OBJS) $(LIBS)
requestchoice : requestchoice.o $(LIBAMI)
$(CC) -o requestchoice requestchoice.o $(LIBS)
executecmd : executecmd.o $(LIBAMI)
$(CC) -o executecmd executecmd.o $(LIBS)
Filesystem : filesystem.o $(LIBAMI)
$(CC) -o Filesystem filesystem.o $(LIBS)
Keyboard : kbdmodule.o kbdlexer.o $(LIBAMI)
$(CC) -o Keyboard kbdmodule.o kbdlexer.o $(LIBS)
Launcher : launchermodule.o $(LIBAMI)
$(CC) -o Launcher launchermodule.o $(LIBS)
ppmtoinfo : ppmtoinfo.o
$(CC) -o ppmtoinfo ppmtoinfo.o -lm
localetest : localetest.o $(LIBAMI)
$(CC) -o localetest localetest.o $(LIBS)
clean :
$(RM) core $(PROGS) $(LIBAMI) Keyboard Launcher *.o libami/*.o
$(RM) lex.yy.c lex.c y.tab.c y.tab.h gram.h gram.c
$(RM) kbdlexer.c kbdmodule.h kbdmodule.c
$(RM) config.log
distclean : clean
$(RM) config.status config.cache *~
$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
spotless : distclean
TAGS:
etags *.[ch] libami/*.[ch]
patch :
mv version.h old_version.h
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
rm old_version.h
dist : version.h clean
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
tarname="$(PACKAGENAME)$$version.tar"; \
mkdir $(PACKAGENAME)$$version; \
tar cf - $(DISTFILES) | (cd $(PACKAGENAME)$$version/; tar xf - ); \
rm -f $$tarname $$tarname.gz; \
tar cf $$tarname $(PACKAGENAME)$$version; \
rm -rf $(PACKAGENAME)$$version; \
gzip $$tarname; \
)
$(srcdir)/configure: $(srcdir)/configure.in
autoconf $(srcdir)/configure.in > $(srcdir)/configure
config.status: $(srcdir)/configure
$(srcdir)/configure
Makefile: $(srcdir)/Makefile.in config.status
./config.status
libami/Makefile: $(srcdir)/libami/Makefile.in config.status
./config.status
Xresources.amiwm: $(srcdir)/Xresources.amiwm.in
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xresources.amiwm.in > Xresources.amiwm
Xsession: $(srcdir)/Xsession.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession.in > Xsession
Xsession2: $(srcdir)/Xsession2.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession2.in > Xsession2
Xinitrc: $(srcdir)/Xinitrc.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xinitrc.in > Xinitrc
depend:: $(SRCS)
-@rm Makefile.bak
mv Makefile Makefile.bak
( sed '/^#--DO NOT REMOVE THIS LINE--$$/q' < Makefile.bak ; \
$(CC) -MM $(ALL_CFLAGS) $(SRCS) ) > Makefile
depend::
@( cd libami; $(MAKE) depend )
#--DO NOT REMOVE THIS LINE--

View File

@@ -5,16 +5,16 @@ CC = @CC@
LEX = @LEX@
YACC = @YACC@
CFLAGS = @CFLAGS@
YFLAGS = -d
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
ALL_CFLAGS = -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
ALL_CFLAGS = -Wall -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
LIBS = @X_LIBS@ @X_PRE_LIBS@ -Llibami -lami @XT_LIB_KLUDGE@ -lXext -lXmu \
-lX11 @X_EXTRA_LIBS@ @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@
INSTALL = @INSTALL@
LN_S = @LN_S@
RM = -rm -f
@@ -22,158 +22,186 @@ LIBAMI = libami/libami.a
DT_DIR = /etc/dt
STRIPFLAG = -s
PROGS = amiwm requestchoice executecmd ppmtoinfo
PROGS = amiwm requestchoice executecmd ppmtoinfo config_util
MODULES = $(srcdir)/Background Keyboard Launcher
MODULES = Background Keyboard Background_resize Background_stretch \
def_tool.info Filesystem Launcher
OBJS = main.o screen.o client.o frame.o icc.o \
icon.o menu.o diskobject.o gram.o lex.o rc.o \
icon.o menu.o diskobject.o gram.tab.o lex.o rc.o \
module.o
SRCS = main.c screen.c client.c frame.c icc.c \
icon.c menu.c diskobject.c gram.c lex.c rc.c \
icon.c menu.c diskobject.c gram.tab.c lex.c rc.c \
module.c \
requestchoice.c executecmd.c kbdmodule.c kbdlexer.c \
launchermodule.c
requestchoice.c executecmd.c kbdmodule.tab.c kbdlexer.c \
config_util.c launchermodule.c
DISTFILES = README README.modules INSTALL LICENSE amiwm.1 \
configure configure.in Makefile.in install-sh smakefile scoptions \
*.[chly] system.amiwmrc def_*.info *.map \
Background Xresources.amiwm.in Amilogo.?m Xsession*.in Xinitrc.in \
amiwm-init libami/Makefile.in libami/*.[chly]
DISTFILES = README.md MODULES.md INSTALL LICENSE amiwm.1 \
configure configure.ac Makefile.in install-sh \
*.[chly] system.amiwmrc.in def_*.info *.map \
Background Background_resize Background_resize_norepeat \
Background_stretch Launcher Xresources.amiwm.in Amilogo.?m \
Xsession*.in Xinitrc.in amiwm-init libami/Makefile.in libami/*.[chly] \
PACKAGENAME = amiwm
AMIWM_HOME = $(libdir)/amiwm
AMIWM_MODULES = $(libdir)/amiwm/modules
all : lib_all
all: lib_all
@$(MAKE) local_all
local_all : $(PROGS) $(MODULES)
local_all: $(PROGS) $(MODULES)
lib_all :
lib_all:
@( cd libami; $(MAKE) all )
lib_clean:
@( cd libami; $(MAKE) clean )
.c.o:
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
menu.o : menu.c
menu.o: menu.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
rc.o : rc.c
rc.o: rc.c gram.tab.h
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
diskobject.o : diskobject.c
diskobject.o: diskobject.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
filesystem.o : joke_fs.c
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
filesystem.o: joke_fs.c
$(CC) -o $@ -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" joke_fs.c
ppmtoinfo.o : ppmtoinfo.c
ppmtoinfo.o: ppmtoinfo.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -DAMIWM_HOME=\"$(AMIWM_HOME)\" $<
gram.h gram.c: gram.y
$(YACC) $(YFLAGS) $<
mv y.tab.c gram.c
mv y.tab.h gram.h
gram.tab.c gram.tab.h: gram.y
$(YACC) -b gram -d gram.y
lex.c : lex.l
kbdmodule.tab.c kbdmodule.tab.h: kbdmodule.y
$(YACC) -b kbdmodule -d kbdmodule.y
lex.c: lex.l
$(LEX) -t $< > lex.c
kbdmodule.h kbdmodule.c: kbdmodule.y
$(YACC) $(YFLAGS) $<
mv y.tab.c kbdmodule.c
mv y.tab.h kbdmodule.h
kbdlexer.c : kbdlexer.l
kbdlexer.c: kbdlexer.l
$(LEX) -t $< > kbdlexer.c
install : $(PROGS) $(MODULES) Xsession Xsession2 Xinitrc amiwm-init
-mkdir -p $(AMIWM_HOME)
$(INSTALL) $(STRIPFLAG) requestchoice $(AMIWM_HOME)/requestchoice
$(INSTALL) $(STRIPFLAG) executecmd $(AMIWM_HOME)/executecmd
lex.o: gram.tab.h
kbdlexer.o: kbdmodule.tab.h
install: $(PROGS) $(MODULES) system.amiwmrc Xsession Xsession2 Xinitrc amiwm-init
-mkdir -p $(DESTDIR)$(AMIWM_HOME)
-mkdir -p $(DESTDIR)$(AMIWM_MODULES)
$(INSTALL) $(STRIPFLAG) requestchoice $(DESTDIR)$(AMIWM_HOME)/requestchoice
$(INSTALL) $(STRIPFLAG) config_util $(DESTDIR)$(AMIWM_HOME)/config_util
$(INSTALL) $(STRIPFLAG) executecmd $(DESTDIR)$(AMIWM_HOME)/executecmd
for module in $(MODULES); do \
if [ "$$module" = "$(srcdir)/Background" ]; then \
$(INSTALL) $$module $(AMIWM_HOME)/Background; \
if [ "$$module" = "Background" ]; then \
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background; \
else \
$(INSTALL) $(STRIPFLAG) $$module $(AMIWM_HOME)/$$module; \
if [ "$$module" = "Background_resize" ]; then \
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background_resize; \
else \
if [ "$$module" = "Background_stretch" ]; then \
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/Background_stretch; \
else \
if [ "$$module" = "def_tool.info" ]; then \
$(INSTALL) $$module $(DESTDIR)$(AMIWM_MODULES)/def_tool.info; \
else \
$(INSTALL) $(STRIPFLAG) $$module $(DESTDIR)$(AMIWM_MODULES)/$$module; \
fi; \
fi; \
fi; \
fi; \
done
$(INSTALL) -m 644 $(srcdir)/system.amiwmrc $(AMIWM_HOME)/system.amiwmrc
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(AMIWM_HOME)/def_tool.info
$(INSTALL) -m 644 $(srcdir)/system.map $(AMIWM_HOME)/system.map
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(AMIWM_HOME)/magicwb.map
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(AMIWM_HOME)/schwartz.map
$(INSTALL) -m 755 Xsession $(AMIWM_HOME)/Xsession
$(INSTALL) -m 755 Xsession2 $(AMIWM_HOME)/Xsession2
$(INSTALL) -m 755 Xinitrc $(AMIWM_HOME)/Xinitrc
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(AMIWM_HOME)/amiwm-init
-mkdir -p $(bindir)
$(INSTALL) $(STRIPFLAG) amiwm $(bindir)/amiwm
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(bindir)/ppmtoinfo
$(RM) $(bindir)/requestchoice
$(LN_S) $(AMIWM_HOME)/requestchoice $(bindir)/requestchoice
-mkdir -p $(mandir)/man1
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(mandir)/man1/amiwm.1
$(INSTALL) -m 644 system.amiwmrc $(DESTDIR)$(AMIWM_HOME)/system.amiwmrc
$(INSTALL) -m 644 $(srcdir)/def_disk.info $(DESTDIR)$(AMIWM_HOME)/def_tool.info
$(INSTALL) -m 644 $(srcdir)/def_drawer.info $(DESTDIR)$(AMIWM_HOME)/def_drawer.info
$(INSTALL) -m 644 $(srcdir)/def_project.info $(DESTDIR)$(AMIWM_HOME)/def_project.info
$(INSTALL) -m 644 $(srcdir)/def_tool.info $(DESTDIR)$(AMIWM_HOME)/def_tool.info
$(INSTALL) -m 644 $(srcdir)/system.map $(DESTDIR)$(AMIWM_HOME)/system.map
$(INSTALL) -m 644 $(srcdir)/magicwb.map $(DESTDIR)$(AMIWM_HOME)/magicwb.map
$(INSTALL) -m 644 $(srcdir)/schwartz.map $(DESTDIR)$(AMIWM_HOME)/schwartz.map
$(INSTALL) -m 755 Xsession $(DESTDIR)$(AMIWM_HOME)/Xsession
$(INSTALL) -m 755 Xsession2 $(DESTDIR)$(AMIWM_HOME)/Xsession2
$(INSTALL) -m 755 Xinitrc $(DESTDIR)$(AMIWM_HOME)/Xinitrc
$(INSTALL) -m 755 $(srcdir)/amiwm-init $(DESTDIR)$(AMIWM_HOME)/amiwm-init
-mkdir -p $(DESTDIR)$(bindir)
$(INSTALL) $(STRIPFLAG) amiwm $(DESTDIR)$(bindir)/amiwm
$(INSTALL) $(STRIPFLAG) ppmtoinfo $(DESTDIR)$(bindir)/ppmtoinfo
$(RM) $(DESTDIR)$(bindir)/requestchoice
$(LN_S) $(AMIWM_HOME)/requestchoice $(DESTDIR)$(bindir)/requestchoice
-mkdir -p $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 $(srcdir)/amiwm.1 $(DESTDIR)$(mandir)/man1/amiwm.1
fs-install : Filesystem
$(INSTALL) $(STRIPFLAG) Filesystem $(AMIWM_HOME)/Filesystem
$(INSTALL) -m 644 def_disk.info $(AMIWM_HOME)/def_disk.info
$(INSTALL) -m 644 def_drawer.info $(AMIWM_HOME)/def_disk.info
fs-install: Filesystem
$(INSTALL) $(STRIPFLAG) Filesystem $(DESTDIR)$(AMIWM_HOME)/Filesystem
$(INSTALL) -m 644 def_disk.info $(DESTDIR)$(AMIWM_HOME)/def_disk.info
$(INSTALL) -m 644 def_drawer.info $(DESTDIR)$(AMIWM_HOME)/def_disk.info
cde-install : Xresources.amiwm Amilogo.bm Amilogo.pm
-mkdir -p $(DT_DIR)/config/C/Xresources.d
$(INSTALL) -m 644 Xresources.amiwm $(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
-mkdir -p $(DT_DIR)/appconfig/icons/C
$(INSTALL) -m 644 Amilogo.bm $(DT_DIR)/appconfig/icons/C/Amilogo.bm
$(INSTALL) -m 644 Amilogo.pm $(DT_DIR)/appconfig/icons/C/Amilogo.pm
cde-install: Xresources.amiwm Amilogo.bm Amilogo.pm
-mkdir -p $(DESTDIR)$(DT_DIR)/config/C/Xresources.d
$(INSTALL) -m 644 Xresources.amiwm $(DESTDIR)$(DT_DIR)/config/C/Xresources.d/Xresources.amiwm
-mkdir -p $(DESTDIR)$(DT_DIR)/appconfig/icons/C
$(INSTALL) -m 644 Amilogo.bm $(DESTDIR)$(DT_DIR)/appconfig/icons/C/Amilogo.bm
$(INSTALL) -m 644 Amilogo.pm $(DESTDIR)$(DT_DIR)/appconfig/icons/C/Amilogo.pm
amiwm : $(OBJS) $(LIBAMI)
$(CC) -o amiwm $(OBJS) $(LIBS)
amiwm: $(OBJS) $(LIBAMI)
$(CC) $(LDFLAGS) -o amiwm $(OBJS) $(LIBS)
requestchoice : requestchoice.o $(LIBAMI)
$(CC) -o requestchoice requestchoice.o $(LIBS)
requestchoice: requestchoice.o $(LIBAMI)
$(CC) $(LDFLAGS) -o requestchoice requestchoice.o $(LIBS)
executecmd : executecmd.o $(LIBAMI)
$(CC) -o executecmd executecmd.o $(LIBS)
config_util: config_util.o $(LIBAMI)
$(CC) $(LDFLAGS) -o config_util config_util.o $(LIBS)
Filesystem : filesystem.o $(LIBAMI)
$(CC) -o Filesystem filesystem.o $(LIBS)
executecmd: executecmd.o $(LIBAMI)
$(CC) $(LDFLAGS) -o executecmd executecmd.o $(LIBS)
Keyboard : kbdmodule.o kbdlexer.o $(LIBAMI)
$(CC) -o Keyboard kbdmodule.o kbdlexer.o $(LIBS)
Filesystem: filesystem.o $(LIBAMI)
$(CC) $(LDFLAGS) -o Filesystem filesystem.o $(LIBS)
Launcher : launchermodule.o $(LIBAMI)
$(CC) -o Launcher launchermodule.o $(LIBS)
Keyboard: kbdmodule.tab.o kbdlexer.o $(LIBAMI)
$(CC) $(LDFLAGS) -o Keyboard kbdmodule.tab.o kbdlexer.o $(LIBS)
ppmtoinfo : ppmtoinfo.o
$(CC) -o ppmtoinfo ppmtoinfo.o -lm
Battery: battery_module.o $(LIBAMI)
$(CC) $(LDFLAGS) -o Battery battery_module.o $(LIBS)
localetest : localetest.o $(LIBAMI)
$(CC) -o localetest localetest.o $(LIBS)
Launcher: launchermodule.o $(LIBAMI)
$(CC) $(LDFLAGS) -o Launcher launchermodule.o $(LIBS)
clean :
$(RM) core $(PROGS) $(LIBAMI) Keyboard Launcher *.o libami/*.o
$(RM) lex.yy.c lex.c y.tab.c y.tab.h gram.h gram.c
$(RM) kbdlexer.c kbdmodule.h kbdmodule.c
ppmtoinfo: ppmtoinfo.o
$(CC) $(LDFLAGS) -o ppmtoinfo ppmtoinfo.o -lm
localetest: localetest.o $(LIBAMI)
$(CC) $(LDFLAGS) -o localetest localetest.o $(LIBS)
clean: lib_clean
$(RM) core $(PROGS) $(LIBAMI) Keyboard Battery Launcher *.o
$(RM) lex.yy.c lex.c gram.tab.h gram.tab.c
$(RM) kbdlexer.c kbdmodule.tab.h kbdmodule.tab.c
$(RM) config.log
distclean : clean
distclean: clean
$(RM) config.status config.cache *~
$(RM) Makefile libami/Makefile Xresources.amiwm Xsession Xsession2 Xinitrc
spotless : distclean
spotless: distclean
TAGS:
etags *.[ch] libami/*.[ch]
patch :
patch:
mv version.h old_version.h
sed < old_version.h 's/l/"/' | awk '-F"' '{ printf "%s\"%sl%s\"\n",$$1,$$2,1+$$3 }' > version.h
rm old_version.h
dist : version.h clean
dist: version.h clean
( version=`sed < version.h -e 's/^[^"]*"//' -e 's/"[^"]*$$//'`; \
tarname="$(PACKAGENAME)$$version.tar"; \
mkdir $(PACKAGENAME)$$version; \
@@ -184,8 +212,8 @@ dist : version.h clean
gzip $$tarname; \
)
$(srcdir)/configure: $(srcdir)/configure.in
autoconf $(srcdir)/configure.in > $(srcdir)/configure
$(srcdir)/configure: $(srcdir)/configure.ac
autoconf $(srcdir)/configure.ac > $(srcdir)/configure
config.status: $(srcdir)/configure
$(srcdir)/configure
@@ -196,18 +224,8 @@ Makefile: $(srcdir)/Makefile.in config.status
libami/Makefile: $(srcdir)/libami/Makefile.in config.status
./config.status
Xresources.amiwm: $(srcdir)/Xresources.amiwm.in
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xresources.amiwm.in > Xresources.amiwm
Xsession: $(srcdir)/Xsession.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession.in > Xsession
Xsession2: $(srcdir)/Xsession2.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xsession2.in > Xsession2
Xinitrc: $(srcdir)/Xinitrc.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < $(srcdir)/Xinitrc.in > Xinitrc
system.amiwmrc Xresources.amiwm Xsession Xsession2 Xinitrc: %: $(srcdir)/%.in config.status
sed -e 's:[@]bindir[@]:$(bindir):g' -e 's:[@]AMIWM_HOME[@]:$(AMIWM_HOME):g' < "$<" > "$@"
depend:: $(SRCS)
-@rm Makefile.bak

174
README
View File

@@ -1,174 +0,0 @@
< amiwm > by Marcus Comstedt (marcus@mc.pp.se)
0. Legal notices
This program is distributed as FreeWare. The copyright remains with
the author. See the file LICENSE for more information.
Amiga and Workbench are registered trademarks of AMIGA International Inc.
1. Intro
This is amiwm, an X window manager that tries to make your workstation
look like an Amiga®. "Why?" you ask. Because I wanted it to. So there!
2. Compiling etc.
For instructions on building and installing, read the file INSTALL.
3. Configuration
amiwm reads the file .amiwmrc in the directory pointed to by $HOME
when starting. If this file does not exist, it reads the file
system.amiwmrc instead.
The configuration file can contain any of the following statements:
FastQuit {yes|no}
Specifies whether amiwm should quit directly when the Quit menu item
is selected, rather than popping up a requester.
(on/off or true/false can be used instead of yes/no.)
SizeBorder {right|bottom|both|none}
Specifies which border should be enlarged when a sizegadget is present.
ForceMove {manual|auto|always}
Enables you to move windows outside the perimeter of the root window
when pressing shift, when trying to drag at least 25% of the window
ofscreen, or always, respectively.
IconDir "path"
Specifies a directory in which amiwm will look for icons.
DefaultIcon "name"
Gives the filename of the .info file to use as a default icon.
It is relative to the IconDir.
IconPalette {system|magicwb|schwartz|"filename"}
Selects either the Workbench® default palette, or the MagicWorkbench
standard palette for use with icons. The third option is a 16 color
palette used on the "Eric Schwartz Productions CD Archive". Alternatively,
the filename of a PPM file representing the palette to use can be used.
ScreenFont "fontname"
Selects a font to use for windowtitles etc.
IconFont "fontname"
Selects a font for icontitles.
{detailpen|blockpen|textpen|shinepen|shadowpen|fillpen|filltextpen|
backgroundpen|highlighttextpen|bardetailpen|barblockpen|
bartrimpen} "colorname"
Modifies the colour scheme for the window manager.
CustomIconsOnly {yes|no}
This prevent applications to display their own icons when in iconified state.
Only icons defined in amiwmrc for each apps will be used.
Because apps own icon are too different from one eachother.
They comes in various sizes and themes. Some icons will be 32x32,
while some other will be a 128x128 or even bigger .. By using this option,
You have the possibility to decide which icon should be used for each app.
If no custom icons are defined at all, the def_tool.info will be used for
all iconified apps. Format is: style { class "myClass" icon "myIcon.info" }
To find out a given program's class, use "xlsclients -l" to list all opened
applications, and then use "xprop -id <0x0000000>" to list a
given app's properties. Use either WM_CLASS or WM_ICON_NAME strings in amiwmrc.
ShortLabelIcons {yes|no}
This limit the length of the text for iconified programs. For example, if this
option is activated, an iconified program text will be limited to 8 chars + ".."
Use this option if you don't want iconified program text to be loong strings..
TitleBarClock {yes|no}
Enables a clock in the titlebar. It displays the date and time.
TitleClockFormat [<number>] "time string"
This lets you choose a new format to display the Title Bar Clock.
The time string is formatted with the standard strftime() parameters.
The default is "%c". It has been found that "%a %b %e %Y %l:%M %p" works
well too. Number is the update interval in seconds.
ToolItem "name" "command" ["hotkey"]
Adds an item in the Tools menu with the specified name, which executes
the command when selected. A string containing a single uppercase letter
may be specified as the third argument, making this letter a hotkey for the
item.
ToolItem Separator
Inserts a separator bar in the Tools menu.
ToolItem "name" { <tool item commands> }
Create ToolItem:s in a submenu with the specified name. It is not legal
to create a submenu inside another submenu.
Screen [<number>] "name"
Create a new screen with the specified name. It will be placed below all
earlier created screens. To move a window between two screens, iconify it
and drag the icon over to the other screen. If the second argument is given,
this screen is placed on the corresponding X screen.
ModulePath "path(:path...)"
Sets one or more directories where amiwm will look for module binaries.
The default is AMIWM_HOME. Note that the module binaries cannot be
shared amongst different architectures.
Module "name" ["initstring"]
Start a module with the specified name. If initstring is specified, it
is sent to the module. There are currently two modules shipped with
amiwm; Background and Keyboard. These are documented in the file
README.modules. If a module is limited to a single screen, like the
Background module, the screen that was created last is used.
InterScreenGap number
Sets the size in number of pixels of the "video DMA off" area that appears
between screens when they are dragged.
AutoRaise {yes|no}
Selects wheteher windows will automatically be moved to the front when
they are activated.
Focus {followmouse|sloppy|clicktotype}
Sets the policy by which windows are given focus. Followmouse is the
default and means that the window that contains the mouse pointer will
have focus. Sloppy means that the window that had focus last will keep
it when the pointer is not over a window. ClickToType is the original AmigaOS
policy in which you have to explicitly give focus to windows by clicking
in them.
4. Troubleshooting
The most likely reason for the windowmanager to crash is if it
can't find its default icon, or if this is not accepted as an
.info file. If this happens, amiwm _will_ dump core. So make
sure that either 'make install' runs successfully (in which case
amiwm will know where its icon is), or that the file .amiwmrc
contains a correct specification of the icon's location.
Don't mail me bug reports just because amiwm prints "Bad Window" on
stderr once in a while. Redirect it to /dev/null or live with it. :)

View File

@@ -1,2 +1,62 @@
# amiwm
Amiga Workbench-like Window Manager for Xorg
Amiga Workbench inspired window manager for Xorg.
## Upstream repository
The current upstream repository for this particular fork is at
[https://github.com/amiwm/amiwm](https://github.com/amiwm/amiwm).
Please file tickets, pull requests, etc there.
## Getting started
Before compiling, make sure that you have following packages installed:
```
gcc make autoconf xorg xorg-xinit xorg-dev
```
First, run configuration script:
```
./configure
```
After that, you can either edit the Makefile, or leave it as is. After that, compile and install amiwm using
```
make
sudo make install
```
Hopefully, your compilation was succesfull - now you should have amiwm installed!
## Launching amiwm
To launch amiwm, use
```
startx amiwm
```
Or add "amiwm" to your xinitrc file
## Configuration
Configuration utility is not yet available; To configure amiwm, you'll need
to create and edit .amiwmrc file in your home directory. To do so, read
amiwm's manpage.
## Authors
Originally created by **Marcus Comstedt**;
Contributions by
* Scott Lawrence
* Nicolas Sipieter
* redsPL.
## Previous repositories
Previously, amiwm was using bzr instead of git; The bzr repository can be found [here](http://mc.pp.se/bzr/amiwm/)
This repository started as a fork from [https://github.com/sdomi/amiwm](https://github.com/sdomi/amiwm).
## License
This project is published under a custom license - see [LICENSE.md](LICENSE.md) for details.
Amiga, AmigaOS and Workbench are registered trademarks of AMIGA International Inc.

View File

@@ -1,70 +0,0 @@
Background module
-----------------
To get background images on your screens, use the Background module.
The Module command should come after the Screen command, and the
initstring should be the filename of the picture(*). Example:
Screen "My Screen"
Module "Background" "~/pliki/im"
The Background module is really a shell script that requires that the
program 'display' from imagemagick package. Currently, it doesn't
support any standard imagemagick parameters.
Keyboard module
---------------
With the Keyboard module, you can bind window manager functions to keys
on the keyboard. The initstring should consist of keybindings on the
form
modifiers<keysym>:where:func
modifiers
=========
Modifiers is 0 or more of:
Shift Control Meta Lock
Mod1 Mod2 Mod3 Mod4 Mod5
Button1 Button2 Button3 Button4 Button5
The modifiers listed must be pressed together with the key to activate
the binding.
keysym
======
Keysym is a standard X keysym name, like F1 or Prior.
where
=====
where is either "all", or one or more of window, frame, icon, root
separated with '|' (bar). This controls in what areas of the screen
that the key will be active.
func
====
The function to perform when the key is pressed.
Currently the following are defined:
rotatescreens - Move the frontmost screen to the back
front - Move the window in which the key is pressed to the front
back - Move the window in which the key is pressed to the back
iconify - Iconify the window in which the key is pressed
Example:
Module "Keyboard" "\
Meta<F1>:window|frame:front\
Meta<F2>:window|frame:iconify\
Meta<F3>:window|frame:back"
This binds the keys Meta-F1, Meta-F2 and Meta-F3 to front, back and
iconify respectively. The will only have effect inside windows and in
window frames. (These are the only places that front/iconfy/back has
effect anyway.)

18
Xinitrc
View File

@@ -1,18 +0,0 @@
#!/bin/ksh
# AmiWM startup script
xrdb $OPENWINHOME/lib/Xdefaults # Load Default X11 resource database
if [ -f $HOME/.Xdefaults ]; then
xrdb -merge $HOME/.Xdefaults # Load Users X11 resource database
fi
xsetroot -solid black
/usr/local/bin/amiwm & wmpid=$!
if [ -x $HOME/.amiwm-init ]; then
$HOME/.amiwm-init # Custom amiwm tools
else
/usr/local/lib/amiwm/amiwm-init # Default amiwm tools
fi
wait $wmpid # Wait for wm (key client) to exit

View File

@@ -1,4 +1,4 @@
#!/bin/ksh
#!/bin/sh
# AmiWM startup script
xrdb $OPENWINHOME/lib/Xdefaults # Load Default X11 resource database

View File

@@ -1,26 +0,0 @@
#!/bin/ksh
if [ -z "$SESSIONTYPE" ]
then
export SESSIONTYPE="altDt"
fi
if [ -z "$DTSTARTIMS" ]
then
export DTSTARTIMS="False"
fi
if [ -z "$SDT_ALT_SESSION" ]
then
export SDT_ALT_SESSION="/usr/local/lib/amiwm/Xsession2"
fi
if [ -z "$SDT_ALT_HELLO" ]
then
export SDT_ALT_HELLO="/usr/dt/bin/dthello -string 'Starting the AmiWM Desktop' &"
fi
export SDT_NO_DSDM=""
/usr/dt/bin/Xsession

View File

@@ -1,4 +1,4 @@
#!/bin/ksh
#!/bin/sh
if [ -z "$SESSIONTYPE" ]
then

View File

@@ -1,34 +0,0 @@
#!/bin/ksh
unset SDT_ALT_SESSION
unset SDT_ALT_HELLO
unset SDT_NO_DSDM
#
# Find "xinitrc" file by standard precedence rules and start
# the user's AmiWM Desktop.
#
DEFAULT_XINITRC="/usr/local/lib/amiwm/Xinitrc"
HOME_XINITRC="$HOME/.xinitrc"
if [ -z "$XINITRC" ]; then
if [ -f $HOME_XINITRC ]; then
XINITRC=$HOME_XINITRC
else
XINITRC=$DEFAULT_XINITRC
fi
fi
echo "AmiWM Desktop Login"
if [ -f $XINITRC ]; then
echo "using xinitrc file: $XINITRC"
/bin/ksh $XINITRC
else
echo "xinitrc file: $XINITRC not found"
if [ -f $DEFAULT_XINITRC ]; then
echo "using xinitrc: $DEFAULT_XINITRC"
/bin/ksh $DEFAULT_XINITRC
fi
fi

View File

@@ -1,4 +1,4 @@
#!/bin/ksh
#!/bin/sh
unset SDT_ALT_SESSION
unset SDT_ALT_HELLO
@@ -24,11 +24,11 @@ HOME_XINITRC="$HOME/.xinitrc"
if [ -f $XINITRC ]; then
echo "using xinitrc file: $XINITRC"
/bin/ksh $XINITRC
/bin/sh $XINITRC
else
echo "xinitrc file: $XINITRC not found"
if [ -f $DEFAULT_XINITRC ]; then
echo "using xinitrc: $DEFAULT_XINITRC"
/bin/ksh $DEFAULT_XINITRC
/bin/sh $DEFAULT_XINITRC
fi
fi

3
amiwm-init Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
xterm -sb -sl 1000 -C -geometry 80x16+0-0 -name Console &

801
amiwm.1
View File

@@ -1,187 +1,632 @@
.\" @(#)amiwm.1
'\"macro stdmacro
.nr X
.TH amiwm 1 "26 Mar 2017"
.SH NAME
amiwm \- Amiga Workbench-like X Window Manager
.SH SYNOPSIS
amiwm
.SH DESCRIPTION
.I amiwm
is an X Window manager that tries to make your workstation look like
an Amiga\*R.
.SH OPTIONS
.I Amiwm
is configurable with a $HOME/\.amiwmrc-file containing some or all
of the following options:
.SH FastQuit: {yes|no}
Specifies whether amiwm should quit directly when the Quit
.Dd January 15, 2026
.Dt AMIWM 1
.Os
.
.Sh NAME
.Nm amiwm
.Nd Amiga Workbench-like X Window Manager
.
.Sh SYNOPSIS
.Nm
.
.Sh DESCRIPTION
.Nm
is an X Window manager that tries to make your workstation look like an Amiga\*R.
.
.Pp
Windows are controlled with the pointer as follows:
.Bl -column "Maximize button" "Double-click" XXXX
.It Sy Target Ta Sy Operation Ta Sy Description
.It Anywhere Ta Left-click Ta If the
.Ic Focus
police is
.Cm clicktotype ,
focus window.
If the
.Ic AutoRaise
option is on, raise it as well.
.It Anywhere Ta Hover Ta If the
.Ic Focus
police is either
.Cm followmouse
or
.Cm sloppy ,
focus window.
If the
.Ic AutoRaise
option is on, raise it as well.
.It Titlebar Ta Left-drag Ta Move window.
.It Titlebar Ta Double-click Ta Raise window.
.It Close button Ta Left-click Ta Close application.
.It Iconify button Ta Left-click Ta Iconify window.
.It Maximize button Ta Left-click Ta Maximize window.
.It Raise button Ta Left-click Ta Raise window.
.It Resize handle Ta Left-click Ta Resize window.
.El
.
.Pp
.Nm
can minimize windows into icons that are gathered on a screen.
Icons controlled with the pointer as follows:
.Bl -column "Icon" "Double-click" XXXX
.It Sy Target Ta Sy Operation Ta Sy Description
.It Icon Ta Double-click Ta De-iconify window.
.It Icon Ta Left-drag Ta Move icon around the screen
or into another screen.
(The only way to move a window into another screen is by iconifying it,
moving the icon,
and then de-iconifying it.)
.El
.
.Pp
.Nm
can keep several workbench screens (or just "screens" for short)
where windows are displayed.
Each screen has a titlebar above it displaying its name, and a few widgets.
Screens are controlled with the pointer as follows:
.Bl -column "Raise button" "Right-release" XXXX
.It Sy Target Ta Sy Operation Ta Sy Description
.It Titlebar Ta Left-drag Ta Move screen up/down
to reveal/hide other screens.
.It Titlebar Ta Right-press Ta Reveal the menus.
.It Menu Ta Right-drag Ta Navigate through menus.
.It Menu entry Ta Right-release Ta Activate menu entry.
.It Icon Ta Double-click Ta Launch program
(see
.Sx Launcher module
below).
.It Raise button Ta Left-click Ta Raise screen.
.El
.
.Pp
Configuration utility is not yet available.
To configure amiwm, create and edit
.Pa .amiwmrc
file in your home directory.
The configuration file is described at the
.Sx CONFIGURATION
section below.
.
.Sh CONFIGURATION
.Pa "~/.amiwmrc"
is the configuration file for
.Nm .
.
.Pp
Empty lines and lines beginning with
.Sq #
are ignored.
Each other line is a configuration option and its arguments.
The options are as follows:
.Bl -column highlighttextpen def_tool.info XXXXXX
.It Option Ta Default Ta Arguments
.It Ic AutoRaise Ta Cm off Ta Ar boolean
.It Ic BatteryInfo Ta Cm off Ta Ar boolean
.It Ic CustomIconsOnly Ta Cm off Ta Ar boolean
.It Ic DefaultIcon Ta Cm def_tool.info Ta Qq Ar filename
.It Ic FastQuit Ta Cm off Ta Ar boolean
.It Ic Focus Ta Cm followmouse Ta Cm followmouse Ns | Ns Cm sloppy Ns | Ns Cm clicktotype
.It Ic ForceMove Ta Cm manual Ta Cm manual Ns | Ns Cm auto Ns | Ns Cm always
.It Ic IconDir Ta "" Ta Qq Ar path
.It Ic IconFont Ta "" Ta Qq Ar fontname
.It Ic IconPalette Ta Cm system Ta Cm system Ns | Ns Cm magicwb Ns | Ns Cm schwartz Ns | Ns Ar filename
.It Ic InterScreenGap Ta 0 Ta Ar number
.It Ic Module Ta "" Ta Qo Ar name Qc Op Qq initstring
.It Ic ModulePath Ta "" Ta Qq Ar path Ns Op Cm :\& Ns Ar path ...
.It Ic OpaqueMove Ta False Ta Ar boolean
.It Ic OpaqueResize Ta False Ta Ar boolean
.It Ic Screen Ta "" Ta Oo Ar number Oc Ar screenname
.It Ic ScreenFont Ta "" Ta Qq Ar fontname
.It Ic ShortLabelIcons Ta Cm off Ta Ar boolean
.It Ic SizeBorder Ta Cm right Ta Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
.It Ic TitleBarClock Ta Cm ... Ta Qq Ar boolean
.It Ic TitleClockFormat Ta Qq "%c" Ta Oo Ar number Oc Ar timeformat
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Cm { Ar ToolItem Ns s ... Cm }
.It Ic ToolItem Ta "" Ta Qo Ar name Qc Qo Ar command Qc Qo Ar hotkey Qc
.It Ic ToolItem Ta "" Ta Ic Separator
.It Ic backgroundpen Ta Cm ... Ta Qq Ar colorname
.It Ic barblockpen Ta Cm ... Ta Qq Ar colorname
.It Ic bardetailpen Ta Cm ... Ta Qq Ar colorname
.It Ic bartrimpen Ta Cm ... Ta Qq Ar colorname
.It Ic blockpen Ta Cm ... Ta Qq Ar colorname
.It Ic detailpen Ta Cm ... Ta Qq Ar colorname
.It Ic fillpen Ta Cm ... Ta Qq Ar colorname
.It Ic filltextpen Ta Cm ... Ta Qq Ar colorname
.It Ic highlighttextpen Ta Cm ... Ta Qq Ar colorname
.It Ic shadowpen Ta Cm ... Ta Qq Ar colorname
.It Ic shinepen Ta Cm ... Ta Qq Ar colorname
.It Ic style Ta "" Ta Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
.It Ic textpen Ta Cm ... Ta Qq Ar colorname
.El
.
.Pp
Some options, like
.Ic ToolItem ,
have different syntaxes,
each with different sets of arguments.
Some options, like one of the forms of
.Ic ToolItem ,
expect as argument a block of options, one per line, around curly braces.
.
.Pp
For the arguments,
.Ar boolean
can be
.Cm on Ns | Ns Cm off
or
.Cm true Ns | Ns Cm false
or
.Cm yes Ns | Ns Cm no .
.
.Ss General options
.Bl -tag -width Ds
.It Ic AutoRaise Ar bool
Selects whether windows will automatically be moved to the front when they are activated.
.
.It Ic FastQuit Ar boolean
Specifies whether amiwm should quit directly when the
.Em Quit
menu item is selected, rather than popping up a requester.
(on/off or true/false can be used instead of yes/no.)
.SH SizeBorder {right|bottom|both|none}
Specifies which border should be enlarged when a sizegadget is present.
.SH ForceMove {manual|auto|always}
Enables you to move windows outside the perimeter of the root window
when pressing shift, when trying to drag at least 25% of the window
ofscreen, or always, respectively.
.SH IconDir path
Specifies a directory in which amiwm will look for icons.
.SH DefaultIcon name
Gives the filename of the .info file to use as a default icon.
It is relative to the IconDir.
.SH IconPalette {system|magicwb|schwartz|\f1\*(lq\f3filename"}
Selects either the Workbench\*R default palette, or the MagicWorkbench
standard palette for use with icons. The third option is a 16 color
palette used on the "Eric Schwartz Productions CD Archive". Alternatively,
the filename of a PPM file representing the palette to use can be used.
.SH ScreenFont \f1\*(lq\f3fontname"
.
.It Ic Focus Cm followmouse Ns | Ns Cm sloppy Ns | Ns Cm clicktotype
Sets the policy by which windows are given focus:
.Bl -tag -width followmouse
.It Cm followmouse
The window that contains the mouse pointer will have focus.
This is the default.
.It Cm sloppy
The window that had focus last will keep it when the pointer is not over a window.
.It Cm clicktotype
You have to explicitly give focus to windows by clicking in them.
This is the original AmigaOS policy.
.El
.
.It Ic ForceMove Cm manual Ns | Ns Cm auto Ns | Ns Cm always
Allows you to move windows outside the perimeter of the root window when pressing shift,
when trying to drag at least 25% of the window ofscreen,
or always, respectively.
.
.It Ic OpaqueMove Ar bool
Whether moving a window by dragging its titlebar should move the window in real time;
or just move a frame indicating where the window will be after releasing the mouse button.
.
.It Ic OpaqueResize Ar bool
Whether resizing a window by dragging its resize handle should resize the window in real time;
or just resize a frame indicating the window's final size after releasing the mouse button.
.El
.
.Ss Windows decorations
.Bl -tag -width Ds
.It Ic ScreenFont Qq Ar fontname
Selects a font to use for windowtitles etc.
.SH IconFont \f1\*(lq\f3fontname"
Selects a font for icontitles.
.SH {detailpen|blockpen|textpen|shinepen|shadowpen|fillpen|filltextpen|
backgroundpen|highlighttextpen|bardetailpen|barblockpen|
bartrimpen} \f1\*(lq\f3colorname"
Modifies the colour scheme for the window manager.
.SH CustomIconsOnly {yes|no}
.
.It Ic SizeBorder Cm right Ns | Ns Cm bottom Ns | Ns Cm both Ns | Ns Cm none
Specifies which border should be enlarged when a sizegadget is present.
.
.It Ic detailpen Qq Ar colorname
TODO.
.
.It Ic blockpen Qq Ar colorname
TODO.
.
.It Ic textpen Qq Ar colorname
TODO.
.
.It Ic shinepen Qq Ar colorname
TODO.
.
.It Ic shadowpen Qq Ar colorname
TODO.
.
.It Ic fillpen Qq Ar colorname
TODO.
.
.It Ic filltextpen Qq Ar colorname
TODO.
.
.It Ic backgroundpen Qq Ar colorname
TODO.
.
.It Ic highlighttextpen Qq Ar colorname
TODO.
.
.It Ic bardetailpen Qq Ar colorname
TODO.
.
.It Ic barblockpen Qq Ar colorname
TODO.
.
.It Ic bartrimpen Qq Ar colorname
TODO.
.El
.
.Ss Icon options
.Bl -tag -width Ds
.It Ic CustomIconsOnly Ar boolean
This prevent applications to display their own icons when in iconified state.
Only icons defined in amiwmrc for each apps will be used.
Because apps own icon are too different from one eachother.
They comes in various sizes and themes. Some icons will be 32x32,
while some other will be a 128x128 or even bigger .. By using this option,
You have the possibility to decide which icon should be used for each app.
If no custom icons are defined at all, the def_tool.info will be used for
all iconified apps. Format is: style { class "myClass" icon "myIcon.info" }
To find out a given program's class, use "xlsclients -l" to list all opened
applications, and then use "xprop -id <0x0000000>" to list a
given app's properties. Use either WM_CLASS or WM_ICON_NAME strings in amiwmrc.
.SH ShortLabelIcons {yes|no}
This limit the length of the text for iconified programs. For example, if this
option is activated, an iconified program text will be limited to 8 chars + ".."
Use this option if you don't want iconified program text to be loong strings..
.SH TitleBarClock {yes|no}
Enables a clock in the titlebar. It displays the date and time.
.SH TitleClockFormat [<number>] "time string"
.
.Pp
Because apps' own icons are too different from one eachother,
they comes in various sizes and themes.
Some icons will be 32x32, while some other will be a 128x128 or even bigger.
By using this option,
You can use the
.Ic style
option below to set which icon should be used for each app.
If no custom icons are defined at all, the
.Pa def_tool.info will
be used for all iconified apps.
.
.It Ic DefaultIcon Qq Ar filename
Set
.Ar filename
of the
.Pa .info
file as default icon.
It is relative to the
.Ic IconDir .
Default value
.Qq Pa def_tool.info .
.
.It Ic IconDir Qq Ar path
Directory in which amiwm will look for icons.
.
.It Ic IconFont Qq Ar fontname
Font for icontitles.
.
.It Ic IconPalette Cm system Ns | Ns Cm magicwb Ns | Ns Cm schwartz Ns | Ns Ar filename
Selects either the Workbench\*R default palette,
or the MagicWorkbench standard palette for use with icons.
The third option is a 16 color palette used on the "Eric Schwartz Productions CD Archive".
Alternatively, the
.Ar filename
of a PPM file representing the palette to use can be used.
.
.It Ic ShortLabelIcons Ar boolean
This limit the length of the text for iconified programs.
For example, if this option is activated,
an iconified program text will be limited to 8 chars + ".."
Use this option if you don't want iconified program text to be loong strings.
.
.It Ic style Cm "{" Cm class Qo Ar classname Qc Cm icon Qo Ar filename Qc Cm "}"
Set the icon
.Ar filename
for windows of the given class.
To find out a program's class, run
.Dl $ xlsclients -l
to list all opened applications,
and then run
.Dl $ xprop -id <0x0000000>
to list a given app's properties.
Use either
.Dv WM_CLASS
or
.Dv WM_ICON_NAME
strings in amiwmrc.
.El
.
.Ss TitleBar and MenuBar
.Bl -tag -width Ds
.It Ic BatteryInfo Ar boolean
This lets you display battery information on the menu bar.
It reqiures a module (such as Battery)
to gather current battery status and push it into amiwm to display.
.
.It Ic TitleBarClock Ar boolean
Enables a clock in the titlebar.
It displays the date and time.
.
.It Ic TitleClockFormat Oo Ar number Oc Ar timeformat
This lets you choose a new format to display the Title Bar Clock.
The time string is formatted with the standard strftime() parameters.
The default is "%c". It has been found that "%a %b %e %Y %l:%M %p" works
well too. Number is the update interval in seconds.
.SH ToolItem \f1\*(lq\f3name" \f1\*(lq\f3command" \f1\*(lq\f3hotkey"
Adds an item in the Tools menu with the specified name, which executes
the command when selected. A string containing a single uppercase letter
may be specified as the third argument, making this letter a hotkey for the
item.
.SH ToolItem Separator
Inserts a separator bar in the Tools menu.
.SH ToolItem \f1\*(lq\f3name" { <tool item commands>}
Create ToolItem:s in a submenu with the specified name. It is not legal
to create a submenu inside another submenu.
.SH Screen [<number>] \f1\*(lq\f3name"
Create a new screen with the specified name. It will be placed below all
earlier created screens. To move a window between two screens, iconify it
and drag the icon over to the other screen. If the second argument is given,
this screen is placed on the corresponding X screen.
.SH ModulePath \f1\*(lq\f3path(:path...)"
The time string is formatted with the standard
.Xr strftime 3
parameters.
The default is
.Dq "%c" .
It has been found that
.Dq "%a %b %e %Y %l:%M %p"
works well too.
Number is the update interval in seconds.
.
.It Ic ToolItem Qo Ar name Qc Qo Ar command Qc Qo Ar hotkey Qc
Adds an item in the
.Em Tools
menu with the specified
.Ar name ,
which executes the given
.Ar command
when selected.
A string containing a single uppercase letter may be specified as the third argument,
making this letter a hotkey for the item.
.
.It Ic ToolItem Qo Ar name Qc Cm { Ar ToolItem Ns s ... Cm }
Create
.Ar ToolItem Ns s
in a submenu with the specified name.
It is not legal to create a submenu inside another submenu.
.
.It Ic ToolItem Ic Separator
Inserts a separator bar in the
.Em Tools
menu.
.El
.
.Ss Screen and modules
.Bl -tag -width Ds
.It Ic InterScreenGap Ar number
Sets the size in number of pixels of the "video DMA off" area
that appears between screens when they are dragged.
.
.It Ic ModulePath Qq Ar path Ns Op Cm :\& Ns Ar path ...
Sets one or more directories where amiwm will look for module binaries.
The default is AMIWM_HOME. Note that the module binaries cannot be
shared amongst different architectures.
.SH Module \f1\*(lq\f3name" ["initstring"]
Start a module with the specified name. If initstring is specified, it
is sent to the module. There are currently two modules shipped with
amiwm; Background and Keyboard. These are documented in the file
README.modules. If a module is limited to a single screen, like the
Background module, the screen that was created last is used.
.SH InterScreenGap number
Sets the size in number of pixels of the "video DMA off" area that appears
between screens when they are dragged.
.SH AutoRaise {yes|no}
Selects whether windows will automatically be moved to the front when
they are activated.
.SH Focus {followmouse|sloppy|clicktotype}
Sets the policy by which windows are given focus. Followmouse is the
default and means that the window that contains the mouse pointer will
have focus. Sloppy means that the window that had focus last will keep
it when the pointer is not over a window. ClickToType is the original AmigaOS
policy in which you have to explicitly give focus to windows by clicking
in them.
.SH TROUBLESHOOTING
The most likely reason for amiwm to crash is if it
can't find its default icon, or if this is not accepted as a
*.info file. If this happens, amiwm _will_ dump core. So make
sure that either 'make install' runs successfully (in which case
amiwm will know where its icon is), or that the file .amiwmrc
contains a correct specification of the icon's location.
.SH CONFIGURATION FILES
.nf
The default is
.Ev AMIWM_HOME .
Note that the module binaries cannot be shared amongst different architectures.
.
.It Ic Module Qo Ar name Qc Op Qq initstring
Start a module with the specified
.Ar name .
If
.Ar initstring
is specified, it is sent to the module.
For the list of modules, see the section
.Sx MODULES
below.
If a module is limited to a single screen
(like the
.Em Background
module)
the screen that was created last is used.
.
.It Ic Screen Oo Ar number Oc Qq Ar screenname
Create a new screen with the given
.Ar screenname .
It will be placed below all earlier created screens.
To move a window between two screens, iconify it and drag the icon over to the other screen.
If the second argument is given, this screen is placed on the corresponding X screen.
.El
.
.Sh MODULES
.Nm
has the following modules.
.Ss Background module
This module sets a background image (aka backdrop) on a screen.
.
.Pp
Its
.Ic Module
command should come after the
.Ic Screen
command that it sets the backdrop of.
Its
.Ar initstring
should be the
.Ar filename
of the picture.
Example:
.Bd -literal -offset indent
Screen "Workbench Screen"
Module "Background" "~/megumin.png"
.Ed
.
.Pp
The
.Ic Background
module is really a shell script that requires the
program
.Xr display 1
from
.Xr ImageMagick 1
package.
Currently, it doesn't support any standard imagemagick parameters.
.
.Ss Background_stretch module
Same as the
.Ic Background
module, but stretches your backdrop to size of your screen.
Example:
.Bd -literal -offset indent
Screen "Workbench Screen"
Module "Background_stretch" "~/megumin.png"
.Ed
.
.Pp
Please note that this module will just stretch or downscale the image
(depending on the size of the image) to your display ratio.
If you don't want your image to look ugly, try the next module.
.
.Ss Background_resize module
Same as the
.Ic Background_stretch ,
but it cares about your display ratio.
For example, if you've got a 16:9 screen but your backdrop image is 4:3,
it will get stretched, but it will still be displayed as a 4:3 picture.
The remaining part of the screen will be used to show the same image, but repeated.
.
.Ss Keyboard module
This module binds window manager functions to keys on the keyboard.
.
.Pp
The
.Ar initstring
consists of one or more keybindings on the form
.D1 Ar modifiers Ns < Ns Ar keysym Ns >: Ns Ar where Ns : Ns Ar func
.
.Pp
Multiple keybindings are specified with spaces between them.
The keybinding string can be broken into two lines with a backslash
.Pq Sq \e
and newline.
.
.Pp
The components of a keybinding string are as follows:
.Bl -tag -width "modifiers"
.It Ar modifiers
Modifiers is 0 or more of:
.Cm Shift , Control , Meta , Lock ,
.Cm Mod1 , Mod2 , Mod3 , Mod4 , Mod5 ,
.Cm Button1 , Button2 , Button3 , Button4 , Button5 .
.
.Pp
Modifiers are joined together using spaces.
This can be confusing as it looks like keybindings are specified with spaces between them,
but the parser actually handles this.
.
.Pp
The modifiers listed must be pressed together with the key to activate the binding.
.
.It Ar keysym
Keysym is a standard X keysym name, like F1 or Prior.
.
.Pp
Keysyms are listed in the file
.Pa /usr/include/X11/keysymdef.h
(or another equivalent in your system).
Just remove the
.Ql XK_
prefix before them.
.
.It Ar where
It is either
.Cm all ,
or one or more of
.Cm window , frame , icon , root
separated with a bar
.Pq Sq "|" .
This controls in what areas of the screen that the key will be active.
.
.It Ar func
The function to perform when the key is pressed.
Currently the following are defined:
.Bl -tag -compact -width "rotatescreens"
.It Cm rotatescreens
Move the frontmost screen to the back
.It Cm raisewindow
Rotate the bottom window to the top of the screen
.It Cm lowerwindow
Rotate the top window to the bottom of the screen
.It Cm rotatewindow
Move the current window to the next screen, rotate screen
.It Cm front
Move the window in which the key is pressed to the front
.It Cm back
Move the window in which the key is pressed to the back
.It Cm iconify
Iconify the window in which the key is pressed
.El
.El
.
.Pp
Example:
.Bd -literal -offset indent
Module "Keyboard" "\e
Meta<F1>:window|frame:front\e
Meta<F2>:window|frame:iconify\e
Meta<F3>:window|frame:back"
.Ed
.
.Pp
This binds the keys Meta-F1, Meta-F2 and Meta-F3 to front, back and iconify respectively.
They will only have effect inside windows and in window frames.
(These are the only places that front/iconfy/back has effect anyway.)
.
.Pp
An example with multiple modifiers in a single keybinding:
.Bd -literal -offset indent
Module "Keyboard" "Meta<M>:all:rotatescreens\e
Meta<Tab>:all:raisewindow\e
Control Meta<Tab>:all:lowerwindow"
.Ed
.
.Ss Filesystem module
This is an april fools joke module,
but at least it's a starting point for building out an icon on the desktop!
.Bd -literal -offset indent
Module "Filesystem" "/path/to/open"
.Ed
.
.Ss Launcher module
This is a simple prototype launcher program
that places an icon on a workbench screen which can be double clicked to run.
Its
.Ic Module
command should come after the
.Ic Screen
command it places the launcher icon at.
.
.Pp
The
.Ar initstring
has the following format:
.D1 Ar label icon command Op args ...
.
.Pp
Where:
.Bl -tag -compact -width "command args..."
.It "label"
The launcher icon name.
.It "icon"
One of the
.Pa .icon
files in the
.Ic IconDir .
.It "command args..."
The command and its arguments to run.
.El
.
.Ss Battery module
This is a simple battery state polling module that is being used
during battery monitoring / menu toolbar development.
.
.Pp
It's currently FreeBSD specific and based on what xbatt does to pull info from APM/ACPI.
Adding Linux and other OS support shouldn't be too difficult.
.Bd -literal -offset indent
Module "Battery"
.Ed
.
.Sh FILES
.Bl -bullet -compact -width ""
.It
$HOME/.amiwmrc
.It
$AMIWM_HOME/system.amiwmrc
.fi
.SH COPYRIGHT NOTICES
This program is distributed as freeware. The copyright remains with
the author. See the file LICENSE for more information.
.El
.
.Sh AUTHORS
.Nm
was originally written by
.An Marcus Comstedt Aq Mt marcus@mc.pp.se
.
.Pp
With contributions from:
.An Scott Lawrence Aq Mt amiwm10@umlautllama.com
.An Nicolas Sipieter Aq Mt freeeaks@gmail.com
.An redsPL Aq Mt reds@sakamoto.pl
.
.Pp
.Nm
is distributed as freeware.
The copyright remains with the author.
See the file LICENSE for more information.
Amiga and Workbench are registered trademarks of AMIGA International Inc.
.SH ORIGINAL AUTHOR
Marcus Comstedt,
.I marcus@mc.pp.se
.SH CONTRIBUTORS
Scott Lawrence,
.I amiwm10@umlautllama.com
Nicolas Sipieter,
.I freeeaks@gmail.com
redsPL,
.I reds@desu.gq
.
.Sh CAVEATS
The most likely reason for amiwm to crash is if it can't find its default icon,
or if this is not accepted as a
.Pa "*.info"
file.
If this happens, amiwm
.Sy WILL
dump core.
.
.Pp
So make sure when installing that either
.Ql "make install"
runs successfully (in which case amiwm will know where its icon is),
or that the file
.Pa "~/.amiwmrc"
contains an
.Ic IconDir
option with a correct specification of the icon's location.

84
battery_module.c Normal file
View File

@@ -0,0 +1,84 @@
#include <stdio.h>
#include <string.h>
#include <err.h>
#include <fcntl.h>
#include <stdbool.h>
#include <unistd.h>
#include <machine/apm_bios.h>
#define APM_DEV "/dev/apm"
#include "libami.h"
/* XXX should be an md method */
extern void (*md_periodic_func)(void);
/*
* Test battery module for FreeBSD, using APM.
*/
void docmd(XEvent *e, void *callback)
{
((void (*)(Window))callback)(e->xany.window);
}
static char *progname;
static int apm_fd = -1;
static bool
get_apm_info(void)
{
int ret;
struct apm_info info;
ret = ioctl(apm_fd, APMIO_GETINFO, &info);
if (ret < 0) {
warn("ioctl (APMIO_GETINFO)");
return false;
}
#if 0
printf("Battery life: %d\n", info.ai_batt_life);
printf("Battery time: %d\n", info.ai_batt_time);
printf("Battery AC: %d\n", info.ai_acline);
#endif
md_update_battery(info.ai_batt_life, info.ai_batt_time,
info.ai_acline);
return true;
}
static void
periodic_func(void)
{
get_apm_info();
}
int
main(int argc, char *argv[])
{
char *arg;
arg = md_init(argc, argv);
(void) arg;
progname=argv[0];
md_periodic_func = periodic_func;
apm_fd = open(APM_DEV, O_RDONLY);
if (apm_fd < 0) {
err(127, "open");
}
/* initial battery info */
get_apm_info();
/* Run main loop */
md_main_loop();
close(apm_fd);
return 0;
}

178
client.c
View File

@@ -129,22 +129,64 @@ void checksizehints(Client *c)
{
long supplied;
XGetWMNormalHints(dpy, c->window, &c->sizehints, &supplied);
if(!(c->sizehints.flags&PMinSize))
c->sizehints.min_width=c->sizehints.min_height=0;
if(!(c->sizehints.flags&PMaxSize))
c->sizehints.max_width=c->sizehints.max_height=1<<30;
if(!(c->sizehints.flags&PResizeInc))
c->sizehints.width_inc=c->sizehints.height_inc=1;
if(c->sizehints.flags&PBaseSize) {
c->sizehints.min_width=c->sizehints.base_width;
c->sizehints.min_height=c->sizehints.base_height;
XGetWMNormalHints(dpy, c->window, c->sizehints, &supplied);
if(!(c->sizehints->flags&PMinSize))
c->sizehints->min_width=c->sizehints->min_height=0;
if(!(c->sizehints->flags&PMaxSize))
c->sizehints->max_width=c->sizehints->max_height=1<<30;
if(!(c->sizehints->flags&PResizeInc))
c->sizehints->width_inc=c->sizehints->height_inc=1;
if(c->sizehints->flags&PBaseSize) {
c->sizehints->min_width=c->sizehints->base_width;
c->sizehints->min_height=c->sizehints->base_height;
}
if(c->sizehints.min_width<1) c->sizehints.min_width=1;
if(c->sizehints.min_height<1) c->sizehints.min_height=1;
c->sizehints.base_width=c->sizehints.min_width;
c->sizehints.base_height=c->sizehints.min_height;
if(c->sizehints.flags&PWinGravity) c->gravity=c->sizehints.win_gravity;
if(c->sizehints->min_width<1) c->sizehints->min_width=1;
if(c->sizehints->min_height<1) c->sizehints->min_height=1;
c->sizehints->base_width=c->sizehints->min_width;
c->sizehints->base_height=c->sizehints->min_height;
if(c->sizehints->flags&PWinGravity) c->gravity=c->sizehints->win_gravity;
}
void open_fscrn(Client *c)
{
c->fsscr = scr = openscreen(NULL, scr->root);
c->reparenting = 1;
XReparentWindow(dpy, c->parent, c->fsscr->back, 0, 0);
XRaiseWindow(dpy, c->window);
XMoveResizeWindow(dpy, c->parent, 0, 0, c->fsscr->width, c->fsscr->height);
XMoveResizeWindow(dpy, c->window, 0, 0, c->fsscr->width, c->fsscr->height);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
if (dialog->leader == c)
reparent_client(c->fsscr, dialog);
XResizeWindow(dpy, c->window, scr->width, scr->height);
realizescreens();
scr = c->fsscr;
#ifdef USE_FONTSETS
XStoreName(dpy, scr->back, c->title);
#else
XSetWMName(dpy, scr->back, &c->title);
#endif
screentoback();
}
void close_fscrn(Client *c, int state)
{
if (c->fsscr == NULL)
return;
XReparentWindow(dpy, c->parent, c->scr, c->x, c->y);
XMoveResizeWindow(dpy, c->parent, c->x, c->y, c->pwidth, c->pheight);
XMoveResizeWindow(dpy, c->window, 4, c->scr->bh, c->pwidth-c->framewidth, c->pheight-c->frameheight);
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
XLowerWindow(dpy, c->window);
scr = c->fsscr;
closescreen();
c->fsscr = NULL;
scr = c->scr;
if (state != IconicState)
XMapWindow(dpy, c->parent);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
if (dialog->leader == c)
reparent_client(c->scr, dialog);
}
void setclientstate(Client *c, int state)
@@ -154,6 +196,13 @@ void setclientstate(Client *c, int state)
data[0] = (long) state;
data[1] = (long) None;
if (c->fullscreen) {
if (state != NormalState && c->state == NormalState) {
close_fscrn(c, state);
} else if (state == NormalState && c->state != NormalState) {
open_fscrn(c);
}
}
c->state = state;
XChangeProperty(dpy, c->window, wm_state, wm_state, 32,
PropModeReplace, (unsigned char *)data, 2);
@@ -175,6 +224,7 @@ Client *createclient(Window w)
XWindowAttributes attr;
Client *c;
int b = 0;
if(w==0) return 0;
if(!XFindContext(dpy, w, client_context, (XPointer*)&c)) return c;
@@ -182,7 +232,9 @@ Client *createclient(Window w)
XGetWindowAttributes(dpy, w, &attr);
c = (Client *)calloc(1, sizeof(Client));
c->sizehints = XAllocSizeHints();
c->scr = scr;
c->fsscr = NULL;
c->window = w;
c->parent = scr->root;
c->old_bw = attr.border_width;
@@ -190,6 +242,7 @@ Client *createclient(Window w)
c->state = WithdrawnState;
c->gravity = NorthWestGravity;
c->reparenting = 0;
c->fullscreen = 0;
XSelectInput(dpy, c->window, PropertyChangeMask);
#ifdef USE_FONTSETS
{
@@ -214,24 +267,37 @@ Client *createclient(Window w)
checksizehints(c);
c->zoomx=0;
c->zoomy=scr->bh;
if(c->sizehints.width_inc) {
c->zoomw=scr->width-c->sizehints.base_width-22;
c->zoomw-=c->zoomw%c->sizehints.width_inc;
c->zoomw+=c->sizehints.base_width;
if(c->zoomw>c->sizehints.max_width)
c->zoomw=c->sizehints.max_width;
if(c->zoomw<c->sizehints.min_width)
c->zoomw=c->sizehints.min_width;
if ((c->sizehints->width_inc &&
c->sizehints->min_width+c->sizehints->width_inc<=c->sizehints->max_width)||
(c->sizehints->height_inc &&
c->sizehints->min_height+c->sizehints->height_inc<=c->sizehints->max_height))
b = prefs.sizeborder;
if(c->sizehints->width_inc) {
c->zoomw=scr->width-c->sizehints->base_width;
if (b & Psizeright)
c->zoomw-=22;
else
c->zoomw-=8;
c->zoomw-=c->zoomw%c->sizehints->width_inc;
c->zoomw+=c->sizehints->base_width;
if(c->zoomw>c->sizehints->max_width)
c->zoomw=c->sizehints->max_width;
if(c->zoomw<c->sizehints->min_width)
c->zoomw=c->sizehints->min_width;
} else
c->zoomw=attr.width;
if(c->sizehints.height_inc) {
c->zoomh=scr->height-c->sizehints.base_height-scr->bh-c->zoomy-2;
c->zoomh-=c->zoomh%c->sizehints.height_inc;
c->zoomh+=c->sizehints.base_height;
if(c->zoomh>c->sizehints.max_height)
c->zoomh=c->sizehints.max_height;
if(c->zoomh<c->sizehints.min_height)
c->zoomh=c->sizehints.min_height;
if(c->sizehints->height_inc) {
c->zoomh=scr->height-c->sizehints->base_height-scr->bh-c->zoomy;
if (b & Psizebottom)
c->zoomh -= 10;
else
c->zoomh -= 2;
c->zoomh-=c->zoomh%c->sizehints->height_inc;
c->zoomh+=c->sizehints->base_height;
if(c->zoomh>c->sizehints->max_height)
c->zoomh=c->sizehints->max_height;
if(c->zoomh<c->sizehints->min_height)
c->zoomh=c->sizehints->min_height;
} else
c->zoomh=attr.height;
XSaveContext(dpy, w, client_context, (XPointer)c);
@@ -252,6 +318,9 @@ void rmclient(Client *c)
break;
}
if ((scr = c->fsscr))
closescreen();
scr = c->scr;
if(c->active) {
if(!menuactive)
setfocus(None);
@@ -287,6 +356,11 @@ void rmclient(Client *c)
rmicon(c->icon);
if(c->window)
XDeleteContext(dpy, c->window, client_context);
if (c->sizehints)
XFree(c->sizehints);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next)
if (dialog->leader == c)
dialog->leader = NULL;
free(c);
}
@@ -311,7 +385,7 @@ void flushclients()
Scrn *scr2;
#endif
if((scr = front)) do {
if((scr = get_front_scr())) do {
scr = scr->upfront;
XQueryTree(dpy, scr->back, &dw1, &dw2, &wins, &nwins);
for(i=0; i<nwins; i++)
@@ -347,7 +421,7 @@ void flushclients()
}
*/
XFree((void *) wins);
} while(scr!=front);
} while( scr!= get_front_scr());
while((c=clients)) {
if(c->parent != c->scr->root) {
int x,y;
@@ -359,3 +433,41 @@ void flushclients()
rmclient(c);
}
}
/*
* Reparent the given client to the given screen.
*
* This moves the given client to the given screen.
*/
void
reparent_client(Scrn *s, Client *client)
{
client->scr = s;
if(client->parent != client->scr->root)
XReparentWindow(dpy, client->parent, s->back, client->x, client->y);
if (s->deftitle != NULL)
setstringprop(client->window, amiwm_screen, s->deftitle);
sendconfig(client);
}
void fullscreen(Client *c, int fs)
{
if (fs == c->fullscreen)
return;
if (c->state != NormalState) {
c->fullscreen = fs;
setwmstate(c);
return;
}
if (fs) {
open_fscrn(c);
c->fullscreen = 1;
} else {
close_fscrn(c, c->state);
c->fullscreen = 0;
setclientstate(c, NormalState);
}
setwmstate(c);
}

View File

@@ -6,9 +6,18 @@
struct _Icon;
struct _Scrn;
/*
* struct _Client - application client information.
*
* @next: next client in list.
* @scr: virtual desktop this client belongs to.
* @colormap: current colormap.
*/
typedef struct _Client {
struct _Client *leader;
struct _Client *next;
struct _Scrn *scr;
struct _Scrn *scr, *fsscr;
struct _Icon *icon;
struct module *module;
int wflags;
@@ -19,13 +28,14 @@ typedef struct _Client {
int x, y, pwidth, pheight, dragw, framewidth, frameheight;
int zoomx, zoomy, zoomw, zoomh;
int old_bw, proto, state, gravity, reparenting;
int active, shaped;
int active, shaped, fullscreen;
#ifdef USE_FONTSETS
char *title;
#else
XTextProperty title;
#endif
XSizeHints sizehints;
/* This needs to be a pointer! */
XSizeHints *sizehints;
struct _Style *style;
} Client;
@@ -42,5 +52,7 @@ extern void getstate(Client *);
extern void grav_map_frame_to_win(Client *, int, int, int *, int *);
extern void grav_map_win_to_frame(Client *, int, int, int *, int *);
extern void setclientstate(Client *, int);
extern void reparent_client(struct _Scrn *s, Client *client);
extern void fullscreen(Client *, int);
#endif

337
config_util.c Normal file
View File

@@ -0,0 +1,337 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "drawinfo.h"
#include "libami.h"
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
extern struct Library *XLibBase;
#endif
#define BUT_BUTSPACE (2*(2+5))
#define BUT_INTSPACE 12
#define BUT_EXTSPACE 4
#define BUT_VSPACE 6
#define TXT_HSPACE 48
#define TXT_TOPSPACE 4
#define TXT_MIDSPACE 3
#define TXT_BOTSPACE 4
struct choice {
struct choice *next;
const char *text;
int l, w;
Window win;
} *firstchoice=NULL, *lastchoice=NULL;
struct line {
struct line *next;
const char *text;
int l, w, h;
} *firstline=NULL, *lastline=NULL;
Display *dpy;
Window root, mainwin, textwin;
char *progname;
GC gc;
Pixmap stipple;
int totw=0, maxw=0, toth=0, nchoices=0;
int depressed=0;
struct choice *selected=NULL;
struct DrawInfo dri;
struct RDArgs *ra=NULL;
void selection(int n)
{
printf("%d\n", n);
XDestroyWindow(dpy, mainwin);
XCloseDisplay(dpy);
FreeArgs(ra);
exit(0);
}
void *myalloc(size_t s)
{
void *p=calloc(s,1);
if(p)
return p;
fprintf(stderr, "%s: out of memory!\n", progname);
FreeArgs(ra);
exit(1);
}
void addchoice(const char *txt)
{
struct choice *c=myalloc(sizeof(struct choice));
if(lastchoice)
lastchoice->next=c;
else
firstchoice=c;
lastchoice=c;
c->l=strlen(c->text=txt);
#ifdef USE_FONTSETS
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
#else
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
#endif
nchoices++;
}
void addline(const char *txt)
{
struct line *l=myalloc(sizeof(struct line));
if(lastline)
lastline->next=l;
else
firstline=l;
lastline=l;
l->l=strlen(l->text=txt);
#ifdef USE_FONTSETS
l->w=XmbTextEscapement(dri.dri_FontSet, l->text, l->l);
#else
l->w=XTextWidth(dri.dri_Font, l->text, l->l);
#endif
toth+=l->h=dri.dri_Ascent+dri.dri_Descent;
if(l->w>maxw)
maxw=l->w;
}
void refresh_text()
{
int w=totw-BUT_EXTSPACE-BUT_EXTSPACE;
int h=toth-TXT_TOPSPACE-TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
(dri.dri_Ascent+dri.dri_Descent);
int x=(totw-maxw+TXT_HSPACE)>>1;
int y=((dri.dri_Ascent+dri.dri_Descent)>>1)+dri.dri_Ascent;
struct line *l;
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
XDrawLine(dpy, textwin, gc, 0, 0, w-2, 0);
XDrawLine(dpy, textwin, gc, 0, 0, 0, h-2);
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
XDrawLine(dpy, textwin, gc, 0, h-1, w-1, h-1);
XDrawLine(dpy, textwin, gc, w-1, 0, w-1, h-1);
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
for(l=firstline; l; l=l->next) {
#ifdef USE_FONTSETS
XmbDrawString(dpy, textwin, dri.dri_FontSet, gc, x, y, l->text, l->l);
#else
XDrawString(dpy, textwin, gc, x, y, l->text, l->l);
#endif
y+=dri.dri_Ascent+dri.dri_Descent;
}
}
void refresh_choice(struct choice *c)
{
int w=c->w+BUT_BUTSPACE;
int h=dri.dri_Ascent+dri.dri_Descent+BUT_VSPACE;
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(dpy, c->win, dri.dri_FontSet, gc, BUT_BUTSPACE/2,
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
#else
XDrawString(dpy, c->win, gc, BUT_BUTSPACE/2,
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
#endif
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
SHADOWPEN:SHINEPEN]);
XDrawLine(dpy, c->win, gc, 0, 0, w-2, 0);
XDrawLine(dpy, c->win, gc, 0, 0, 0, h-2);
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
SHINEPEN:SHADOWPEN]);
XDrawLine(dpy, c->win, gc, 1, h-1, w-1, h-1);
XDrawLine(dpy, c->win, gc, w-1, 1, w-1, h-1);
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
XDrawPoint(dpy, c->win, gc, w-1, 0);
XDrawPoint(dpy, c->win, gc, 0, h-1);
}
void split(char *str, const char *delim, void (*func)(const char *))
{
char *p;
if((p=strtok(str, delim)))
do {
(*func)(p);
} while((p=strtok(NULL, delim)));
}
struct choice *getchoice(Window w)
{
struct choice *c;
for(c=firstchoice; c; c=c->next)
if(w == c->win)
return c;
return NULL;
}
void toggle(struct choice *c)
{
XSetWindowBackground(dpy, c->win, dri.dri_Pens[(depressed&&c==selected)?
FILLPEN:BACKGROUNDPEN]);
XClearWindow(dpy, c->win);
refresh_choice(c);
}
void abortchoice()
{
if(depressed) {
depressed=0;
toggle(selected);
}
selected=NULL;
}
void endchoice()
{
struct choice *c=selected, *c2=firstchoice;
int n;
abortchoice();
if(c==lastchoice)
selection(0);
for(n=1; c2; n++, c2=c2->next)
if(c2==c)
selection(n);
selection(0);
}
int main(int argc, char *argv[])
{
XWindowAttributes attr;
static XSizeHints size_hints;
static XTextProperty txtprop1, txtprop2;
int x, y, extra=0, n=0;
struct choice *c;
Argtype array[3], *atp;
progname="Configuration Utility"; //argv[0];
// initargs(argc, argv);
// if(!(ra=ReadArgs((STRPTR)"TITLE/A,BODY/A,GADGETS/M", (LONG *)array, NULL))) {
// PrintFault(IoErr(), (UBYTE *)progname);
// exit(1);
// }
if(!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "%s: cannot connect to X server %s\n", progname,
XDisplayName(NULL));
FreeArgs(ra);
exit(1);
}
root = RootWindow(dpy, DefaultScreen(dpy));
XGetWindowAttributes(dpy, root, &attr);
init_dri(&dri, dpy, root, attr.colormap, False);
addline("Welcome to Configration Utility for AmiWM");
addline("");
addline("that's just a test");
addchoice("OK");
addchoice("cya");
totw+=BUT_EXTSPACE+BUT_EXTSPACE+BUT_INTSPACE*(nchoices-1);
toth+=2*(dri.dri_Ascent+dri.dri_Descent)+TXT_TOPSPACE+
TXT_MIDSPACE+TXT_BOTSPACE+BUT_VSPACE;
maxw+=TXT_HSPACE+BUT_EXTSPACE+BUT_EXTSPACE;
if(maxw>totw) {
extra=maxw-totw;
totw=maxw;
}
mainwin=XCreateSimpleWindow(dpy, root, 0, 0, totw, toth, 1,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
gc=XCreateGC(dpy, mainwin, 0, NULL);
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
#ifndef USE_FONTSETS
XSetFont(dpy, gc, dri.dri_Font->fid);
#endif
stipple=XCreatePixmap(dpy, mainwin, 2, 3, attr.depth); // 2, 2
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
XFillRectangle(dpy, stipple, gc, 0, 0, 1, 1); // 0, 0, 2, 2
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
XDrawPoint(dpy, stipple, gc, 0, 1);
XDrawPoint(dpy, stipple, gc, 1, 0);
XSetWindowBackgroundPixmap(dpy, mainwin, stipple);
textwin=XCreateSimpleWindow(dpy, mainwin, BUT_EXTSPACE, TXT_TOPSPACE, totw-
BUT_EXTSPACE-BUT_EXTSPACE, toth-TXT_TOPSPACE-
TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
(dri.dri_Ascent+dri.dri_Descent),
0, dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, textwin, ExposureMask);
x=BUT_EXTSPACE;
y=toth-TXT_BOTSPACE-(dri.dri_Ascent+dri.dri_Descent)-BUT_VSPACE;
for(c=firstchoice; c; c=c->next) {
c->win=XCreateSimpleWindow(dpy, mainwin,
x+(nchoices==1? (extra>>1):
n++*extra/(nchoices-1)),
y, c->w+BUT_BUTSPACE,
dri.dri_Ascent+dri.dri_Descent+
BUT_VSPACE, 0,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, c->win, ExposureMask|ButtonPressMask|ButtonReleaseMask|
EnterWindowMask|LeaveWindowMask);
x+=c->w+BUT_BUTSPACE+BUT_INTSPACE;
}
size_hints.flags = PResizeInc;
txtprop1.value=(unsigned char *)"ConfigurationUtility";
txtprop2.value=(unsigned char *)"ConfigurationUtility";
txtprop2.encoding=txtprop1.encoding=XA_STRING;
txtprop2.format=txtprop1.format=8;
txtprop1.nitems=strlen((char *)txtprop1.value);
txtprop2.nitems=strlen((char *)txtprop2.value);
XSetWMProperties(dpy, mainwin, &txtprop1, &txtprop2, argv, argc,
&size_hints, NULL, NULL);
XMapSubwindows(dpy, mainwin);
XMapRaised(dpy, mainwin);
for(;;) {
XEvent event;
XNextEvent(dpy, &event);
switch(event.type) {
case Expose:
if(!event.xexpose.count) {
if(event.xexpose.window == textwin)
refresh_text();
else if((c=getchoice(event.xexpose.window)))
refresh_choice(c);
}
break;
case LeaveNotify:
if(depressed && event.xcrossing.window==selected->win) {
depressed=0;
toggle(selected);
}
break;
case EnterNotify:
if((!depressed) && selected && event.xcrossing.window==selected->win) {
depressed=1;
toggle(selected);
}
break;
case ButtonPress:
if(event.xbutton.button==Button1 &&
(c=getchoice(event.xbutton.window))) {
abortchoice();
depressed=1;
toggle(selected=c);
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
}
}
FreeArgs(ra);
}

6504
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
AC_INIT(diskobject.c)
AC_INIT
AC_CONFIG_SRCDIR([diskobject.c])
AC_ENABLE(fontsets,
[use_fontsets="$enableval"], [use_fontsets=auto])
AC_ARG_ENABLE([fontsets],[ --enable-fontsets],[use_fontsets="$enableval"],[use_fontsets=auto])
AC_PROG_CC
AC_ISC_POSIX
AC_SEARCH_LIBS([strerror],[cposix])
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_LEX
@@ -14,7 +14,15 @@ AC_PROG_RANLIB
AC_PATH_XTRA
AC_HEADER_STDC
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h sys/types.h unistd.h sys/select.h sys/resource.h sys/stat.h termio.h)
ac_save_CPPFLAGS="$CPPFLAGS"
@@ -26,11 +34,22 @@ AC_C_CONST
AC_C_CHAR_UNSIGNED
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_FUNC_ALLOCA
AC_TYPE_SIGNAL
m4_warn([obsolete],
[your code may safely assume C89 semantics that RETSIGTYPE is void.
Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
],
[return *(signal (0, 0)) (0) == 1;])],
[ac_cv_type_signal=int],
[ac_cv_type_signal=void])])
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
(`int' or `void').])
AC_FUNC_WAIT3
AC_CHECK_FUNCS(select strdup waitpid)
@@ -42,13 +61,13 @@ dnl libXt too, so that's what we'll do.
AC_MSG_CHECKING([for broken libXmu])
old_LIBS="$LIBS"
LIBS="$X_LIBS $X_PRE_LIBS -lXext -lXmu -lX11 $X_EXTRA_LIBS $LIBS"
AC_TRY_LINK([],[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
extern void XmuCopyISOLatin1Lowered(char *,char *);
char foo[]="FOO";
XmuCopyISOLatin1Lowered (foo, foo);
], AC_MSG_RESULT([no])
XT_LIB_KLUDGE="", AC_MSG_RESULT([yes])
XT_LIB_KLUDGE="-lXt")
]])],[AC_MSG_RESULT(no)
XT_LIB_KLUDGE=""],[AC_MSG_RESULT(yes)
XT_LIB_KLUDGE="-lXt"])
LIBS="$old_LIBS"
AC_SUBST(XT_LIB_KLUDGE)
@@ -63,17 +82,17 @@ else
fi
AC_MSG_CHECKING([number of arguments to gettimeofday])
AC_TRY_LINK([
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
],[
]], [[
struct timeval tp;
struct timezone tz;
gettimeofday(&tp, &tz);
], AC_DEFINE(BSD_STYLE_GETTIMEOFDAY,1,[Define this if gettimeofday() takes two arguments.])
AC_MSG_RESULT([2]), AC_MSG_RESULT([1]))
]])],[AC_DEFINE(BSD_STYLE_GETTIMEOFDAY,1,Define this if gettimeofday() takes two arguments.)
AC_MSG_RESULT(2)],[AC_MSG_RESULT(1)])
AC_CHECK_TYPE(caddr_t, char *)
AC_MSG_CHECKING([for XPointer])
@@ -98,7 +117,8 @@ else
fi
AC_MSG_CHECKING([byteorder])
AC_TRY_RUN([
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
int main()
{
union { int i; char c[sizeof(int)]; } v;
@@ -107,9 +127,10 @@ int main()
if(v.i==1) exit(0); else exit(1);
return 0;
}
], AC_DEFINE([LAME_ENDIAN],1,[Define this is your achitecture stores integers backwards in memory])
AC_MSG_RESULT([backward]), AC_MSG_RESULT([normal]), AC_MSG_RESULT([no idea]))
]])],[AC_DEFINE(LAME_ENDIAN,1,Define this is your achitecture stores integers backwards in memory)
AC_MSG_RESULT(backward)],[AC_MSG_RESULT(normal)],[AC_MSG_RESULT(no idea)])
AC_SUBST(x_includes)
AC_SUBST(x_libraries)
AC_OUTPUT(Makefile libami/Makefile)
AC_CONFIG_FILES([Makefile libami/Makefile])
AC_OUTPUT

View File

@@ -21,6 +21,8 @@
#endif
#include "drawinfo.h"
#include "gadget_button.h"
#include "gadget_textinput.h"
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
@@ -30,27 +32,14 @@ extern struct Library *XLibBase;
#define MAX_CMD_CHARS 256
#define VISIBLE_CMD_CHARS 35
#define BOT_SPACE 4
#define TEXT_SIDE 8
#define BUT_SIDE 12
#define TOP_SPACE 4
#define INT_SPACE 7
#define BUT_VSPACE 2
#define BUT_HSPACE 8
static const char ok_txt[]="Ok", cancel_txt[]="Cancel";
static const char enter_txt[]="Enter Command and its Arguments:";
static const char cmd_txt[]="Command:";
static int selected=0, depressed=0, stractive=1;
static Window button[3];
static const char *buttxt[]={ NULL, ok_txt, cancel_txt };
char cmdline[MAX_CMD_CHARS+1];
int buf_len=0;
int cur_pos=0;
int left_pos=0;
int cur_x=6;
struct gadget_button *buttons[3];
struct gadget_textinput *text_input;
char *progname;
@@ -58,368 +47,121 @@ Display *dpy;
struct DrawInfo dri;
Window root, mainwin, strwin;
Window root, mainwin;
GC gc;
int strgadw, strgadh, fh, mainw, mainh, butw;
int strgadw, strgadh;
int fh;
int mainw, mainh, butw;
#ifdef USE_FONTSETS
static XIM xim = (XIM) NULL;
static XIC xic = (XIC) NULL;
#endif
int getchoice(Window w)
/*
* Loop through the button list and see if we find
* a button. Return 0 if we don't find a button.
*
* Yeah, ideally we'd do this in some gadget / intuition
* UI layer thing, but we're not there yet.
*/
static int
getchoice(Window w)
{
int i;
for(i=1; i<3; i++)
if(button[i]==w)
return i;
return 0;
}
void refresh_button(Window w, const char *txt, int idx)
{
int h=fh+2*BUT_VSPACE, l=strlen(txt);
#ifdef USE_FONTSETS
int tw=XmbTextEscapement(dri.dri_FontSet, txt, l);
#else
int tw=XTextWidth(dri.dri_Font, txt, l);
#endif
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(dpy, w, dri.dri_FontSet, gc, (butw-tw)>>1,
dri.dri_Ascent+BUT_VSPACE, txt, l);
#else
XDrawString(dpy, w, gc, (butw-tw)>>1,
dri.dri_Ascent+BUT_VSPACE, txt, l);
#endif
XSetForeground(dpy, gc, dri.dri_Pens[(selected==idx && depressed)?
SHADOWPEN:SHINEPEN]);
XDrawLine(dpy, w, gc, 0, 0, butw-2, 0);
XDrawLine(dpy, w, gc, 0, 0, 0, h-2);
XSetForeground(dpy, gc, dri.dri_Pens[(selected==idx && depressed)?
SHINEPEN:SHADOWPEN]);
XDrawLine(dpy, w, gc, 1, h-1, butw-1, h-1);
XDrawLine(dpy, w, gc, butw-1, 1, butw-1, h-1);
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
XDrawPoint(dpy, w, gc, butw-1, 0);
XDrawPoint(dpy, w, gc, 0, h-1);
}
void refresh_main(void)
{
int w;
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc, TEXT_SIDE,
TOP_SPACE+dri.dri_Ascent, enter_txt, strlen(enter_txt));
#else
XDrawString(dpy, mainwin, gc, TEXT_SIDE, TOP_SPACE+dri.dri_Ascent,
enter_txt, strlen(enter_txt));
#endif
XSetForeground(dpy, gc, dri.dri_Pens[HIGHLIGHTTEXTPEN]);
#ifdef USE_FONTSETS
w=XmbTextEscapement(dri.dri_FontSet, cmd_txt, strlen(cmd_txt));
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc,
mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
cmd_txt, strlen(cmd_txt));
#else
w=XTextWidth(dri.dri_Font, cmd_txt, strlen(cmd_txt));
XDrawString(dpy, mainwin, gc, mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
cmd_txt, strlen(cmd_txt));
#endif
}
void refresh_str_text(void)
{
int l, mx=6;
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
if(buf_len>left_pos) {
#ifdef USE_FONTSETS
int w, c;
for(l=0; l<buf_len-left_pos; ) {
c=mbrlen(cmdline+left_pos+l, buf_len-left_pos-l, NULL);
w=6+XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, l+c);
if(w>strgadw-6)
break;
mx=w;
l+=c;
}
XmbDrawImageString(dpy, strwin, dri.dri_FontSet, gc, 6, 3+dri.dri_Ascent,
cmdline+left_pos, l);
#else
mx+=XTextWidth(dri.dri_Font, cmdline+left_pos, l=buf_len-left_pos);
while(mx>strgadw-6)
mx-=XTextWidth(dri.dri_Font, cmdline+left_pos+--l, 1);
XDrawImageString(dpy, strwin, gc, 6, 3+dri.dri_Ascent,
cmdline+left_pos, l);
#endif
}
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
XFillRectangle(dpy, strwin, gc, mx, 3, strgadw-mx-6, fh);
if(stractive) {
if(cur_pos<buf_len) {
XSetBackground(dpy, gc, ~0);
#ifdef USE_FONTSETS
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
XmbDrawImageString(dpy, strwin, dri.dri_FontSet, gc, cur_x,
3+dri.dri_Ascent, cmdline+cur_pos, l);
#else
XDrawImageString(dpy, strwin, gc, cur_x, 3+dri.dri_Ascent,
cmdline+cur_pos, 1);
#endif
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
} else {
XSetForeground(dpy, gc, ~0);
#ifdef USE_FONTSETS
XFillRectangle(dpy, strwin, gc, cur_x, 3,
XExtentsOfFontSet(dri.dri_FontSet)->
max_logical_extent.width, fh);
#else
XFillRectangle(dpy, strwin, gc, cur_x, 3,
dri.dri_Font->max_bounds.width, fh);
#endif
}
}
}
void refresh_str(void)
{
refresh_str_text();
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
XDrawLine(dpy, strwin, gc, 0, strgadh-1, 0, 0);
XDrawLine(dpy, strwin, gc, 0, 0, strgadw-2, 0);
XDrawLine(dpy, strwin, gc, 3, strgadh-2, strgadw-4, strgadh-2);
XDrawLine(dpy, strwin, gc, strgadw-4, strgadh-2, strgadw-4, 2);
XDrawLine(dpy, strwin, gc, 1, 1, 1, strgadh-2);
XDrawLine(dpy, strwin, gc, strgadw-3, 1, strgadw-3, strgadh-2);
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
XDrawLine(dpy, strwin, gc, 1, strgadh-1, strgadw-1, strgadh-1);
XDrawLine(dpy, strwin, gc, strgadw-1, strgadh-1, strgadw-1, 0);
XDrawLine(dpy, strwin, gc, 3, strgadh-3, 3, 1);
XDrawLine(dpy, strwin, gc, 3, 1, strgadw-4, 1);
XDrawLine(dpy, strwin, gc, 2, 1, 2, strgadh-2);
XDrawLine(dpy, strwin, gc, strgadw-2, 1, strgadw-2, strgadh-2);
}
void strkey(XKeyEvent *e)
{
void endchoice(void);
#ifdef USE_FONTSETS
Status stat;
#else
static XComposeStatus stat;
#endif
KeySym ks;
char buf[256];
int x, i, n;
#ifndef USE_FONTSETS
n=XLookupString(e, buf, sizeof(buf), &ks, &stat);
#else
n=XmbLookupString(xic, e, buf, sizeof(buf), &ks, &stat);
if(stat == XLookupKeySym || stat == XLookupBoth)
#endif
switch(ks) {
case XK_Return:
case XK_Linefeed:
selected=1;
endchoice();
break;
case XK_Left:
if(cur_pos) {
#ifdef USE_FONTSETS
int p=cur_pos;
int z;
while(p>0) {
--p;
if(((int)mbrlen(cmdline+p, cur_pos-p, NULL))>0) {
cur_pos=p;
break;
int i;
for (i=1; i<3; i++) {
if (buttons[i]->w == w)
return i;
}
}
return 0;
}
static void
refresh_main(void)
{
int w;
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc, TEXT_SIDE,
TOP_SPACE+dri.dri_Ascent, enter_txt, strlen(enter_txt));
#else
--cur_pos;
XDrawString(dpy, mainwin, gc, TEXT_SIDE, TOP_SPACE+dri.dri_Ascent,
enter_txt, strlen(enter_txt));
#endif
}
break;
case XK_Right:
if(cur_pos<buf_len) {
XSetForeground(dpy, gc, dri.dri_Pens[HIGHLIGHTTEXTPEN]);
#ifdef USE_FONTSETS
int l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
if(l>0)
cur_pos+=l;
w = XmbTextEscapement(dri.dri_FontSet, cmd_txt, strlen(cmd_txt));
XmbDrawString(dpy, mainwin, dri.dri_FontSet, gc,
mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
cmd_txt, strlen(cmd_txt));
#else
cur_pos++;
w = XTextWidth(dri.dri_Font, cmd_txt, strlen(cmd_txt));
XDrawString(dpy, mainwin, gc, mainw-strgadw-w-TEXT_SIDE-BUT_SIDE,
TOP_SPACE+fh+INT_SPACE+dri.dri_Ascent,
cmd_txt, strlen(cmd_txt));
#endif
}
break;
case XK_Begin:
cur_pos=0;
break;
case XK_End:
cur_pos=buf_len;
break;
case XK_Delete:
if(cur_pos<buf_len) {
int l=1;
#ifdef USE_FONTSETS
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
if(l<=0)
break;
#endif
buf_len-=l;
for(x=cur_pos; x<buf_len; x++)
cmdline[x]=cmdline[x+l];
cmdline[x] = 0;
} else XBell(dpy, 100);
break;
case XK_BackSpace:
if(cur_pos>0) {
int l=1;
#ifdef USE_FONTSETS
int p=cur_pos;
while(p>0) {
--p;
if(((int)mbrlen(cmdline+p, cur_pos-p, NULL))>0) {
l=cur_pos-p;
break;
}
static void
toggle(int c)
{
if (c == 0)
return;
gadget_button_toggle(buttons[c]);
}
static void
abortchoice(void)
{
if(depressed) {
depressed=0;
if (selected > 0) {
gadget_button_set_depressed(buttons[selected], 0);
}
toggle(selected);
}
}
#endif
buf_len-=l;
for(x=(cur_pos-=l); x<buf_len; x++)
cmdline[x]=cmdline[x+l];
cmdline[x] = 0;
} else XBell(dpy, 100);
break;
#ifdef USE_FONTSETS
default:
if(stat == XLookupBoth)
stat = XLookupChars;
}
if(stat == XLookupChars) {
#else
default:
#endif
for(i=0; i<n && buf_len<MAX_CMD_CHARS; i++) {
for(x=buf_len; x>cur_pos; --x)
cmdline[x]=cmdline[x-1];
cmdline[cur_pos++]=buf[i];
buf_len++;
}
if(i<n)
XBell(dpy, 100);
}
if(cur_pos<left_pos)
left_pos=cur_pos;
cur_x=6;
#ifdef USE_FONTSETS
if(cur_pos>left_pos)
cur_x+=XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, cur_pos-left_pos);
if(cur_pos<buf_len) {
int l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
x=XmbTextEscapement(dri.dri_FontSet, cmdline+cur_pos, l);
} else
x=XExtentsOfFontSet(dri.dri_FontSet)->max_logical_extent.width;
#else
if(cur_pos>left_pos)
cur_x+=XTextWidth(dri.dri_Font, cmdline+left_pos, cur_pos-left_pos);
if(cur_pos<buf_len)
x=XTextWidth(dri.dri_Font, cmdline+cur_pos, 1);
else
x=dri.dri_Font->max_bounds.width;
#endif
if((x+=cur_x-(strgadw-6))>0) {
cur_x-=x;
while(x>0) {
#ifdef USE_FONTSETS
int l=mbrlen(cmdline+left_pos, buf_len-left_pos, NULL);
x-=XmbTextEscapement(dri.dri_FontSet, cmdline+left_pos, l);
left_pos += l;
#else
x-=XTextWidth(dri.dri_Font, cmdline+left_pos++, 1);
#endif
}
cur_x+=x;
}
refresh_str_text();
selected = 0;
}
void strbutton(XButtonEvent *e)
static void
endchoice(void)
{
int w, l=1;
stractive=1;
cur_pos=left_pos;
cur_x=6;
while(cur_x<e->x && cur_pos<buf_len) {
int c=selected;
abortchoice();
XCloseDisplay(dpy);
if(c==1) {
system(text_input->buf);
}
exit(0);
}
int
main(int argc, char *argv[])
{
XWindowAttributes attr;
static XSizeHints size_hints;
static XTextProperty txtprop1, txtprop2;
int w2, c;
#ifdef USE_FONTSETS
l=mbrlen(cmdline+cur_pos, buf_len-cur_pos, NULL);
if(l<=0)
break;
w=XmbTextEscapement(dri.dri_FontSet, cmdline+cur_pos, l);
#else
w=XTextWidth(dri.dri_Font, cmdline+cur_pos, 1);
char *p;
setlocale(LC_CTYPE, "");
#endif
if(cur_x+w>e->x)
break;
cur_x+=w;
cur_pos+=l;
}
refresh_str();
}
progname=argv[0];
if(!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "%s: cannot connect to X server %s\n",
progname, XDisplayName(NULL));
exit(1);
}
void toggle(int c)
{
XSetWindowBackground(dpy, button[c], dri.dri_Pens[(depressed&&c==selected)?
FILLPEN:BACKGROUNDPEN]);
XClearWindow(dpy, button[c]);
refresh_button(button[c], buttxt[c], c);
}
void abortchoice()
{
if(depressed) {
depressed=0;
toggle(selected);
}
selected=0;
}
void endchoice()
{
int c=selected;
abortchoice();
XCloseDisplay(dpy);
if(c==1)
system(cmdline);
exit(0);
}
int main(int argc, char *argv[])
{
XWindowAttributes attr;
static XSizeHints size_hints;
static XTextProperty txtprop1, txtprop2;
Window ok, cancel;
int w2, c;
#ifdef USE_FONTSETS
char *p;
setlocale(LC_CTYPE, "");
#endif
progname=argv[0];
if(!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "%s: cannot connect to X server %s\n", progname,
XDisplayName(NULL));
exit(1);
}
root = RootWindow(dpy, DefaultScreen(dpy));
XGetWindowAttributes(dpy, root, &attr);
init_dri(&dri, dpy, root, attr.colormap, False);
root = RootWindow(dpy, DefaultScreen(dpy));
XGetWindowAttributes(dpy, root, &attr);
init_dri(&dri, dpy, root, attr.colormap, False);
#ifdef USE_FONTSETS
strgadw=VISIBLE_CMD_CHARS*XExtentsOfFontSet(dri.dri_FontSet)->
@@ -458,39 +200,6 @@ int main(int argc, char *argv[])
mainw=w2;
mainh=3*fh+TOP_SPACE+BOT_SPACE+2*INT_SPACE+2*BUT_VSPACE;
mainwin=XCreateSimpleWindow(dpy, root, 20, 20, mainw, mainh, 1,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
strwin=XCreateSimpleWindow(dpy, mainwin, mainw-BUT_SIDE-strgadw,
TOP_SPACE+fh+INT_SPACE-3,
strgadw, strgadh, 0,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
ok=XCreateSimpleWindow(dpy, mainwin, BUT_SIDE,
mainh-BOT_SPACE-2*BUT_VSPACE-fh,
butw, fh+2*BUT_VSPACE, 0,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
cancel=XCreateSimpleWindow(dpy, mainwin, mainw-butw-BUT_SIDE,
mainh-BOT_SPACE-2*BUT_VSPACE-fh,
butw, fh+2*BUT_VSPACE, 0,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
button[0]=None;
button[1]=ok;
button[2]=cancel;
XSelectInput(dpy, mainwin, ExposureMask|KeyPressMask|ButtonPressMask);
XSelectInput(dpy, strwin, ExposureMask|ButtonPressMask);
XSelectInput(dpy, ok, ExposureMask|ButtonPressMask|ButtonReleaseMask|
EnterWindowMask|LeaveWindowMask);
XSelectInput(dpy, cancel, ExposureMask|ButtonPressMask|ButtonReleaseMask|
EnterWindowMask|LeaveWindowMask);
gc=XCreateGC(dpy, mainwin, 0, NULL);
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
#ifndef USE_FONTSETS
XSetFont(dpy, gc, dri.dri_Font->fid);
#endif
#ifdef USE_FONTSETS
if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
@@ -510,6 +219,40 @@ int main(int argc, char *argv[])
exit(1);
#endif
/* Main window */
mainwin=XCreateSimpleWindow(dpy, root, 20, 20, mainw, mainh, 1,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
gc=XCreateGC(dpy, mainwin, 0, NULL);
XSetBackground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
#ifndef USE_FONTSETS
XSetFont(dpy, gc, dri.dri_Font->fid);
#endif
/* Text input window */
text_input = gadget_textinput_create(dpy, &dri, gc, mainwin,
mainw-BUT_SIDE-strgadw,
TOP_SPACE+fh+INT_SPACE-3,
strgadw, strgadh, 256);
#ifdef USE_FONTSETS
gadget_textinput_set_xic(text_input, xic);
#endif
/* Create OK button */
buttons[1] = gadget_button_init(dpy, &dri, gc, mainwin,
BUT_SIDE, mainh-BOT_SPACE-2*BUT_VSPACE-fh, /* x, y */
butw, fh+2*BUT_VSPACE); /* width, height */
gadget_button_set_text(buttons[1], ok_txt);
/* Create cancel button */
buttons[2] = gadget_button_init(dpy, &dri, gc, mainwin,
mainw-butw-BUT_SIDE, mainh-BOT_SPACE-2*BUT_VSPACE-fh, /* x, y */
butw, fh+2*BUT_VSPACE); /* width, height */
gadget_button_set_text(buttons[2], cancel_txt);
XSelectInput(dpy, mainwin, ExposureMask|KeyPressMask|ButtonPressMask);
size_hints.flags = PResizeInc;
txtprop1.value=(unsigned char *)"Execute a File";
txtprop2.value=(unsigned char *)"ExecuteCmd";
@@ -529,51 +272,74 @@ int main(int argc, char *argv[])
#endif
switch(event.type) {
case Expose:
if(!event.xexpose.count)
if(!event.xexpose.count) {
if(event.xexpose.window == mainwin)
refresh_main();
else if(event.xexpose.window == strwin)
refresh_str();
else if(event.xexpose.window == ok)
refresh_button(ok, ok_txt, 1);
else if(event.xexpose.window == cancel)
refresh_button(cancel, cancel_txt, 2);
case LeaveNotify:
if(depressed && event.xcrossing.window==button[selected]) {
depressed=0;
toggle(selected);
else if(event.xexpose.window == text_input->w)
gadget_textinput_repaint(text_input);
else if(event.xexpose.window == buttons[1]->w) {
gadget_button_refresh(buttons[1]);
} else if(event.xexpose.window == buttons[2]->w) {
gadget_button_refresh(buttons[2]);
}
}
case LeaveNotify:
if (depressed) {
if ((selected > 0) && event.xcrossing.window == buttons[selected]->w) {
depressed = 0;
gadget_button_set_depressed(buttons[selected], 0);
toggle(selected);
}
}
break;
case EnterNotify:
if((!depressed) && selected && event.xcrossing.window==button[selected]) {
depressed=1;
toggle(selected);
if((!depressed) && selected && event.xcrossing.window == buttons[selected]->w) {
depressed = 1;
gadget_button_set_depressed(buttons[selected], 1);
toggle(selected);
}
break;
case ButtonPress:
if(event.xbutton.button==Button1) {
if(stractive && event.xbutton.window!=strwin) {
if(stractive && event.xbutton.window!= text_input->w) {
stractive=0;
refresh_str();
gadget_textinput_selected(text_input, 0);
gadget_textinput_repaint(text_input);
}
if((c=getchoice(event.xbutton.window))) {
abortchoice();
depressed=1;
toggle(selected=c);
} else if(event.xbutton.window==strwin)
strbutton(&event.xbutton);
depressed = 1;
selected = c;
if (selected > 0) {
gadget_button_set_depressed(buttons[selected], 1);
}
toggle(selected);
} else if(event.xbutton.window== text_input->w) {
gadget_textinput_selected(text_input, 1);
gadget_textinput_buttonevent(text_input, &event.xbutton);
gadget_textinput_repaint(text_input);
}
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected)
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
case KeyPress:
if(stractive)
strkey(&event.xkey);
if(stractive) {
gadget_textinput_keyevent(text_input, &event.xkey);
gadget_textinput_repaint(text_input);
if (gadget_textinput_crlf(text_input)) {
selected = 1;
endchoice();
exit(1);
}
}
}
}
}

213
frame.c
View File

@@ -28,7 +28,7 @@ extern Display *dpy;
extern XContext client_context, screen_context;
extern Cursor wm_curs;
extern int shape_extn;
extern void redrawmenubar(Window);
extern void redrawmenubar(Scrn *, Window);
void reshape_frame(Client *c);
Window creategadget(Client *c, Window p, int x, int y, int w, int h)
@@ -102,7 +102,8 @@ void resizeclientwindow(Client *c, int width, int height)
spread_top_gadgets(c);
if(c->resize)
XMoveWindow(dpy, c->resize, c->pwidth-18, c->pheight-10);
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
if (!c->fullscreen)
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth, c->pheight-c->frameheight);
if(c->shaped)
reshape_frame(c);
sendconfig(c);
@@ -178,11 +179,18 @@ void reparent(Client *c)
extern struct mcmd_keygrab *keygrabs;
char **cargv = NULL;
int cargc;
int size_changed = 0;
getwmstate(c);
if(XGetTransientForHint(dpy, c->window, &leader) &&
!XFindContext(dpy, leader, client_context, (XPointer *)&lc))
c->scr = lc->scr;
else if(XGetTextProperty(dpy, c->window, &screen_prop, amiwm_screen)) {
!XFindContext(dpy, leader, client_context, (XPointer *)&lc) &&
lc != NULL) {
c->leader = lc;
if (lc->fsscr != NULL)
c->scr = lc->fsscr;
else
c->scr = lc->scr;
} else if(XGetTextProperty(dpy, c->window, &screen_prop, amiwm_screen)) {
do {
if(s->root == scr->root &&
(!s->deftitle[screen_prop.nitems])&&!strncmp(s->deftitle,
@@ -226,15 +234,58 @@ void reparent(Client *c)
c->framewidth=8;
c->frameheight=scr->bh+2;
attr2.override_redirect=True;
grav_map_win_to_frame(c, attr.x, attr.y, &c->x, &c->y);
/* Note: this is half of framewidth */
if ((c->x < 0) || (c->x > scr->width)) {
c->x = 0;
}
/* Note: this is the menu size, but no window framing */
if ((c->y < scr->bh) || (c->y > scr->height)) {
c->y = scr->bh;
}
/*
* Check to make sure we're not created larger than the
* available desktop size
*/
if (attr.width > (scr->width - c->framewidth)) {
attr.width = (scr->width - c->framewidth);
size_changed = 1;
}
if (attr.height > (scr->height - c->frameheight)) {
attr.height = (scr->height - c->frameheight);
size_changed = 1;
}
c->pwidth = attr.width + c->framewidth;
c->pheight = attr.height + c->frameheight;
/*
* Note: if we adjusted c->pwidth / c->pheight then
* we need to call XResizeWindow on c->window.
*
* Do it before we reparent it just to make things
* easy.
*/
if (size_changed == 1) {
XResizeWindow(dpy, c->window, c->pwidth-c->framewidth,
c->pheight-c->frameheight);
}
/* Create the parent window that'll have our decoration */
c->parent=XCreateWindow(dpy, scr->back, c->x, c->y,
c->pwidth=attr.width+8, c->pheight=attr.height+2+scr->bh,
c->pwidth, c->pheight,
0, CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect, &attr2);
XSaveContext(dpy, c->parent, client_context, (XPointer)c);
XSaveContext(dpy, c->parent, screen_context, (XPointer)c->scr);
XSetWindowBackground(dpy, c->parent, scr->dri.dri_Pens[BACKGROUNDPEN]);
XSetWindowBorderWidth(dpy, c->window, 0);
/* Reparent time */
XReparentWindow(dpy, c->window, c->parent, 4, scr->bh);
XSelectInput(dpy, c->window, EnterWindowMask | LeaveWindowMask |
ColormapChangeMask | PropertyChangeMask |
@@ -249,11 +300,12 @@ void reparent(Client *c)
for(kg=keygrabs; kg; kg=kg->next)
XGrabKey(dpy, kg->keycode, kg->modifiers, c->window, False, GrabModeAsync,
GrabModeAsync);
cb=(resizable(&c->sizehints)? prefs.sizeborder:0);
cb=(resizable(c->sizehints)? prefs.sizeborder:0);
c->close=creategadget(c, c->parent, 0, 0, 19, scr->bh);
c->drag=creategadget(c, c->parent, 19, 0, 1, 1);
if(c->wflags&WF_NOICONIFY)
if(c->wflags&WF_NOICONIFY || c->leader != NULL) {
c->iconify=None;
}
else
c->iconify=creategadget(c, c->parent, 0, 0, 23, scr->bh);
if(cb)
@@ -276,7 +328,8 @@ void reparent(Client *c)
#endif
XMapSubwindows(dpy, c->parent);
sendconfig(c);
setstringprop(c->window, amiwm_screen, scr->deftitle);
if (scr->deftitle != NULL)
setstringprop(c->window, amiwm_screen, scr->deftitle);
if(prefs.focus == FOC_CLICKTOTYPE)
XGrabButton(dpy, Button1, AnyModifier, c->parent, True,
ButtonPressMask, GrabModeSync, GrabModeAsync, None, wm_curs);
@@ -466,7 +519,7 @@ void clickenter()
{
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
mbdclick = scr;
redrawmenubar(scr->menubardepth);
redrawmenubar(scr, scr->menubardepth);
} else {
scr = clickclient->scr;
redraw(clickclient, clickclient->clicked=clickwindow);
@@ -477,7 +530,7 @@ void clickleave()
{
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
mbdclick = NULL;
redrawmenubar(scr->menubardepth);
redrawmenubar(scr, scr->menubardepth);
} else {
scr = clickclient->scr;
clickclient->clicked=None;
@@ -547,6 +600,133 @@ void raiselowerclient(Client *c, int place)
} else XRaiseWindow(dpy, c->parent);
}
extern void setfocus(Window);
extern Client *activeclient;
/*
* Lower the top most client.
*
* Update focus if required.
*/
void
lowertopmostclient(Scrn *scr)
{
Window r, p, *children;
unsigned int nchildren;
Client *c_top, *c_bot;
Window ws[2];
/* Query the list of windows under the active screen */
if (XQueryTree(dpy, scr->back, &r, &p, &children, &nchildren) == 0) {
fprintf(stderr, "%s: couldn't fetch the window list\n", __func__);
return;
}
/*
* Grab the top most client
*/
c_top = topmostmappedclient(children, nchildren);
if (c_top == NULL) {
fprintf(stderr, "%s: couldn't get the top most mapped client\n", __func__);
return;
}
/*
* And the bottom most client.
*/
c_bot = bottommostmappedclient(children, nchildren);
if (c_bot == NULL) {
fprintf(stderr, "%s: couldn't get the bottom most mapped client\n", __func__);
return;
}
/*
* If we're doing click-to-focus, mark the old top-most window
* as inactive; mark the new top-most window as active and has focus.
*/
if (prefs.focus == FOC_CLICKTOTYPE) {
c_top->active = False;
c_bot->active = True;
activeclient = c_bot;
redrawclient(c_bot);
redrawclient(c_top);
setfocus(c_bot->window);
}
/*
* Push this to the bottom of the stack.
*/
ws[0]=c_bot->parent;
ws[1]=c_top->parent;
XRestackWindows(dpy, ws, 2);
/*
* Free the children list.
*/
if (children)
XFree(children);
}
/*
* Raise the bottom most client.
*
* Update focus if required.
*/
void
raisebottommostclient(Scrn *scr)
{
Window r, p, *children;
unsigned int nchildren;
Client *c_top, *c_bot;
/* Query the list of windows under the active screen */
if (XQueryTree(dpy, scr->back, &r, &p, &children, &nchildren) == 0) {
fprintf(stderr, "%s: couldn't fetch the window list\n", __func__);
return;
}
/*
* Grab the top most client
*/
c_top = topmostmappedclient(children, nchildren);
if (c_top == NULL) {
fprintf(stderr, "%s: couldn't get the top most mapped client\n", __func__);
return;
}
/*
* And the bottom most client.
*/
c_bot = bottommostmappedclient(children, nchildren);
if (c_bot == NULL) {
fprintf(stderr, "%s: couldn't get the bottom most mapped client\n", __func__);
return;
}
/*
* If we're doing click-to-focus, mark the old top-most window
* as inactive; mark the new top-most window as active and has focus.
*/
if (prefs.focus == FOC_CLICKTOTYPE) {
c_top->active = False;
c_bot->active = True;
activeclient = c_bot;
redrawclient(c_bot);
redrawclient(c_top);
setfocus(c_bot->window);
}
/* Raise the selected window to the top */
XRaiseWindow(dpy, c_bot->parent);
/*
* Free the children list.
*/
if (children)
XFree(children);
}
void gadgetunclicked(Client *c, XEvent *e)
{
extern void adjusticon(Icon *);
@@ -574,16 +754,7 @@ void gadgetunclicked(Client *c, XEvent *e)
/* XWarpPointer(dpy, None, c->zoom, 0, 0, 0, 0, 23/2, scr->h5); */
sendconfig(c);
} else if(w==c->iconify) {
if(!(c->icon))
createicon(c);
XUnmapWindow(dpy, c->parent);
/* XUnmapWindow(dpy, c->window); */
adjusticon(c->icon);
XMapWindow(dpy, c->icon->window);
if(c->icon->labelwidth)
XMapWindow(dpy, c->icon->labelwin);
c->icon->mapped=1;
setclientstate(c, IconicState);
iconify(c);
}
}
clickwindow=None;

2101
gram.c

File diff suppressed because it is too large Load Diff

195
gram.h
View File

@@ -1,195 +0,0 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
ERRORTOKEN = 258,
LEFTBRACE = 259,
RIGHTBRACE = 260,
YES = 261,
NO = 262,
RIGHT = 263,
BOTTOM = 264,
BOTH = 265,
NONE = 266,
MAGICWB = 267,
SYSTEM = 268,
SCHWARTZ = 269,
ALWAYS = 270,
AUTO = 271,
MANUAL = 272,
SEPARATOR = 273,
T_DETAILPEN = 274,
T_BLOCKPEN = 275,
T_TEXTPEN = 276,
T_SHINEPEN = 277,
T_SHADOWPEN = 278,
T_FILLPEN = 279,
T_FILLTEXTPEN = 280,
T_BACKGROUNDPEN = 281,
T_HIGHLIGHTTEXTPEN = 282,
T_BARDETAILPEN = 283,
T_BARBLOCKPEN = 284,
T_BARTRIMPEN = 285,
FASTQUIT = 286,
SIZEBORDER = 287,
DEFAULTICON = 288,
ICONDIR = 289,
ICONPALETTE = 290,
SCREENFONT = 291,
ICONFONT = 292,
TOOLITEM = 293,
FORCEMOVE = 294,
SCREEN = 295,
MODULE = 296,
MODULEPATH = 297,
INTERSCREENGAP = 298,
AUTORAISE = 299,
FOCUS = 300,
FOLLOWMOUSE = 301,
CLICKTOTYPE = 302,
SLOPPY = 303,
CUSTOMICONSONLY = 304,
TITLEBARCLOCK = 305,
TITLECLOCKFORMAT = 306,
OPAQUEMOVE = 307,
OPAQUERESIZE = 308,
SCREENMENU = 309,
STYLE = 310,
CLASS = 311,
TITLE = 312,
ICONTITLE = 313,
ICON = 314,
SHORTLABELICONS = 315,
STRING = 316,
NUMBER = 317
};
#endif
/* Tokens. */
#define ERRORTOKEN 258
#define LEFTBRACE 259
#define RIGHTBRACE 260
#define YES 261
#define NO 262
#define RIGHT 263
#define BOTTOM 264
#define BOTH 265
#define NONE 266
#define MAGICWB 267
#define SYSTEM 268
#define SCHWARTZ 269
#define ALWAYS 270
#define AUTO 271
#define MANUAL 272
#define SEPARATOR 273
#define T_DETAILPEN 274
#define T_BLOCKPEN 275
#define T_TEXTPEN 276
#define T_SHINEPEN 277
#define T_SHADOWPEN 278
#define T_FILLPEN 279
#define T_FILLTEXTPEN 280
#define T_BACKGROUNDPEN 281
#define T_HIGHLIGHTTEXTPEN 282
#define T_BARDETAILPEN 283
#define T_BARBLOCKPEN 284
#define T_BARTRIMPEN 285
#define FASTQUIT 286
#define SIZEBORDER 287
#define DEFAULTICON 288
#define ICONDIR 289
#define ICONPALETTE 290
#define SCREENFONT 291
#define ICONFONT 292
#define TOOLITEM 293
#define FORCEMOVE 294
#define SCREEN 295
#define MODULE 296
#define MODULEPATH 297
#define INTERSCREENGAP 298
#define AUTORAISE 299
#define FOCUS 300
#define FOLLOWMOUSE 301
#define CLICKTOTYPE 302
#define SLOPPY 303
#define CUSTOMICONSONLY 304
#define TITLEBARCLOCK 305
#define TITLECLOCKFORMAT 306
#define OPAQUEMOVE 307
#define OPAQUERESIZE 308
#define SCREENMENU 309
#define STYLE 310
#define CLASS 311
#define TITLE 312
#define ICONTITLE 313
#define ICON 314
#define SHORTLABELICONS 315
#define STRING 316
#define NUMBER 317
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 50 "gram.y" /* yacc.c:1909 */
int num;
char *ptr;
#line 183 "y.tab.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */

26
gram.y
View File

@@ -13,7 +13,6 @@ extern void set_mwb_palette(void);
extern void set_schwartz_palette(void);
extern void set_custom_palette(char *fn);
extern void add_toolitem(char *, char *, char *, int);
extern Scrn *openscreen(char *, Window);
extern void create_module(Scrn *, char *, char *);
extern char *default_colors[NUMDRIPENS];
extern char *default_screenfont, *label_font_name;
@@ -44,6 +43,17 @@ static void append_to(char **x, char *y)
}
static int ti_level=0;
int yylex();
extern char *progname;
extern int ParseError;
int yyerror(s) char *s;
{
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
ParseError = 1;
return 0;
}
%}
%union
@@ -66,6 +76,7 @@ static int ti_level=0;
%token <num> INTERSCREENGAP AUTORAISE FOCUS FOLLOWMOUSE CLICKTOTYPE SLOPPY
%token <num> CUSTOMICONSONLY
%token <num> TITLEBARCLOCK TITLECLOCKFORMAT
%token <num> BATTERYINFO
%token <num> OPAQUEMOVE OPAQUERESIZE SCREENMENU STYLE CLASS TITLE ICONTITLE ICON
%token <num> SHORTLABELICONS
%token <ptr> STRING
@@ -103,8 +114,8 @@ stmt : error
| SCREEN string { openscreen($2,DefaultRootWindow(dpy)); }
| SCREEN NUMBER string { if(($2==DefaultScreen(dpy)||prefs.manage_all) && $2<ScreenCount(dpy)) openscreen($3,RootWindow(dpy,$2)); }
| MODULEPATH string { prefs.module_path = $2; }
| MODULE string STRING { create_module((front? front->upfront:NULL), $2, $3); }
| MODULE string { create_module((front? front->upfront:NULL), $2, NULL); }
| MODULE string STRING { create_module((get_front_scr() ? get_front_scr()->upfront:NULL), $2, $3); }
| MODULE string { create_module((get_front_scr() ? get_front_scr()->upfront:NULL), $2, NULL); }
| INTERSCREENGAP NUMBER { prefs.borderwidth=$2; }
| AUTORAISE truth { prefs.autoraise=$2; }
| OPAQUEMOVE truth { prefs.opaquemove=$2; }
@@ -118,6 +129,7 @@ stmt : error
prefs.titleclockinterval=$2;
prefs.titleclockformat=$3; }
| SCREENMENU truth { prefs.screenmenu=$2; }
| BATTERYINFO truth { prefs.battery_info = $2; }
| stylespec styleitems RIGHTBRACE
;
@@ -195,11 +207,3 @@ forcemove_policy : ALWAYS { $$ = FM_ALWAYS; }
;
%%
extern char *progname;
extern int ParseError;
int yyerror(s) char *s;
{
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
ParseError = 1;
return 0;
}

86
icc.c
View File

@@ -5,7 +5,9 @@
#include "style.h"
#include "prefs.h"
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
@@ -14,14 +16,17 @@ extern struct Library *XLibBase;
extern void redraw(Client *, Window);
Atom utf8_string, net_wm_name;
Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus;
Atom wm_colormaps, wm_name, wm_normal_hints, wm_hints, wm_icon_name, wm_class;
Atom net_supporting_wm_check, net_supported, net_wm_state, net_wm_state_fullscreen;
Atom amiwm_screen, swm_vroot, amiwm_wflags, amiwm_appiconmsg, amiwm_appwindowmsg;
extern Display *dpy;
void init_atoms()
{
utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
wm_state = XInternAtom(dpy, "WM_STATE", False);
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -33,6 +38,11 @@ void init_atoms()
wm_hints = XInternAtom(dpy, "WM_HINTS", False);
wm_icon_name = XInternAtom(dpy, "WM_ICON_NAME", False);
wm_class = XInternAtom(dpy, "WM_CLASS", False);
net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False);
net_wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
net_wm_state_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
amiwm_screen = XInternAtom(dpy, "AMIWM_SCREEN", False);
swm_vroot = XInternAtom(dpy, "__SWM_VROOT", False);
amiwm_wflags = XInternAtom(dpy, "AMIWM_WFLAGS", False);
@@ -40,6 +50,23 @@ void init_atoms()
amiwm_appwindowmsg = XInternAtom(dpy, "AMIWM_APPWINDOWMSG", False);
}
void setsupports(Window root, Window checkwin)
{
Atom atoms[] = {
net_wm_state,
net_wm_state_fullscreen,
};
XChangeProperty(dpy, root, net_supported, XA_ATOM, 32,
PropModeReplace, (unsigned char *)atoms,
sizeof(atoms)/sizeof(atoms[0]));
XChangeProperty(dpy, root, net_supporting_wm_check, XA_WINDOW, 32,
PropModeReplace, (void *)(Window[]){checkwin}, 1);
XChangeProperty(dpy, checkwin, net_supporting_wm_check, XA_WINDOW, 32,
PropModeReplace, (void *)(Window[]){checkwin}, 1);
XChangeProperty(dpy, checkwin, net_wm_name, utf8_string, 8,
PropModeReplace, (void *)"AmiWM", 5);
}
void setstringprop(Window w, Atom a, char *str)
{
XTextProperty txtp;
@@ -51,20 +78,39 @@ void setstringprop(Window w, Atom a, char *str)
XSetTextProperty(dpy, w, &txtp, a);
}
XEvent *mkcmessage(Window w, Atom a, long x)
void getwmstate(Client *c)
{
static XEvent ev;
Atom *p;
int i;
long n;
Window w;
memset(&ev, 0, sizeof(ev));
ev.xclient.type = ClientMessage;
ev.xclient.window = w;
ev.xclient.message_type = a;
ev.xclient.format = 32;
ev.xclient.data.l[0] = x;
ev.xclient.data.l[1] = CurrentTime;
return &ev;
w = c->window;
if ((n = _getprop(w, net_wm_state, XA_ATOM, 20L, (char**)&p)) < 0)
return;
c->fullscreen = 0;
if (!n)
return;
for (i = 0; i < n; i++)
if (p[i] == net_wm_state_fullscreen)
c->fullscreen = 1;
XFree((char *) p);
}
void setwmstate(Client *c)
{
if (c->fullscreen) {
Atom data[] = {
net_wm_state_fullscreen
};
XChangeProperty(dpy, c->window, net_wm_state, XA_ATOM, 32, PropModeReplace,
(unsigned char *)data, 1);
} else
XDeleteProperty(dpy, c->window, net_wm_state);
}
void sendcmessage(Window w, Atom a, long x)
{
if(!(XSendEvent(dpy, w, False, 0L, mkcmessage(w, a, x))))
@@ -278,9 +324,27 @@ void handle_client_message(Client *c, XClientMessageEvent *xcme)
i->mapped=0;
deselecticon(i);
XMapWindow(dpy, c->window);
if(c->parent!=c->scr->root)
if(c->parent!=c->scr->root && !c->fullscreen)
XMapRaised(dpy, c->parent);
setclientstate(c, NormalState);
}
} else if (xcme->message_type == net_wm_state) {
int action=xcme->data.l[0];
Atom prop=xcme->data.l[1];
if (prop == net_wm_state_fullscreen)
switch (action) {
case 0: fullscreen(c, 0); break; /* _NET_WM_STATE_REMOVE */
case 1: fullscreen(c, 1); break; /* _NET_WM_STATE_ADD */
case 2: fullscreen(c, !c->fullscreen); break; /* _NET_WM_STATE_TOGGLE */
}
}
}
Window get_transient_for(Window w)
{
Window transient_for = None;
if (!XGetTransientForHint(dpy, w, &transient_for))
return None;
return transient_for;
}

13
icc.h
View File

@@ -6,12 +6,16 @@
#include "client.h"
extern void init_atoms(void);
extern void setsupports(Window, Window);
extern void sendcmessage(Window, Atom, long);
extern void getproto(Client *c);
extern void getwmstate(Client *c);
extern void setwmstate(Client *c);
extern void setstringprop(Window, Atom, char *);
extern void propertychange(Client *, Atom);
extern long _getprop(Window, Atom, Atom, long, char **);
extern void getwflags(Client *);
extern Window get_transient_for(Window);
extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, wm_colormaps, wm_hints, amiwm_screen, swm_vroot;
@@ -21,4 +25,13 @@ extern Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus, w
#define Psizeright 8
#define Psizetrans 16
#define mkcmessage(w, a, x, ...) (&(XEvent){.xclient = { \
.type = ClientMessage, \
.window = (w), \
.message_type = (a), \
.format = 32, \
.data.l = {(long)(x), CurrentTime, __VA_ARGS__}, \
}})
#endif

57
icon.c
View File

@@ -156,12 +156,12 @@ void reparenticon(Icon *i, Scrn *s, int x, int y)
i->next=s->icons;
s->icons=i;
if(i->client) {
i->client->scr=s;
if(i->client->parent != i->client->scr->root)
XReparentWindow(dpy, i->client->parent, s->back,
i->client->x, i->client->y);
setstringprop(i->client->window, amiwm_screen, s->deftitle);
sendconfig(i->client);
reparent_client(s, i->client);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
if (dialog->leader == i->client) {
reparent_client(s, dialog);
}
}
}
if(os)
selecticon(i);
@@ -398,7 +398,7 @@ Icon *createappicon(struct module *m, Window p, char *name,
scr=c->scr;
} else
if(XFindContext(dpy, p, screen_context, (XPointer*)&scr))
scr=front;
scr = get_front_scr();
if(p==scr->root) p=scr->back;
i->scr=scr;
@@ -635,3 +635,46 @@ void free_icon_pms(struct IconPixmaps *pms)
free_color_store(dpy, &pms->cs);
free_color_store(dpy, &pms->cs2);
}
void iconify(Client *c)
{
if(!(c->icon))
createicon(c);
XUnmapWindow(dpy, c->parent);
adjusticon(c->icon);
XMapWindow(dpy, c->icon->window);
if(c->icon->labelwidth)
XMapWindow(dpy, c->icon->labelwin);
c->icon->mapped=1;
setclientstate(c, IconicState);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
if (dialog->leader == c) {
XUnmapWindow(dpy, dialog->parent);
setclientstate(dialog, IconicState);
}
}
}
void deiconify(Icon *i)
{
Client *c = i->client;
if(i->labelwin)
XUnmapWindow(dpy, i->labelwin);
if(i->window)
XUnmapWindow(dpy, i->window);
i->mapped=0;
deselecticon(i);
if (c != NULL) {
XMapWindow(dpy, c->window);
if(c->parent!=c->scr->root && !c->fullscreen)
XMapRaised(dpy, c->parent);
setclientstate(c, NormalState);
for (Client *dialog = clients; dialog != NULL; dialog = dialog->next) {
if (dialog->leader == c) {
XMapRaised(dpy, dialog->parent);
setclientstate(dialog, NormalState);
}
}
}
}

2
icon.h
View File

@@ -39,5 +39,7 @@ extern void adjusticon(Icon *);
extern void selecticon(Icon *);
extern void deselecticon(Icon *);
extern void free_icon_pms(struct IconPixmaps *pms);
extern void iconify(Client *);
extern void deiconify(Icon *);
#endif

View File

@@ -1,4 +1,4 @@
#!/usr/local/bin/perl
#!/usr/bin/env perl
sub chompstring {
my ($len, $rest)=unpack("Na*", $_[0]);

View File

@@ -1,238 +1,529 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
tab=' '
nl='
'
IFS="${IFS-${defaultIFS}}"
IFS=" $tab$nl"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
# Set DOITPROG to "echo" to test this script.
pathcomp=''
doit=${DOITPROG-}
doit_exec=${doit:-exec}
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
pathcomp="${pathcomp}/"
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
# If we're going to rename the final executable, determine the name now.
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# don't allow the sed command to completely eliminate the filename
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
# Make a temp file name in the proper directory.
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
dsttmp=$dstdir/#inst.$$#
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Move or copy the file name to the temp name
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
$doit $instcmd $src $dsttmp &&
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
trap "rm -f ${dsttmp}" 0 &&
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
# and set any options; do chmod last to preserve setuid bits
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
obsolete_mkdir_used=false
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
# Now rename the file to the real destination.
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
fi &&
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
exit 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1971
kbdlexer.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,10 @@
%option noyywrap
%{
#include <X11/Xmu/CharSet.h>
#include <string.h>
#include "libami.h"
#include "kbdmodule.h"
#include "kbdmodule.tab.h"
unsigned char *inptr;
extern char *progname;
@@ -41,7 +42,10 @@ int parse_keyword(char *str, YYSTYPE *val)
{ "back", (mdfuncp)md_back },
{ "front", (mdfuncp)md_front },
{ "iconify", (mdfuncp)md_iconify },
{ "lowerwindow", (mdfuncp)md_rotate_window_lower },
{ "raisewindow", (mdfuncp)md_rotate_window_raise },
{ "rotatescreens", (mdfuncp)k_rotscreens },
{ "rotatewindow", (mdfuncp)md_rotate_window_desktop },
};
#define N_FUNC (sizeof(functab)/sizeof(functab[0]))
struct { char *name; int token, num; } kwtab[] = {
@@ -136,9 +140,6 @@ int parse_keyword(char *str, YYSTYPE *val)
progname, yytext); }
%%
#ifndef yywrap
int yywrap() { return 1; }
#endif
#undef input
#define input() ((*inptr)?(*inptr++):0)
#undef unput

File diff suppressed because it is too large Load Diff

View File

@@ -1,94 +0,0 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
ERRORTOKEN = 258,
META = 259,
MODIFIER = 260,
WHEREABOUTS = 261,
COLON = 262,
BAR = 263,
KEYSYM = 264,
FUNCTION = 265
};
#endif
/* Tokens. */
#define ERRORTOKEN 258
#define META 259
#define MODIFIER 260
#define WHEREABOUTS 261
#define COLON 262
#define BAR 263
#define KEYSYM 264
#define FUNCTION 265
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 14 "kbdmodule.y" /* yacc.c:1909 */
int num;
char *ptr;
KeySym keysym;
struct { unsigned int mods; int meta; } modifiers;
void (*function)(Window);
#line 82 "y.tab.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */

View File

@@ -8,6 +8,14 @@ void docmd(XEvent *e, void *callback)
((void (*)(Window))callback)(e->xany.window);
}
int yylex();
char *progname;
int yyerror(s) char *s;
{
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
return 0;
}
%}
%union
@@ -55,14 +63,6 @@ command : FUNCTION { $$=$1; }
%%
char *progname;
int yyerror(s) char *s;
{
fprintf (stderr, "%s: error in input file: %s\n", progname, s ? s : "");
return 0;
}
int main(int argc, char *argv[])
{
char *arg=md_init(argc, argv);

View File

@@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "libami.h"

1901
lex.c

File diff suppressed because it is too large Load Diff

4
lex.l
View File

@@ -1,12 +1,12 @@
%option noyywrap
%{
#include <stdio.h>
#include "gram.h"
#include "gram.tab.h"
extern char *progname;
extern int ParseError;
extern FILE *rcfile;
#undef yyin
#define yyin rcfile
#define yywrap() 1
extern int parse_keyword(char *);
void fixup_string(char *, char *);
#define YY_SKIP_YYWRAP

View File

@@ -1,45 +0,0 @@
srcdir = .
SHELL = /bin/sh
CC = gcc
LEX = flex
YACC = bison -y
RANLIB = ranlib
CFLAGS = -g -O2
YFLAGS = -d
DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_TERMIO_H=1 -DHAVE_X11_EXTENSIONS_SHAPE_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DRETSIGTYPE=void -DHAVE_WAIT3=1 -DHAVE_SELECT=1 -DHAVE_STRDUP=1 -DHAVE_WAITPID=1 -DHAVE_XSHAPE=1 -DBSD_STYLE_GETTIMEOFDAY=1 -DHAVE_XCREATEFONTSET=1 -DHAVE_XMBTEXTESCAPEMENT=1 -DHAVE_XUTF8DRAWIMAGESTRING=1 -DUSE_FONTSETS=1 -DLAME_ENDIAN=1
ALL_CFLAGS = -I. -I.. $(DEFS) $(CFLAGS)
LIBS = -lSM -lICE -lXext -lXmu -lX11
prefix = /usr/local
exec_prefix = ${prefix}
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
INSTALL = /usr/bin/install -c
LN_S = ln -s
OBJS = drawinfo.o module.o broker.o eventdispatcher.o mdscreen.o \
mdicon.o mdwindow.o kbdsupport.o hotkey.o \
lists.o readargs.o iconlib.o iconutil.o error.o strutil.o \
iffparse.o
SRCS = drawinfo.c module.c broker.c eventdispatcher.c mdscreen.c \
mdicon.c mdwindow.c kbdsupport.c hotkey.c \
lists.c readargs.c iconlib.c iconutil.c error.c strutil.c \
iffparse.c
all : libami.a
libami.a : $(OBJS)
ar rc libami.a $(OBJS)
$(RANLIB) libami.a
.c.o:
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
depend: $(SRCS)
-@rm Makefile.bak
mv Makefile Makefile.bak
( sed '/^#--DO NOT REMOVE THIS LINE--$$/q' < Makefile.bak ; \
$(CC) -MM $(ALL_CFLAGS) $(SRCS) ) > Makefile
#--DO NOT REMOVE THIS LINE--

View File

@@ -6,9 +6,9 @@ LEX = @LEX@
YACC = @YACC@
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@
YFLAGS = -d
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
ALL_CFLAGS = -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
ALL_CFLAGS = -Wall -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
LIBS = @X_LIBS@ @X_PRE_LIBS@ -lXext -lXmu -lX11 @X_EXTRA_LIBS@ @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -16,21 +16,25 @@ bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
INSTALL = @INSTALL@
LN_S = @LN_S@
RM = -rm -f
OBJS = drawinfo.o module.o broker.o eventdispatcher.o mdscreen.o \
mdicon.o mdwindow.o kbdsupport.o hotkey.o \
mdicon.o mdwindow.o kbdsupport.o hotkey.o mdbattery.o \
lists.o readargs.o iconlib.o iconutil.o error.o strutil.o \
iffparse.o
iffparse.o gadget_button.o gadget_textbox.o gadget_textinput.o
SRCS = drawinfo.c module.c broker.c eventdispatcher.c mdscreen.c \
mdicon.c mdwindow.c kbdsupport.c hotkey.c \
mdicon.c mdwindow.c kbdsupport.c hotkey.c mdbattery.c \
lists.c readargs.c iconlib.c iconutil.c error.c strutil.c \
iffparse.c
iffparse.c gadget_button.c gadget_textbox.c gadget_textinput.c
all : libami.a
clean :
$(RM) *.o libami.a
libami.a : $(OBJS)
ar rc libami.a $(OBJS)
$(AR) rc libami.a $(OBJS)
$(RANLIB) libami.a
.c.o:

View File

@@ -40,7 +40,7 @@ BOOL Fault(LONG code, UBYTE *header, UBYTE *buffer, LONG len)
strcpy((char *)buffer, syserrmsg[code-MIN_ERRNO]);
} else {
char number[6+4*sizeof(LONG)];
sprintf(number, "Error %ld", code);
sprintf(number, "Error %ld", (long int) code);
if(len<strlen(number)+1)
return FALSE;
strcpy((char *)buffer, number);

136
libami/gadget_button.c Normal file
View File

@@ -0,0 +1,136 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <errno.h>
#ifdef USE_FONTSETS
#include <locale.h>
#include <wchar.h>
#endif
#include "drawinfo.h"
#include "gadget_button.h"
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
extern struct Library *XLibBase;
#endif
/*
* This is the button code from the executecmd.c tool.
*/
struct gadget_button *
gadget_button_init(Display *dpy, struct DrawInfo *dri, GC gc, Window mainwin,
int x, int y, int butw, int buth)
{
struct gadget_button *b;
b = calloc(1, sizeof(*b));
if (b == NULL) {
return (NULL);
}
b->dpy = dpy;
b->dri = dri;
b->x = x;
b->y = y;
b->butw = butw;
b->buth = buth;
b->txt = strdup("");
b->gc = gc;
b->w = XCreateSimpleWindow(dpy, mainwin,
x, y,
butw, /* width */
buth, /* height */
0, /* depth */
dri->dri_Pens[SHADOWPEN],
dri->dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, b->w, ExposureMask | ButtonPressMask
| ButtonReleaseMask | EnterWindowMask | LeaveWindowMask);
return (b);
}
void
gadget_button_set_text(struct gadget_button *b, const char *txt)
{
if (b->txt != NULL)
free(b->txt);
b->txt = strdup(txt);
}
void
gadget_button_refresh(struct gadget_button *b)
{
int fh = b->dri->dri_Ascent + b->dri->dri_Descent;
int h = fh + (2 * BUT_VSPACE);
int l=strlen(b->txt);
#ifdef USE_FONTSETS
int tw = XmbTextEscapement(b->dri->dri_FontSet, b->txt, l);
#else
int tw = XTextWidth(b->dri->dri_Font, b->txt, l);
#endif
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(b->dpy, b->w, b->dri->dri_FontSet, b->gc,
(b->butw-tw)>>1, b->dri->dri_Ascent+BUT_VSPACE, b->txt, l);
#else
XDrawString(b->dpy, b->w, b->gc, (b->butw-tw)>>1,
b->dri->dri_Ascent+BUT_VSPACE, b->txt, l);
#endif
XSetForeground(b->dpy, b->gc,
b->dri->dri_Pens[b->depressed ? SHADOWPEN:SHINEPEN]);
XDrawLine(b->dpy, b->w, b->gc, 0, 0, b->butw-2, 0);
XDrawLine(b->dpy, b->w, b->gc, 0, 0, 0, h-2);
XSetForeground(b->dpy, b->gc,
b->dri->dri_Pens[b->depressed ? SHINEPEN:SHADOWPEN]);
XDrawLine(b->dpy, b->w, b->gc, 1, h-1, b->butw-1, h-1);
XDrawLine(b->dpy, b->w, b->gc, b->butw-1, 1, b->butw-1, h-1);
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
XDrawPoint(b->dpy, b->w, b->gc, b->butw-1, 0);
XDrawPoint(b->dpy, b->w, b->gc, 0, h-1);
}
void
gadget_button_set_depressed(struct gadget_button *b, int depressed)
{
b->depressed = depressed;
}
void
gadget_button_toggle(struct gadget_button *b)
{
int pen;
pen = (b->depressed) ? FILLPEN : BACKGROUNDPEN;
XSetWindowBackground(b->dpy, b->w, b->dri->dri_Pens[pen]);
XClearWindow(b->dpy, b->w);
gadget_button_refresh(b);
}
void
gadget_button_free(struct gadget_button *b)
{
XDestroyWindow(b->dpy, b->w);
free(b->txt);
free(b);
}

35
libami/gadget_button.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef __LIBAMI__GADGET_BUTTON_H__
#define __LIBAMI__GADGET_BUTTON_H__
#define BOT_SPACE 4
#define TEXT_SIDE 8
#define BUT_SIDE 12
#define TOP_SPACE 4
#define INT_SPACE 7
#define BUT_VSPACE 2
#define BUT_HSPACE 8
struct gadget_button {
Display *dpy;
struct DrawInfo *dri;
Window w;
GC gc;
int x;
int y;
int buth;
int butw;
char *txt;
int depressed;
};
extern struct gadget_button * gadget_button_init(Display *dpy,
struct DrawInfo *dri, GC gc, Window mainwin,
int x, int y, int butw, int buth);
extern void gadget_button_set_text(struct gadget_button *b, const char *txt);
extern void gadget_button_refresh(struct gadget_button *b);
extern void gadget_button_set_depressed(struct gadget_button *b,
int depressed);
extern void gadget_button_toggle(struct gadget_button *b);
extern void gadget_button_free(struct gadget_button *b);
#endif /* __LIBAMI__GADGET_BUTTON_H__ */

123
libami/gadget_textbox.c Normal file
View File

@@ -0,0 +1,123 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "drawinfo.h"
#include "libami.h"
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
extern struct Library *XLibBase;
#endif
#include "gadget_textbox.h"
#if 0
struct gadget_textbox_line {
struct line *next;
const char *text;
int l, w, h;
};
#endif
#if 0
struct gadget_textbox {
struct gadget_textbox_line *firstline, *lastline;
};
#endif
struct gadget_textbox *
gadget_textbox_create(Display *dpy, struct DrawInfo *dri, GC gc,
Window mainwin, int x, int y, int width, int height)
{
struct gadget_textbox *g;
g = calloc(1, sizeof(*g));
if (g == NULL) {
return (NULL);
}
g->dpy = dpy;
g->dri = dri;
g->gc = gc;
g->x = x;
g->y = y;
g->width = width;
g->height = height;
g->w = XCreateSimpleWindow(g->dpy, mainwin,
g->x, g->y,
g->width, g->height,
0,
g->dri->dri_Pens[SHADOWPEN],
g->dri->dri_Pens[BACKGROUNDPEN]);
XSelectInput(g->dpy, g->w, ExposureMask);
return (g);
}
void
gadget_textbox_free(struct gadget_textbox *g)
{
/* XXX TODO */
}
struct gadget_textbox_line *
gadget_textbox_addline(struct gadget_textbox *g, const char *text)
{
struct gadget_textbox_line *l;
l = calloc(1, sizeof(*l));
if (l == NULL) {
return (NULL);
}
if(g->lastline)
g->lastline->next = l;
else
g->firstline = l;
g->lastline = l;
l->text = strdup(text);
l->l = strlen(text);
#ifdef USE_FONTSETS
l->w = XmbTextEscapement(g->dri->dri_FontSet, l->text, l->l);
#else
l->w = XTextWidth(g->dri->dri_Font, l->text, l->l);
#endif
l->h = g->dri->dri_Ascent + g->dri->dri_Descent;
return (l);
}
void
gadget_textbox_refresh(struct gadget_textbox *g)
{
// This is OBVIOUSLY the wrong value for x here, but let's get it going
int x = TXT_HSPACE / 2;
int y = ((g->dri->dri_Ascent+g->dri->dri_Descent)>>1)+g->dri->dri_Ascent;
struct gadget_textbox_line *l;
/* Draw the bounding box */
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[SHADOWPEN]);
XDrawLine(g->dpy, g->w, g->gc, 0, 0, g->width-2, 0);
XDrawLine(g->dpy, g->w, g->gc, 0, 0, 0, g->height-2);
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[SHINEPEN]);
XDrawLine(g->dpy, g->w, g->gc, 0, g->height-1, g->width-1, g->height-1);
XDrawLine(g->dpy, g->w, g->gc, g->width-1, 0, g->width-1, g->height-1);
/* Draw text lines */
XSetForeground(g->dpy, g->gc, g->dri->dri_Pens[TEXTPEN]);
for(l = g->firstline; l; l=l->next) {
#ifdef USE_FONTSETS
XmbDrawString(g->dpy, g->w, g->dri->dri_FontSet, g->gc,
x, y, l->text, l->l);
#else
XDrawString(g->dpy, g->w, g->gc, x, y, l->text, l->l);
#endif
y+=g->dri->dri_Ascent + g->dri->dri_Descent;
}
}

35
libami/gadget_textbox.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef __LIBAMI_GADGET_TEXTBOX_H__
#define __LIBAMI_GADGET_TEXTBOX_H__
// These are for the text box widget
#define TXT_HSPACE 48
#define TXT_TOPSPACE 4
#define TXT_MIDSPACE 3
#define TXT_BOTSPACE 4
struct gadget_textbox_line {
struct gadget_textbox_line *next;
const char *text;
int l, w, h;
};
struct gadget_textbox {
Display *dpy;
struct DrawInfo *dri;
GC gc;
Window w;
int x, y;
int width, height;
struct gadget_textbox_line *firstline, *lastline;
};
extern struct gadget_textbox *gadget_textbox_create(Display *dpy,
struct DrawInfo *dri, GC gc, Window mainwin, int x, int y,
int width, int height);
extern void gadget_textbox_free(struct gadget_textbox *g);
extern struct gadget_textbox_line * gadget_textbox_addline(
struct gadget_textbox *g, const char *text);
extern void gadget_textbox_refresh(struct gadget_textbox *g);
#endif /* __LIBAMI_GADGET_TEXTBOX_H__ */

349
libami/gadget_textinput.c Normal file
View File

@@ -0,0 +1,349 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <errno.h>
#ifdef USE_FONTSETS
#include <locale.h>
#include <wchar.h>
#endif
#include "drawinfo.h"
#include "gadget_textinput.h"
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
extern struct Library *XLibBase;
#endif
struct gadget_textinput *
gadget_textinput_create(Display *dpy, struct DrawInfo *dri,
GC gc, Window mainwin, int x, int y, int width, int height,
int textsize)
{
struct gadget_textinput *b;
b = calloc(1, sizeof(*b));
if (b == NULL)
return (NULL);
b->dpy = dpy;
b->dri = dri;
b->gc = gc;
b->x = x;
b->y = y;
b->width = width;
b->height = height;
b->buf = calloc(textsize + 1, sizeof(char));
if (b->buf == NULL) {
free(b);
return (NULL);
}
b->cur_x = 6;
b->size = textsize;
b->w = XCreateSimpleWindow(dpy, mainwin, x, y,
width, height, 0,
b->dri->dri_Pens[SHADOWPEN],
b->dri->dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, b->w, ExposureMask|ButtonPressMask);
return (b);
}
#ifdef USE_FONTSETS
void
gadget_textinput_set_xic(struct gadget_textinput *g, XIC xic)
{
g->xic = xic;
}
#endif
static void
gadget_textinput_repaint_str(struct gadget_textinput *b)
{
int l, mx=6;
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[TEXTPEN]);
if(b->len > b->left_pos) {
#ifdef USE_FONTSETS
int w, c;
for (l=0; l<b->len - b->left_pos; ) {
c=mbrlen(b->buf+b->left_pos+l, b->len-b->left_pos-l, NULL);
w=6+XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos, l+c);
if(w>b->width-6)
break;
mx=w;
l+=c;
}
XmbDrawImageString(b->dpy, b->w, b->dri->dri_FontSet, b->gc,
6, 3+b->dri->dri_Ascent,
b->buf+b->left_pos, l);
#else
mx+=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos, l=b->len-b->left_pos);
while(mx>b->width-6)
mx-=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos + --l, 1);
XDrawImageString(b->dpy, b->w, b->gc, 6, 3+b->dri->dri_Ascent,
b->buf+b->left_pos, l);
#endif
}
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
XFillRectangle(b->dpy, b->w, b->gc, mx, 3, b->width-mx-6, b->width - 6);
if(b->selected) {
if(b->cur_pos<b->len) {
XSetBackground(b->dpy, b->gc, ~0);
#ifdef USE_FONTSETS
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
XmbDrawImageString(b->dpy, b->w, b->dri->dri_FontSet, b->gc, b->cur_x,
3+b->dri->dri_Ascent, b->buf+b->cur_pos, l);
#else
XDrawImageString(b->dpy, b->w, b->gc, cur_x, 3+b->dri->dri_Ascent,
b->buf+b->cur_pos, 1);
#endif
XSetBackground(b->dpy, b->gc, b->dri->dri_Pens[BACKGROUNDPEN]);
} else {
XSetForeground(b->dpy, b->gc, ~0);
#ifdef USE_FONTSETS
XFillRectangle(b->dpy, b->w, b->gc, b->cur_x, 3,
XExtentsOfFontSet(b->dri->dri_FontSet)->
max_logical_extent.width, b->height - 6);
#else
XFillRectangle(b->dpy, b->w, b->gc, cur_x, 3,
b->dri->dri_Font->max_bounds.width, b->height - 6);
#endif
}
}
}
void
gadget_textinput_repaint(struct gadget_textinput *b)
{
gadget_textinput_repaint_str(b);
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[SHINEPEN]);
XDrawLine(b->dpy, b->w, b->gc, 0, b->height-1, 0, 0);
XDrawLine(b->dpy, b->w, b->gc, 0, 0, b->width-2, 0);
XDrawLine(b->dpy, b->w, b->gc, 3, b->height-2, b->width-4,
b->height-2);
XDrawLine(b->dpy, b->w, b->gc, b->width-4, b->height-2, b->width-4, 2);
XDrawLine(b->dpy, b->w, b->gc, 1, 1, 1, b->height-2);
XDrawLine(b->dpy, b->w, b->gc, b->width-3, 1, b->width-3, b->height-2);
XSetForeground(b->dpy, b->gc, b->dri->dri_Pens[SHADOWPEN]);
XDrawLine(b->dpy, b->w, b->gc, 1, b->height-1, b->width-1,
b->height-1);
XDrawLine(b->dpy, b->w, b->gc, b->width-1, b->height-1, b->width-1, 0);
XDrawLine(b->dpy, b->w, b->gc, 3, b->height-3, 3, 1);
XDrawLine(b->dpy, b->w, b->gc, 3, 1, b->width-4, 1);
XDrawLine(b->dpy, b->w, b->gc, 2, 1, 2, b->height-2);
XDrawLine(b->dpy, b->w, b->gc, b->width-2, 1, b->width-2, b->height-2);
}
void
gadget_textinput_free(struct gadget_textinput *b)
{
if (b->buf)
free(b->buf);
XDestroyWindow(b->dpy, b->w);
free(b);
}
void
gadget_textinput_keyevent(struct gadget_textinput *b, XKeyEvent *e)
{
#ifdef USE_FONTSETS
Status stat;
#else
static XComposeStatus stat;
#endif
KeySym ks;
char buf[256];
int x, i, n;
#ifndef USE_FONTSETS
n=XLookupString(e, buf, sizeof(buf), &ks, &stat);
#else
n=XmbLookupString(b->xic, e, buf, sizeof(buf), &ks, &stat);
if(stat == XLookupKeySym || stat == XLookupBoth)
#endif
switch(ks) {
case XK_Return:
case XK_Linefeed:
b->crlf = 1;
break;
case XK_Left:
if(b->cur_pos) {
#ifdef USE_FONTSETS
int p=b->cur_pos;
// int z;
while(p>0) {
--p;
if(((int)mbrlen(b->buf+p, b->cur_pos-p, NULL))>0) {
b->cur_pos=p;
break;
}
}
#else
--cur_pos;
#endif
}
break;
case XK_Right:
if(b->cur_pos<b->len) {
#ifdef USE_FONTSETS
int l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
if(l>0)
b->cur_pos+=l;
#else
b->cur_pos++;
#endif
}
break;
case XK_Begin:
b->cur_pos=0;
break;
case XK_End:
b->cur_pos=b->len;
break;
case XK_Delete:
if(b->cur_pos<b->len) {
int l=1;
#ifdef USE_FONTSETS
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
if(l<=0)
break;
#endif
b->len-=l;
for(x=b->cur_pos; x<b->len; x++)
b->buf[x]=b->buf[x+l];
b->buf[x] = 0;
} else XBell(b->dpy, 100);
break;
case XK_BackSpace:
if(b->cur_pos>0) {
int l=1;
#ifdef USE_FONTSETS
int p=b->cur_pos;
while(p>0) {
--p;
if(((int)mbrlen(b->buf+p, b->len-p, NULL))>0) {
l= b->cur_pos - p;
break;
}
}
#endif
b->len -= l;
for(x=(b->cur_pos-=l); x<b->len; x++)
b->buf[x]=b->buf[x+l];
b->buf[x] = 0;
} else XBell(b->dpy, 100);
break;
#ifdef USE_FONTSETS
default:
if(stat == XLookupBoth)
stat = XLookupChars;
}
if(stat == XLookupChars) {
#else
default:
#endif
for(i=0; i<n && b->len<b->size-1; i++) {
for(x=b->len; x>b->cur_pos; --x)
b->buf[x]=b->buf[x-1];
b->buf[b->cur_pos++]=buf[i];
b->len++;
}
if(i<n)
XBell(b->dpy, 100);
}
if(b->cur_pos<b->left_pos)
b->left_pos=b->cur_pos;
b->cur_x=6;
#ifdef USE_FONTSETS
if(b->cur_pos>b->left_pos)
b->cur_x+=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos,
b->cur_pos-b->left_pos);
if(b->cur_pos < b->len) {
int l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
x=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->cur_pos, l);
} else
x=XExtentsOfFontSet(b->dri->dri_FontSet)->max_logical_extent.width;
#else
if(b->cur_pos > b->left_pos)
b->cur_x+=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos, b->cur_pos-b->left_pos);
if(b->cur_pos<b->buf_len)
x=XTextWidth(b->dri->dri_Font, b->buf+b->cur_pos, 1);
else
x=b->dri->dri_Font->max_bounds.width;
#endif
if((x+=b->cur_x-(b->width-6))>0) {
b->cur_x-=x;
while(x>0) {
#ifdef USE_FONTSETS
int l=mbrlen(b->buf+b->left_pos, b->len-b->left_pos, NULL);
x-=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->left_pos, l);
b->left_pos += l;
#else
x-=XTextWidth(b->dri->dri_Font, b->buf+b->left_pos++, 1);
#endif
}
b->cur_x+=x;
}
}
void
gadget_textinput_buttonevent(struct gadget_textinput *b, XButtonEvent *e)
{
int w, l=1;
b->cur_pos=b->left_pos;
b->cur_x=6;
while(b->cur_x<e->x && b->cur_pos<b->len) {
#ifdef USE_FONTSETS
l=mbrlen(b->buf+b->cur_pos, b->len-b->cur_pos, NULL);
if(l<=0)
break;
w=XmbTextEscapement(b->dri->dri_FontSet, b->buf+b->cur_pos, l);
#else
w=XTextWidth(b->dri->dri_Font, b->buf+b->cur_pos, 1);
#endif
if(b->cur_x+w>e->x)
break;
b->cur_x+=w;
b->cur_pos+=l;
}
}
#if 0
void strbutton(XButtonEvent *e)
{
refresh_str();
}
#endif
void
gadget_textinput_selected(struct gadget_textinput *b, int selected)
{
b->selected = selected;
}
int
gadget_textinput_crlf(struct gadget_textinput *b)
{
return (b->crlf);
}

46
libami/gadget_textinput.h Normal file
View File

@@ -0,0 +1,46 @@
#ifndef __LIBAMI__GADGET_TEXTINPUT_H__
#define __LIBAMI__GADGET_TEXTINPUT_H__
struct gadget_textinput {
Display *dpy;
struct DrawInfo *dri;
Window w;
GC gc;
#ifdef USE_FONTSETS
XIC xic;
#endif
int x;
int y;
int width;
int height;
/* XXX TODO: create a string representation here already */
char *buf;
int len;
int size;
/* Position of textbox cursor and rendering start */
int cur_pos;
int left_pos;
int cur_x;
int selected;
int crlf;
};
extern struct gadget_textinput * gadget_textinput_create(Display *dpy,
struct DrawInfo *dri, GC gc, Window mainwin,
int x, int y, int width, int height, int text_size);
#ifdef USE_FONTSETS
extern void gadget_textinput_set_xic(struct gadget_textinput *g, XIC xic);
#endif
extern void gadget_textinput_repaint(struct gadget_textinput *b);
extern void gadget_textinput_free(struct gadget_textinput *b);
extern void gadget_textinput_keyevent(struct gadget_textinput *b,
XKeyEvent *e);
extern void gadget_textinput_buttonevent(struct gadget_textinput *b,
XButtonEvent *e);
extern void gadget_textinput_selected(struct gadget_textinput *b, int selected);
extern int gadget_textinput_crlf(struct gadget_textinput *b);
#endif /* __LIBAMI__GADGET_TEXTINPUT_H__ */

View File

@@ -67,7 +67,7 @@ static void lookup_hotkey(struct hotkey *hk)
if((hk->keysym&~0x20)>=XK_A && (hk->keysym&~0x20)<=XK_Z)
hk->keycode=XKeysymToKeycode(dpy, hk->keysym^0x20);
if(hk->keycode && keymap)
if(hk->keycode && keymap) {
if(keymap[(hk->keycode-kbd_mincode)*kbd_maxsym])
;
else if(kbd_maxsym>1 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+1])
@@ -76,6 +76,7 @@ static void lookup_hotkey(struct hotkey *hk)
hk->modifiers|=switch_mask;
else if(kbd_maxsym>3 && keymap[(hk->keycode-kbd_mincode)*kbd_maxsym+3])
hk->modifiers|=ShiftMask|switch_mask;
}
}
static void rethink_keymap()

View File

@@ -249,7 +249,7 @@ static LONG unpack_rle(unsigned char *src, LONG srclen, char *dst, LONG dstlen,
}
}
if(src != srcn)
fprintf(stderr, "Warning: Left %d bytes unused.\n", srcn-src);
fprintf(stderr, "Warning: Left %d bytes unused.\n", (int) (srcn-src));
return dst-dst0;
}
@@ -505,12 +505,13 @@ struct DiskObject *GetDefDiskObject(LONG def_type)
if(def_type<WBDISK || def_type>WBAPPICON)
return NULL;
if(!icondir)
if(!(icondir = get_current_icondir()))
if(!icondir) {
if(!(icondir = get_current_icondir())) {
return NULL;
else
} else {
l = strlen(icondir);
}
}
#ifdef HAVE_ALLOCA
buf = alloca(l+18);
#else

Binary file not shown.

View File

@@ -368,6 +368,9 @@ extern int md_front(Window);
extern int md_back(Window);
extern int md_iconify(Window);
extern int md_errormsg(Window, char *);
extern int md_rotate_window_raise(Window);
extern int md_rotate_window_lower(Window);
extern int md_rotate_window_desktop(Window);
/* eventdispatcher.c */
extern void cx_event_broker(int, unsigned long, int (*)(XEvent*));
@@ -387,6 +390,9 @@ extern Pixmap md_image_to_pixmap(Window, unsigned long, struct Image *,
int, int, struct ColorStore *);
extern char *get_current_icondir(void);
/* mdbattery.c */
extern void md_update_battery(int pct, int time, int ac);
/* mdwindow.c */
extern int md_set_appwindow(Window);

View File

@@ -2,6 +2,8 @@
#ifndef AMIGAOS
#include <string.h>
void NewList(struct List *list)
{
list->lh_TailPred = (struct Node *)&list->lh_Head;

85
libami/mdbattery.c Normal file
View File

@@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include "libami.h"
#include "module.h"
#include "alloc.h"
void
md_update_battery(int pct, int time, int ac)
{
struct mcmd_update_battery batt = { 0 };
int res;
batt.battery_time = time;
batt.battery_pct = pct;
batt.battery_ac = ac;
res = md_command0(None, MCMD_UPDATE_BATTERY, &batt, sizeof(batt));
(void) res;
}
Window md_create_appicon(Window p, int x, int y, char *name,
Pixmap pm1, Pixmap pm2, Pixmap pmm)
{
char *data;
Window w;
int res, l=strlen(name);
#ifdef HAVE_ALLOCA
struct NewAppIcon *nai=alloca(sizeof(struct NewAppIcon)+l);
#else
struct NewAppIcon *nai=malloc(sizeof(struct NewAppIcon)+l);
if(nai==NULL) return None;
#endif
nai->x=x; nai->y=y;
nai->pm1=pm1; nai->pm2=pm2; nai->pmm=pmm;
strcpy(nai->name, name);
res=md_command(p, MCMD_CREATEAPPICON, nai, sizeof(struct NewAppIcon)+l,
&data);
if(res<sizeof(w)) {
if(data) free(data);
#ifndef HAVE_ALLOCA
free(nai);
#endif
return None;
}
memcpy(&w, data, sizeof(w));
free(data);
#ifndef HAVE_ALLOCA
free(nai);
#endif
return w;
}
Pixmap md_image_to_pixmap(Window w, unsigned long bgcolor, struct Image *i,
int width, int height, struct ColorStore *cs)
{
Display *dpy = md_display();
static GC gc = None;
Pixmap pm;
static int iconcolormask;
static unsigned long *iconcolor = NULL;
if(gc == None && w != None)
gc = XCreateGC(dpy, w, 0, NULL);
if(iconcolor == NULL) {
char *p;
int res = md_command(w, MCMD_GETICONPALETTE, NULL, 0, &p);
if(res<0)
return None;
iconcolor = (unsigned long *)(void *)p;
iconcolormask = (res/sizeof(unsigned long))-1;
}
pm = image_to_pixmap(md_display(), w, gc, bgcolor, iconcolor, iconcolormask,
i, width, height, cs);
return pm;
}
char *get_current_icondir()
{
char *p;
if(md_command(None, MCMD_GETICONDIR, NULL, 0, &p)>=0 && p)
return p;
if(p) free(p);
return NULL;
}

View File

@@ -22,6 +22,21 @@ int md_iconify(XID id)
return md_command00(id, MCMD_ICONIFY);
}
int md_rotate_window_raise(XID id)
{
return md_command00(id, MCMD_ROTATE_WINDOW_RAISE);
}
int md_rotate_window_lower(XID id)
{
return md_command00(id, MCMD_ROTATE_WINDOW_LOWER);
}
int md_rotate_window_desktop(XID id)
{
return md_command00(id, MCMD_WINDOW_MOVE_NEXT_DESKTOP);
}
int md_errormsg(Window id, char *str)
{
return md_command0(id, MCMD_ERRORMSG, str, strlen(str));

View File

@@ -8,6 +8,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/select.h>
#include "libami.h"
#include "module.h"
@@ -24,6 +25,7 @@ Window md_root = None;
static int md_int_len=0;
static char *md_int_buf=NULL;
void (*md_broker_func)(XEvent *, unsigned long);
void (*md_periodic_func)(void);
void md_exit(int signal)
{
@@ -39,11 +41,12 @@ static int md_write(void *ptr, int len)
char *p=ptr;
int r, tot=0;
while(len>0) {
if((r=write(md_out_fd, p, len))<0)
if((r=write(md_out_fd, p, len))<0) {
if(errno==EINTR)
continue;
continue;
else
return r;
return r;
}
if(!r)
return tot;
tot+=r;
@@ -53,37 +56,138 @@ static int md_write(void *ptr, int len)
return tot;
}
static int md_read(void *ptr, int len)
/*
* Wait until the read FD is ready, or timeout (5 seconds.)
*
* Returns:
* + 1 if OK
* + 0 if timeout
* < 0 if error
*/
static int
md_wait_read_fd(void)
{
fd_set readfds;
struct timeval tv;
int ret;
FD_ZERO(&readfds);
FD_SET(md_in_fd, &readfds);
tv.tv_sec = 5;
tv.tv_usec = 0;
ret = select(md_in_fd + 1, &readfds, NULL, NULL, &tv);
if (ret == 0) {
return (0);
}
if (ret < 0) {
/*
* Note: this happens during things like system suspend/resume
* on FreeBSD.
*/
if (errno == EINTR) {
return (0);
}
return (-1);
}
if (FD_ISSET(md_in_fd, &readfds)) {
return (1);
}
/* FD wasn't set; just return 0 */
return (0);
}
/*
* Read from the input file descriptor until len; ,populate
* our buffer.
*
* Return total read, 0 on timeout, else -1 on error.
*/
static int md_read(void *ptr, int len, int block)
{
char *p=ptr;
int r, tot=0;
while(len>0) {
if((r=read(md_in_fd, p, len))<0)
if(errno==EINTR)
continue;
else
return r;
if(!r)
if(tot)
return tot;
else
md_exit(0);
while (len > 0) {
/* Wait until the socket is ready, or timeout */
r = md_wait_read_fd();
if (r < 0) {
return (-1);
}
/*
* Note: If we've read /anything/, then we just keep
* going until we're done. Otherwise we'll exit
* out here with a partial read and things will
* go sideways.
*
* If we're not blocking and select timed out,
* return timeout.
*/
if ((tot == 0) && (block == 0) && (r == 0)) {
return (0);
}
/*
* Try to read some data. Go back around again
* if we hit EINTR/EWOULDBLOCK.
*
* If we hit EOF then that's an error.
*/
r = read(md_in_fd, p, len);
/* Error */
if (r < 0) {
if ((errno == EINTR) || (errno == EWOULDBLOCK)) {
continue;
} else {
return (-1);
}
}
/*
* EOF and didn't read anything? md_exit() like
* the old code did.
*/
if ((r == 0) && (tot == 0)) {
md_exit(0);
}
/*
* EOF, but we read data, so at least return what
* we did read.
*/
if (r == 0) {
return (tot);
}
/* r > 0 here */
tot+=r;
p+=r;
len-=r;
}
return tot;
return (tot);
}
/*
* Read in "len" bytes from the window manager command path
* into md_int_buf.
*/
static int md_int_load(int len)
{
if(len>=md_int_len)
if(len>=md_int_len) {
if(md_int_buf!=NULL)
md_int_buf=realloc(md_int_buf, md_int_len=len+1);
else
md_int_buf=malloc(md_int_len=len+1);
}
md_int_buf[len]='\0';
return md_read(md_int_buf, len);
return md_read(md_int_buf, len, 1);
}
static struct md_queued_event {
@@ -91,6 +195,13 @@ static struct md_queued_event {
struct mcmd_event e;
} *event_head=NULL, *event_tail=NULL;
/*
* Process queued XEvents from the window manager.
*
* The window manager pushes subscribed XEvents down to
* modules and this pulls them out of the queue and
* calls md_broker_func() on each of them.
*/
void md_process_queued_events()
{
struct md_queued_event *e;
@@ -102,6 +213,12 @@ void md_process_queued_events()
}
}
/*
* Enqueue an mcmd event into the event queue.
*
* This is called when there's an XEvent being queued
* from the window manager to the module.
*/
static void md_enqueue(struct mcmd_event *e)
{
struct md_queued_event *qe=malloc(sizeof(struct md_queued_event));
@@ -117,6 +234,13 @@ static void md_enqueue(struct mcmd_event *e)
}
}
/*
* Read an async XEvent from the window manager.
*
* This is called by md_handle_input() to read an XEvent.
* The "I'm an Xevent" marker is ~len, so it's de-inverted
* and then a subsequent len field match must match it.
*/
static int md_get_async(int len)
{
if(md_int_load(len)!=len)
@@ -126,18 +250,47 @@ static int md_get_async(int len)
return 1;
}
int md_handle_input()
/*
* Read input from the window manager.
*
* This reads two chunks - the size of the request,
* and then the request itself.
*
* Negative request lengths are treated special - they're
* treated as XEvents thrown into the input stream.
*
* Returns >1 if got input, 0 if timed out, < 0 if error.
*/
int md_handle_input(void)
{
int res;
int res, ret;
/* Read the length of the request, don't block. */
ret = md_read(&res, sizeof(res), 0);
/* Timeout? */
if (ret == 0) {
return (0);
}
/* Error? */
if (ret < 0) {
return (-1);
}
/* Read size doesn't match request size? */
if (ret != sizeof(res)) {
return (-1);
}
if(md_read(&res, sizeof(res))!=sizeof(res))
return -1;
if(res>=0) {
if(!res)
return 0;
/* Read the command */
md_int_load(res);
return 0;
} else {
/* Negative length; treat as an XEvent */
res=~res;
if(!res)
return 0;
@@ -145,6 +298,16 @@ int md_handle_input()
}
}
/*
* Send a command from the module back to the window manager.
*
* This sends a request up to the window manager and then reads the
* response to return. If asynchronous XEvents occur in the reply
* stream then those are enqueued via md_get_async().
*
* If there is a response, buffer is set to a memory buffer containing it.
* It is thus up to the caller to free it.
*/
int md_command(XID id, int cmd, void *data, int data_len, char **buffer)
{
int res;
@@ -156,21 +319,38 @@ int md_command(XID id, int cmd, void *data, int data_len, char **buffer)
mcmd.cmd = cmd;
mcmd.len = data_len;
/*
* Send header, read response code.
*/
if(md_write(&mcmd, sizeof(mcmd))!=sizeof(mcmd) ||
md_write(data, data_len)!=data_len ||
md_read(&res, sizeof(res))!=sizeof(res))
md_read(&res, sizeof(res), 1)!=sizeof(res))
return -1;
/*
* If the response code is negative (well, less than -1)
* then its treated as an async XEvent. So, queue that
* and keep reading for the response code.
*/
while(res<-1) {
md_get_async(~res);
if(md_read(&res, sizeof(res))!=sizeof(res))
if(md_read(&res, sizeof(res), 1)!=sizeof(res))
return -1;
}
/*
* If the response code is >0, then allocate a buffer
* of a suitable size and read the response into the buffer.
*/
if(res>0) {
*buffer=malloc(res);
if(md_read(*buffer, res)!=res)
if(md_read(*buffer, res, 1)!=res)
return -1;
}
/*
* Return the response size.
*/
return res;
}
@@ -201,6 +381,23 @@ Display *md_display()
return dpy;
}
/*
* make the fd blocking or non-blocking.
*/
static int
md_fd_nonblocking(int fd, int nb)
{
int ret, val;
val = fcntl(fd, F_GETFD);
if (nb) {
ret = fcntl(fd, F_SETFD, val | O_NONBLOCK);
} else {
ret = fcntl(fd, F_SETFD, val & ~O_NONBLOCK);
}
return (ret == 0);
}
char *md_init(int argc, char *argv[])
{
if(argc>0)
@@ -222,12 +419,24 @@ char *md_init(int argc, char *argv[])
if(md_command(None, MCMD_GET_VERSION, NULL, 0, &amiwm_version)<=0)
md_fail();
md_fd_nonblocking(md_in_fd, 1);
return (argc>4? argv[4]:NULL);
}
void md_main_loop()
void
md_main_loop()
{
do md_process_queued_events(); while(md_handle_input()>=0);
do {
if (md_periodic_func != NULL) {
md_periodic_func();
}
/* Process async XEvent events that have been read */
md_process_queued_events();
/* Loop over, reading input events */
} while(md_handle_input()>=0);
}
int md_connection_number()

View File

@@ -229,11 +229,12 @@ LONG FindArg(STRPTR template, STRPTR keyword)
ch=*template++;
if(!ch)
return (kwindex == kwlen? argindex : -1);
if(ch == ',' || ch == '=' || ch == '/')
if(ch == ',' || ch == '=' || ch == '/') {
if(kwindex == kwlen)
return argindex;
else
break;
}
} while(ToUpper(ch) == ToUpper(keyword[kwindex++]));
while(ch != '=') {
@@ -353,7 +354,7 @@ struct RDArgs * ReadArgs(STRPTR template, LONG *array, struct RDArgs *rdargs)
while(numargs-->0) {
int isnumeric=0;
if((*swptr)&RA_MULTI)
if((*swptr)&RA_MULTI) {
if(multinum) {
((Argtype *)array)->ptr=ra_alloc(rdargs,
sizeof(Argtype)*(multinum+1));
@@ -365,6 +366,7 @@ struct RDArgs * ReadArgs(STRPTR template, LONG *array, struct RDArgs *rdargs)
isnumeric=((*swptr)&RA_NUMERIC)!=0;
}
else ((Argtype *)array)->ptr=NULL;
}
array=(LONG*)(((Argtype *)array)+1);
if(!((sw=*swptr++)&RA_FOUND) && (sw&RA_ALWAYS)) {
if((!lastmarg) || (sw&RA_KEYWORD) || multinum<2 ||

1184
main.c

File diff suppressed because it is too large Load Diff

178
menu.c
View File

@@ -19,7 +19,8 @@
" " LF "version "VERSION LF "by Marcus Comstedt" LF \
"<marcus@lysator.liu.se>" LF " " LF \
"Contributions by Scott Lawrence" LF "<amiwm10@umlautllama.com>" LF \
"and Nicolas Sipieter " LF "<freeeaks@gmail.com>" LF " " LF
"and Nicolas Sipieter " LF "<freeeaks@gmail.com>" LF " " LF \
"Some small contributions by redsPL" LF "<reds@sakamoto.pl>" LF " " LF
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>
@@ -36,6 +37,8 @@ extern struct Library *XLibBase;
#define CHECKED 2
#define DISABLED 4
char battery_status[128];
extern Display *dpy;
extern Cursor wm_curs;
extern XContext screen_context, client_context;
@@ -45,6 +48,7 @@ extern void select_all_icons(Scrn *i);
extern void mod_menuselect(struct module *, int, int, int);
extern void setfocus(Window);
extern void flushmodules();
extern void wberror(Scrn *, char *);
Scrn *mbdclick=NULL, *mbdscr=NULL;
@@ -301,7 +305,7 @@ void redraw_item(struct Item *i, Window w)
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
}
if(i->text)
if(i->text) {
#ifdef USE_FONTSETS
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
@@ -310,23 +314,24 @@ void redraw_item(struct Item *i, Window w)
XDrawImageString(dpy, w, scr->menubargc, (i->flags&CHECKIT)?1+scr->checkmarkspace:1,
scr->dri.dri_Ascent+1, i->text, i->textlen);
#endif
else
} else {
XFillRectangle(dpy, w, scr->menubargc, 2, 2, m->width-10, 2);
}
if(i->sub) {
int x=m->width-6-scr->hotkeyspace-1+8;
#ifdef USE_FONTSETS
#ifdef HAVE_XUTF8DRAWIMAGESTRING
Xutf8DrawImageString(dpy, w, scr->dri.dri_FontSet,
scr->menubargc, x+scr->dri.dri_Ascent+1,
1+scr->dri.dri_Ascent, "\302\273", 2);
1+scr->dri.dri_Ascent, "»", 2);
#else
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet,
scr->menubargc, x+scr->dri.dri_Ascent+1,
1+scr->dri.dri_Ascent, "»", 1);
1+scr->dri.dri_Ascent, "\xBB", 1);
#endif
#else
XDrawImageString(dpy, w, scr->menubargc, x+scr->dri.dri_Ascent+1,
1+scr->dri.dri_Ascent, "»", 1);
1+scr->dri.dri_Ascent, "\xBB", 1);
#endif
} else if(i->hotkey) {
int x=m->width-6-scr->hotkeyspace-1+8;
@@ -360,29 +365,46 @@ void redraw_item(struct Item *i, Window w)
void createmenubar()
{
XSetWindowAttributes attr;
struct Menu *m, *sm1, *sm2, *sm3;
struct Menu *m, *sm1;
// struct Menu *sm2, *sm3;
struct ToolItem *ti;
GC gc;
scr->firstmenu = NULL;
attr.override_redirect=True;
attr.background_pixel=scr->dri.dri_Pens[BARBLOCKPEN];
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0,
CopyFromParent,
InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel,
&attr);
if (scr->deftitle) {
attr.background_pixel=scr->dri.dri_Pens[BARBLOCKPEN];
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0,
CopyFromParent,
InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel,
&attr);
scr->menubarparent=XCreateWindow(dpy, scr->menubar, 0, 0, scr->width,
scr->bh-1, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel, &attr);
attr.background_pixel=scr->dri.dri_Pens[BACKGROUNDPEN];
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
0, 23, scr->bh, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel, &attr);
} else {
scr->menubar=XCreateWindow(dpy, scr->back, 0, 0, scr->width, scr->bh, 0, 0,
InputOnly, CopyFromParent,
CWOverrideRedirect, &attr);
scr->menubarparent=None;
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
0, 23, scr->bh, 0, 0,
InputOnly, CopyFromParent,
CWOverrideRedirect, &attr);
}
XSaveContext(dpy, scr->menubar, screen_context, (XPointer)scr);
scr->menubarparent=XCreateWindow(dpy, scr->menubar, 0, 0, scr->width,
scr->bh-1, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel, &attr);
XSaveContext(dpy, scr->menubarparent, screen_context, (XPointer)scr);
attr.background_pixel=scr->dri.dri_Pens[BACKGROUNDPEN];
scr->menubardepth=XCreateWindow(dpy, scr->menubar, scr->width-23,
0, 23, scr->bh, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect|CWBackPixel, &attr);
if (scr->menubarparent)
XSaveContext(dpy, scr->menubarparent, screen_context, (XPointer)scr);
XSaveContext(dpy, scr->menubardepth, screen_context, (XPointer)scr);
scr->disabled_stipple=XCreatePixmap(dpy, scr->back, 6, 2, 1);
gc=XCreateGC(dpy, scr->disabled_stipple, 0, NULL);
@@ -392,11 +414,16 @@ void createmenubar()
XDrawPoint(dpy, scr->disabled_stipple, gc, 0, 0);
XDrawPoint(dpy, scr->disabled_stipple, gc, 3, 1);
XFreeGC(dpy, gc);
scr->menubargc=XCreateGC(dpy, scr->menubar, 0, NULL);
if (scr->deftitle) {
scr->menubargc=XCreateGC(dpy, scr->menubar, 0, NULL);
#ifndef USE_FONTSETS
XSetFont(dpy, scr->menubargc, scr->dri.dri_Font->fid);
XSetFont(dpy, scr->menubargc, scr->dri.dri_Font->fid);
#endif
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
} else {
scr->menubargc = NULL;
}
XSelectInput(dpy, scr->menubar, ExposureMask|ButtonPressMask|ButtonReleaseMask);
XSelectInput(dpy, scr->menubardepth, ExposureMask|ButtonPressMask|
ButtonReleaseMask|EnterWindowMask|LeaveWindowMask);
@@ -407,16 +434,22 @@ void createmenubar()
scr->checkmarkspace=4+scr->dri.dri_Ascent;
scr->subspace=scr->hotkeyspace-scr->dri.dri_Ascent;
scr->menuleft=4;
if (!scr->menubarparent)
return;
m=add_menu("Workbench", 0);
add_item(m,"Backdrop",'B',CHECKIT|CHECKED|DISABLED);
//add_item(m,"Backdrop",'B',CHECKIT|CHECKED|DISABLED);
add_item(m,"Execute Command...",'E',0);
add_item(m,"Configuration",'C',0);
add_item(m,"Redraw All",0,0);
add_item(m,"Update All",0,DISABLED);
add_item(m,"Last Message",0,DISABLED);
//add_item(m,"Update All",0,DISABLED);
//add_item(m,"Last Message",0,DISABLED);
add_item(m,NULL,0,DISABLED);
add_item(m,"About...",'?',0);
add_item(m,"Quit...",'Q',0);
menu_layout(m);
m=add_menu("Window", 0);
/*m=add_menu("Window", 0);
add_item(m,"New Drawer",'N',DISABLED);
add_item(m,"Open Parent",0,DISABLED);
add_item(m,"Close",'K',DISABLED);
@@ -437,8 +470,8 @@ void createmenubar()
menu_layout(m);
menu_layout(sm1);
menu_layout(sm2);
menu_layout(sm3);
m=add_menu("Icons", DISABLED);
menu_layout(sm3);*/
/*m=add_menu("Icons", DISABLED);
add_item(m,"Open",'O',DISABLED);
add_item(m,"Copy",'C',DISABLED);
add_item(m,"Rename...",'R',DISABLED);
@@ -451,7 +484,7 @@ void createmenubar()
add_item(m,"Delete...",'D',DISABLED);
add_item(m,"Format Disk...",0,DISABLED);
add_item(m,"Empty Trash",0,DISABLED);
menu_layout(m);
menu_layout(m);*/
m=add_menu("Tools", 0);
#ifdef AMIGAOS
add_item(m,"ResetWB",0,DISABLED);
@@ -480,16 +513,24 @@ void createmenubar()
}
}
void redrawmenubar(Window w)
/*
* Redraw the menu bar and its components.
*
* This takes in the target window, which may be the basic menubar,
* a clicked-on menu, or the depth widget.
*/
void redrawmenubar(Scrn *scr, Window w)
{
static const char defaultTimeFormat[] = "%c";
int widget_rhs;
struct Menu *m;
struct Item *item;
if(!w)
if(!w || !scr->menubargc)
return;
if(w==scr->menubar) {
/* Menubar itself */
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARDETAILPEN]);
XSetBackground(dpy, scr->menubargc, scr->dri.dri_Pens[BARBLOCKPEN]);
#ifdef USE_FONTSETS
@@ -502,6 +543,13 @@ void redrawmenubar(Window w)
#endif
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[BARTRIMPEN]);
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, scr->width-1, scr->bh-1);
/* Widgets start here and move to the left */
widget_rhs = (scr->width - 30);
/*
* Update the title bar clock if it's enabled.
*/
if( prefs.titlebarclock )
{
char clockbuf[512];
@@ -514,15 +562,38 @@ void redrawmenubar(Window w)
#ifdef USE_FONTSETS
l = XmbTextEscapement(scr->dri.dri_FontSet, clockbuf, strlen(clockbuf));
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet, scr->menubargc,
(scr->width-30-l), 1+scr->dri.dri_Ascent,
widget_rhs - l, 1+scr->dri.dri_Ascent,
clockbuf, strlen(clockbuf));
#else
l = XTextWidth(scr->dri.dri_Font, clockbuf, strlen(clockbuf));
XDrawImageString( dpy, w, scr->menubargc,(scr->width-30-l),
XDrawImageString( dpy, w, scr->menubargc, widget_rhs - l,
1+scr->dri.dri_Ascent, clockbuf, strlen(clockbuf));
#endif
}
widget_rhs = widget_rhs - l - 8; // 8 = padding
}
/*
* Update the battery indicator if it's enabled.
*/
if (prefs.battery_info) {
char battery_buf[512];
int l;
sprintf(battery_buf, "| %s |", battery_status);
#ifdef USE_FONTSETS
l = XmbTextEscapement(scr->dri.dri_FontSet, battery_buf, strlen(battery_buf));
XmbDrawImageString(dpy, w, scr->dri.dri_FontSet, scr->menubargc,
widget_rhs - l, 1+scr->dri.dri_Ascent,
battery_buf, strlen(battery_buf));
#else
l = XTextWidth(scr->dri.dri_Font, battery_buf, strlen(battery_buf));
XDrawImageString( dpy, w, scr->menubargc, widget_rhs - l,
1+scr->dri.dri_Ascent, battery_buf, strlen(battery_buf));
#endif
widget_rhs = widget_rhs - l - 8; // 8 = padding
}
} else if(w==scr->menubardepth) {
/* Menubar depth widget */
if(!mbdclick) {
XSetForeground(dpy, scr->menubargc, scr->dri.dri_Pens[SHADOWPEN]);
XDrawRectangle(dpy, w, scr->menubargc, 4, scr->h2, 10, scr->h6-scr->h2);
@@ -540,6 +611,7 @@ void redrawmenubar(Window w)
XDrawLine(dpy, w, scr->menubargc, 0, scr->bh-1, 22, scr->bh-1);
XDrawLine(dpy, w, scr->menubargc, 22, 0, 22, scr->bh-1);
} else {
/* One of the menus is being displayed */
for(m=scr->firstmenu; m; m=m->next)
if(m->win==w)
redraw_menu(m, w);
@@ -572,11 +644,13 @@ static void leave_item(struct Item *i, Window w)
{
if(i==activesubitem)
activesubitem=NULL;
if(i==activeitem)
if(activesubmenu && i->sub==activesubmenu)
if(i==activeitem) {
if(activesubmenu && i->sub==activesubmenu) {
return;
else
} else {
activeitem=NULL;
}
}
XSetWindowBackground(dpy, i->win, scr->dri.dri_Pens[BARBLOCKPEN]);
XClearWindow(dpy, i->win);
redraw_item(i, i->win);
@@ -711,9 +785,11 @@ void menuaction(struct Item *i, struct Item *si)
switch(menu) {
case 0: /* Workbench */
switch(item) {
case 1:
case 0:
spawn(BIN_PREFIX"executecmd");
break;
case 1:
spawn(BIN_PREFIX"config_util");
case 2:
{
XSetWindowAttributes xswa;
@@ -731,7 +807,7 @@ void menuaction(struct Item *i, struct Item *si)
XDestroyWindow(dpy, win);
}
break;
case 5:
case 4:
#ifdef AMIGAOS
spawn(BIN_PREFIX"requestchoice >NIL: amiwm \""
ABOUT_STRING("*N") "\" Ok");
@@ -740,7 +816,7 @@ void menuaction(struct Item *i, struct Item *si)
ABOUT_STRING("\n") "' Ok");
#endif
break;
case 6:
case 5:
#ifndef AMIGAOS
if(prefs.fastquit) {
#endif
@@ -761,7 +837,7 @@ void menuaction(struct Item *i, struct Item *si)
break;
}
break;
case 1: /* Window */
/* case 1: // Window
switch(item) {
case 4:
select_all_icons(scr);
@@ -770,10 +846,10 @@ void menuaction(struct Item *i, struct Item *si)
cleanupicons();
break;
}
break;
case 2: /* Icons */
break;
case 3: /* Tools */
break; */
// case 2: /* Icons */
// break;
case 1: /* Tools */
#ifndef AMIGAOS
if(item==0)
restart_amiwm();
@@ -792,11 +868,11 @@ void menuaction(struct Item *i, struct Item *si)
if(ti && ti->cmd) spawn(ti->cmd);
}
break;
case 4: /* Screens */
case 2: /* Screens */
if(item==0) {
openscreen("New Screen", DefaultRootWindow(dpy));
realizescreens();
scr=front->upfront;
scr = get_front_scr()->upfront;
screentoback();
}
if(item==1) {

109
module.c
View File

@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
@@ -12,9 +13,6 @@
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
@@ -41,7 +39,6 @@ extern Display *dpy;
extern void add_fd_to_set(int);
extern void remove_fd_from_set(int);
extern void screentoback();
extern void raiselowerclient(Client *, int);
extern void wberror(Scrn *, char *);
@@ -110,7 +107,7 @@ void delete_keygrab(struct module *m, int id)
static void destroy_module(struct module *m)
{
Scrn *s=front;
Scrn *s = get_front_scr();
delete_keygrab(m, -1);
do {
Icon *i, *ni;
@@ -120,7 +117,7 @@ static void destroy_module(struct module *m)
rmicon(i);
}
s=s->behind;
} while(s!=front);
} while(s != get_front_scr());
disown_item_chain(m, m->menuitems);
if(m->in_fd>=0) { remove_fd_from_set(m->in_fd); close(m->in_fd); }
if(m->out_fd>=0) { close(m->out_fd); }
@@ -267,11 +264,13 @@ static int m_write(int fd, char *ptr, int len)
char *p=ptr;
int r, tot=0;
while(len>0) {
if((r=write(fd, p, len))<0)
if(errno==EINTR)
if((r=write(fd, p, len))<0) {
if(errno==EINTR) {
continue;
else
} else {
return r;
}
}
if(!r)
return tot;
tot+=r;
@@ -293,22 +292,23 @@ int dispatch_event_to_broker(XEvent *e, unsigned long mask, struct module *m)
{
Client *c;
Icon *i;
e->xany.display=(Display *)0;
/* XXX TODO: overloading display here seems .. dangerous? */
e->xany.display=(Display *)(uintptr_t) 0;
if(!XFindContext(dpy, e->xany.window, client_context, (XPointer *)&c))
if(e->xany.window==c->window)
e->xany.display=(Display *)1;
e->xany.display=(Display *)(uintptr_t) 1;
else
e->xany.display=(Display *)2;
e->xany.display=(Display *)(uintptr_t) 2;
else if(!XFindContext(dpy, e->xany.window, icon_context, (XPointer *)&i))
if(e->xany.window==i->window)
e->xany.display=(Display *)3;
e->xany.display=(Display *)(uintptr_t) 3;
while(m) {
if(m->out_fd>=0 && ((m->broker.mask & mask)||(m->broker.exists && !mask))) {
struct mcmd_event me;
me.mask=mask;
me.event=*e;
reply_module(m, (char *)&me, ~sizeof(me));
reply_module(m, (char *)&me, ~((int) sizeof(me)));
return 1;
}
m=m->next;
@@ -326,11 +326,14 @@ static void incoming_event(struct module *m, struct mcmd_event *me)
void mod_menuselect(struct module *m, int menu, int item, int subitem)
{
fprintf(stderr, "Nu valde någon minsann menyitem %d:%d:%d.\n"
"Man kanske skulle berätta detta för modul %d\n?",
fprintf(stderr, "No value assigned for menu item %d:%d:%d.\n"
"Read manual for module %d\n?",
menu, item, subitem, (int)m->pid);
}
extern void lowertopmostclient(Scrn *scr);
extern void raisebottommostclient(Scrn *scr);
static void handle_module_cmd(struct module *m, char *data, int data_len)
{
extern Scrn *getscreen(Window);
@@ -365,6 +368,20 @@ static void handle_module_cmd(struct module *m, char *data, int data_len)
screentoback();
reply_module(m, NULL, 0);
break;
case MCMD_ROTATE_WINDOW_RAISE:
/* Get the current screen */
scr = getscreen(id);
/* raise away! */
raisebottommostclient(scr);
reply_module(m, NULL, 0);
break;
case MCMD_ROTATE_WINDOW_LOWER:
/* Get the current screen */
scr = getscreen(id);
/* lower away! */
lowertopmostclient(scr);
reply_module(m, NULL, 0);
break;
case MCMD_ADD_KEYGRAB:
if(data_len>=sizeof(int[2])) {
int res=create_keygrab(m, ((int*)data)[0], ((int*)data)[1]);
@@ -469,6 +486,56 @@ static void handle_module_cmd(struct module *m, char *data, int data_len)
} else
reply_module(m, NULL, -1);
break;
case MCMD_UPDATE_BATTERY:
{
struct mcmd_update_battery *batt;
extern char battery_status[];
if (data == NULL) {
reply_module(m, NULL, -1);
break;
}
if (data_len != sizeof(struct mcmd_update_battery)) {
reply_module(m, NULL, -1);
break;
}
batt = (void *) data;
#if 0
fprintf(stderr, "%s: called, BATTERY, pct=%d, time=%d, ac=%d\n",
__func__,
batt->battery_pct,
batt->battery_time,
batt->battery_ac);
#endif
/*
* XXX TODO: for now we're just populating a string here.
* Later on we should just store the current battery state
* somewhere (a key/value table would be nice!) and then
* the widget code can pull out its needed state to render.
*/
snprintf(battery_status, 128, "%d pct%s", batt->battery_pct,
batt->battery_ac == 1 ? " A" : " -");
reply_module(m, NULL, 0);
break;
}
case MCMD_WINDOW_MOVE_NEXT_DESKTOP:
/* Move the current window, if any, to the next desktop */
c = NULL;
if(! XFindContext(dpy, id, client_context, (XPointer*)&c)) {
/* Get the current screen */
scr=getscreen(id);
/* Rotate screen, get the now front screen */
screentoback();
scr = get_front_scr();
/* Assign this client to next screen */
reparent_client(scr, c);
}
reply_module(m, NULL, 0);
break;
break;
default:
reply_module(m, NULL, -1);
}
@@ -506,7 +573,7 @@ static void module_input_callback(struct module *m)
int t=(r>m->in_left? m->in_left:r);
memcpy(m->in_ptr, p, t);
m->in_ptr+=t;
if(!(m->in_left-=t))
if(!(m->in_left-=t)) {
if(m->in_phase || ((!m->mcmd.len)&&(m->in_ptr=m->in_buf))) {
*m->in_ptr=0;
handle_module_cmd(m, m->in_buf, m->mcmd.len);
@@ -515,15 +582,17 @@ static void module_input_callback(struct module *m)
m->in_phase=0;
} else {
if(m->mcmd.len>=m->in_buf_size) {
if((m->in_buf_size<<=1)<=m->mcmd.len)
m->in_buf_size=m->mcmd.len+1; {
m->in_buf=realloc(m->in_buf, m->in_buf_size);
/* Resize buffer if needed */
if((m->in_buf_size<<=1)<=m->mcmd.len) {
m->in_buf_size=m->mcmd.len+1;
m->in_buf=realloc(m->in_buf, m->in_buf_size);
}
}
m->in_ptr=m->in_buf;
m->in_left=m->mcmd.len;
m->in_phase++;
}
}
p+=t;
r-=t;
}

View File

@@ -14,6 +14,10 @@
#define MCMD_GETICONDIR 16
#define MCMD_GETICONPALETTE 17
#define MCMD_MANAGEMENU 18
#define MCMD_ROTATE_WINDOW_RAISE 19
#define MCMD_ROTATE_WINDOW_LOWER 20
#define MCMD_UPDATE_BATTERY 21
#define MCMD_WINDOW_MOVE_NEXT_DESKTOP 22
struct mcmd_header {
XID id;
@@ -40,6 +44,14 @@ struct NewAppIcon {
char name[1];
};
struct mcmd_update_battery {
int battery_time;
int battery_pct;
int battery_cap;
int battery_ac;
int battery_charging;
};
extern struct module {
struct module *next;
int in_fd, out_fd;

View File

@@ -1,12 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#define WB_DISKMAGIC 0xe310
#define WB_DISKVERSION 1

View File

@@ -16,6 +16,8 @@ extern struct prefs_struct {
int titlebarclock; /* display titlebar clock? */
char *titleclockformat; /* format to use for the clock */
int titleclockinterval; /* how often do we update the clock?*/
int icontray; // if true then icons will be shown in a tray on top of each screen (besides clock and screen name)
int battery_info; /* display battery info? */
struct _Style *firststyle, *laststyle;
} prefs;

8
rc.c
View File

@@ -7,7 +7,7 @@
#include "prefs.h"
#include "drawinfo.h"
#include "screen.h"
#include "gram.h"
#include "gram.tab.h"
#include "icc.h"
#include "style.h"
@@ -25,6 +25,8 @@ struct prefs_struct prefs;
#define RC_FILENAME ".amiwmrc"
#endif
#define AMIWM_MODULES AMIWM_HOME"/modules/"
FILE *rcfile;
int ParseError=0;
@@ -36,7 +38,7 @@ void read_rc_file(char *filename, int manage_all)
prefs.manage_all = manage_all;
prefs.sizeborder=Psizeright;
prefs.icondir=AMIWM_HOME;
prefs.module_path=AMIWM_HOME;
prefs.module_path=AMIWM_MODULES;
prefs.defaulticon="def_tool.info";
prefs.borderwidth=1;
prefs.titleclockinterval=1;
@@ -45,6 +47,7 @@ void read_rc_file(char *filename, int manage_all)
prefs.screenmenu=False;
prefs.firststyle=NULL;
prefs.laststyle=NULL;
prefs.icontray=TRUE;
set_sys_palette();
if(filename!=NULL && (rcfile=fopen(filename, "r"))) {
@@ -102,6 +105,7 @@ struct keyword { char *name; int token; } keywords[] = {
{ "barblockpen", T_BARBLOCKPEN },
{ "bardetailpen", T_BARDETAILPEN },
{ "bartrimpen", T_BARTRIMPEN },
{ "batteryinfo", BATTERYINFO },
{ "blockpen", T_BLOCKPEN },
{ "both", BOTH },
{ "bottom", BOTTOM },

View File

@@ -13,30 +13,33 @@
extern struct Library *XLibBase;
#endif
// These are used for button spacing, not the button itself
#define BUT_BUTSPACE (2*(2+5))
#define BUT_INTSPACE 12
#define BUT_EXTSPACE 4
#define BUT_VSPACE 6
#define TXT_HSPACE 48
#define TXT_TOPSPACE 4
#define TXT_MIDSPACE 3
#define TXT_BOTSPACE 4
#include "gadget_button.h"
#include "gadget_textbox.h"
struct choice {
struct choice *next;
const char *text;
int l, w;
Window win;
struct choice *next;
const char *text;
int l, w;
struct gadget_button *b;
} *firstchoice=NULL, *lastchoice=NULL;
struct line {
struct line *next;
const char *text;
int l, w, h;
struct line *next;
const char *text;
int l, w, h;
} *firstline=NULL, *lastline=NULL;
Display *dpy;
Window root, mainwin, textwin;
Window root, mainwin;
//Window textwin;
struct gadget_textbox *g_textbox;
char *progname;
GC gc;
Pixmap stipple;
@@ -49,43 +52,59 @@ struct DrawInfo dri;
struct RDArgs *ra=NULL;
void selection(int n)
static void
selection(int n)
{
printf("%d\n", n);
XDestroyWindow(dpy, mainwin);
XCloseDisplay(dpy);
FreeArgs(ra);
exit(0);
printf("%d\n", n);
XDestroyWindow(dpy, mainwin);
XCloseDisplay(dpy);
FreeArgs(ra);
exit(0);
}
void *myalloc(size_t s)
static void
*myalloc(size_t s)
{
void *p=calloc(s,1);
if(p)
return p;
fprintf(stderr, "%s: out of memory!\n", progname);
FreeArgs(ra);
exit(1);
void *p=calloc(s,1);
if(p)
return p;
fprintf(stderr, "%s: out of memory!\n", progname);
FreeArgs(ra);
exit(1);
}
void addchoice(const char *txt)
/*
* Add a choice to the list of choices, but don't create
* the button just yet. This'll be done once all of them
* are known and the math to create the window sizing/layout
* can be done.
*/
static void
addchoice(const char *txt)
{
struct choice *c=myalloc(sizeof(struct choice));
if(lastchoice)
lastchoice->next=c;
else
firstchoice=c;
lastchoice=c;
c->l=strlen(c->text=txt);
struct choice *c=myalloc(sizeof(struct choice));
if(lastchoice)
lastchoice->next=c;
else
firstchoice=c;
lastchoice=c;
c->l = strlen(txt);
c->text = txt;
#ifdef USE_FONTSETS
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
totw+=(c->w=XmbTextEscapement(dri.dri_FontSet, c->text, c->l))+BUT_BUTSPACE;
#else
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
totw+=(c->w=XTextWidth(dri.dri_Font, c->text, c->l))+BUT_BUTSPACE;
#endif
nchoices++;
nchoices++;
}
void addline(const char *txt)
/*
* Add a line to the text box that we can draw.
*/
static void
addline(const char *txt)
{
struct line *l=myalloc(sizeof(struct line));
if(lastline)
@@ -94,6 +113,13 @@ void addline(const char *txt)
firstline=l;
lastline=l;
l->l=strlen(l->text=txt);
/* These are used to find the size, which we want
* to use in order to determine how big our window
* should be. It's a bit of a chicken/egg problem
* for now whilst this is figured out - it's also
* done in gadget_textbox_addline().
*/
#ifdef USE_FONTSETS
l->w=XmbTextEscapement(dri.dri_FontSet, l->text, l->l);
#else
@@ -104,57 +130,13 @@ void addline(const char *txt)
maxw=l->w;
}
void refresh_text()
{
int w=totw-BUT_EXTSPACE-BUT_EXTSPACE;
int h=toth-TXT_TOPSPACE-TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
(dri.dri_Ascent+dri.dri_Descent);
int x=(totw-maxw+TXT_HSPACE)>>1;
int y=((dri.dri_Ascent+dri.dri_Descent)>>1)+dri.dri_Ascent;
struct line *l;
XSetForeground(dpy, gc, dri.dri_Pens[SHADOWPEN]);
XDrawLine(dpy, textwin, gc, 0, 0, w-2, 0);
XDrawLine(dpy, textwin, gc, 0, 0, 0, h-2);
XSetForeground(dpy, gc, dri.dri_Pens[SHINEPEN]);
XDrawLine(dpy, textwin, gc, 0, h-1, w-1, h-1);
XDrawLine(dpy, textwin, gc, w-1, 0, w-1, h-1);
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
for(l=firstline; l; l=l->next) {
#ifdef USE_FONTSETS
XmbDrawString(dpy, textwin, dri.dri_FontSet, gc, x, y, l->text, l->l);
#else
XDrawString(dpy, textwin, gc, x, y, l->text, l->l);
#endif
y+=dri.dri_Ascent+dri.dri_Descent;
}
}
void refresh_choice(struct choice *c)
{
int w=c->w+BUT_BUTSPACE;
int h=dri.dri_Ascent+dri.dri_Descent+BUT_VSPACE;
XSetForeground(dpy, gc, dri.dri_Pens[TEXTPEN]);
#ifdef USE_FONTSETS
XmbDrawString(dpy, c->win, dri.dri_FontSet, gc, BUT_BUTSPACE/2,
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
#else
XDrawString(dpy, c->win, gc, BUT_BUTSPACE/2,
dri.dri_Ascent+BUT_VSPACE/2, c->text, c->l);
#endif
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
SHADOWPEN:SHINEPEN]);
XDrawLine(dpy, c->win, gc, 0, 0, w-2, 0);
XDrawLine(dpy, c->win, gc, 0, 0, 0, h-2);
XSetForeground(dpy, gc, dri.dri_Pens[(c==selected && depressed)?
SHINEPEN:SHADOWPEN]);
XDrawLine(dpy, c->win, gc, 1, h-1, w-1, h-1);
XDrawLine(dpy, c->win, gc, w-1, 1, w-1, h-1);
XSetForeground(dpy, gc, dri.dri_Pens[BACKGROUNDPEN]);
XDrawPoint(dpy, c->win, gc, w-1, 0);
XDrawPoint(dpy, c->win, gc, 0, h-1);
gadget_button_refresh(c->b);
}
void split(char *str, const char *delim, void (*func)(const char *))
static void
split(char *str, const char *delim, void (*func)(const char *))
{
char *p;
if((p=strtok(str, delim)))
@@ -167,23 +149,21 @@ struct choice *getchoice(Window w)
{
struct choice *c;
for(c=firstchoice; c; c=c->next)
if(w == c->win)
if(w == c->b->w)
return c;
return NULL;
}
void toggle(struct choice *c)
{
XSetWindowBackground(dpy, c->win, dri.dri_Pens[(depressed&&c==selected)?
FILLPEN:BACKGROUNDPEN]);
XClearWindow(dpy, c->win);
refresh_choice(c);
gadget_button_toggle(c->b);
}
void abortchoice()
{
if(depressed) {
depressed=0;
gadget_button_set_depressed(selected->b, 0);
toggle(selected);
}
selected=NULL;
@@ -210,6 +190,7 @@ int main(int argc, char *argv[])
static XTextProperty txtprop1, txtprop2;
int x, y, extra=0, n=0;
struct choice *c;
struct line *l;
Argtype array[3], *atp;
progname=argv[0];
@@ -258,28 +239,41 @@ int main(int argc, char *argv[])
XDrawPoint(dpy, stipple, gc, 0, 1);
XDrawPoint(dpy, stipple, gc, 1, 0);
XSetWindowBackgroundPixmap(dpy, mainwin, stipple);
g_textbox = gadget_textbox_create(dpy, &dri, gc, mainwin,
BUT_EXTSPACE,
TXT_TOPSPACE,
totw - BUT_EXTSPACE - BUT_EXTSPACE,
toth-TXT_TOPSPACE- TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE- (dri.dri_Ascent+dri.dri_Descent));
#if 0
textwin=XCreateSimpleWindow(dpy, mainwin, BUT_EXTSPACE, TXT_TOPSPACE, totw-
BUT_EXTSPACE-BUT_EXTSPACE, toth-TXT_TOPSPACE-
TXT_MIDSPACE-TXT_BOTSPACE-BUT_VSPACE-
(dri.dri_Ascent+dri.dri_Descent),
BUT_EXTSPACE-BUT_EXTSPACE,
0, dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, textwin, ExposureMask);
#endif
/* Lay out + create buttons */
x=BUT_EXTSPACE;
y=toth-TXT_BOTSPACE-(dri.dri_Ascent+dri.dri_Descent)-BUT_VSPACE;
for(c=firstchoice; c; c=c->next) {
c->win=XCreateSimpleWindow(dpy, mainwin,
x+(nchoices==1? (extra>>1):
n++*extra/(nchoices-1)),
y, c->w+BUT_BUTSPACE,
dri.dri_Ascent+dri.dri_Descent+
BUT_VSPACE, 0,
dri.dri_Pens[SHADOWPEN],
dri.dri_Pens[BACKGROUNDPEN]);
XSelectInput(dpy, c->win, ExposureMask|ButtonPressMask|ButtonReleaseMask|
EnterWindowMask|LeaveWindowMask);
c->b = gadget_button_init(dpy, &dri, gc, mainwin,
x + (nchoices == 1 ? (extra >> 1) : n++*extra/(nchoices-1)),
y,
c->w + BUT_BUTSPACE,
// Note: the original code didn't need a +2 here, but
// when using the ported button gadget it's needed or
// the bottom of the button isn't shown. Figure out why!
dri.dri_Ascent+dri.dri_Descent + BUT_VSPACE + 2);
gadget_button_set_text(c->b, c->text);
x+=c->w+BUT_BUTSPACE+BUT_INTSPACE;
}
/* Lay out + create text box contents */
for (l = firstline; l; l = l->next) {
gadget_textbox_addline(g_textbox, l->text);
}
size_hints.flags = PResizeInc;
txtprop1.value=(unsigned char *)array[0].ptr;
txtprop2.value=(unsigned char *)"RequestChoice";
@@ -296,20 +290,23 @@ int main(int argc, char *argv[])
XNextEvent(dpy, &event);
switch(event.type) {
case Expose:
if(!event.xexpose.count)
if(event.xexpose.window == textwin)
refresh_text();
if(!event.xexpose.count) {
if(event.xexpose.window == g_textbox->w)
gadget_textbox_refresh(g_textbox);
else if((c=getchoice(event.xexpose.window)))
refresh_choice(c);
}
break;
case LeaveNotify:
if(depressed && event.xcrossing.window==selected->win) {
if(depressed && event.xcrossing.window==selected->b->w) {
depressed=0;
gadget_button_set_depressed(selected->b, 0);
toggle(selected);
}
break;
case EnterNotify:
if((!depressed) && selected && event.xcrossing.window==selected->win) {
if((!depressed) && selected && event.xcrossing.window==selected->b->w) {
gadget_button_set_depressed(selected->b, 1);
depressed=1;
toggle(selected);
}
@@ -319,15 +316,17 @@ int main(int argc, char *argv[])
(c=getchoice(event.xbutton.window))) {
abortchoice();
depressed=1;
gadget_button_set_depressed(c->b, 1);
toggle(selected=c);
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected)
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
}
}

142
screen.c
View File

@@ -23,7 +23,23 @@ extern XContext screen_context, client_context, vroot_context;
extern void createmenubar();
extern void reparent(Client *);
Scrn *front = NULL, *scr = NULL;
static Scrn *_front = NULL;
Scrn *scr = NULL;
/*
* Accessor methods to get and set the 'front' screen.
*/
Scrn *
get_front_scr(void)
{
return _front;
}
void
set_front_scr(Scrn *s)
{
_front = s;
}
static Scrn *getvroot(Window root)
{
@@ -52,37 +68,37 @@ void setvirtualroot(Scrn *s)
}
}
Scrn *getscreenbyroot(Window w);
Scrn *getscreenbyrootext(Window w, int include_fs);
void screentoback(void)
{
Scrn *f;
if((!scr)||(scr->back==scr->root)) return;
if(scr==front) {
if(scr == get_front_scr()) {
XLowerWindow(dpy, scr->back);
front=scr->behind;
} else if(scr==getscreenbyroot(scr->root)) {
set_front_scr(scr->behind);
} else if(scr==getscreenbyrootext(scr->root, 1)) {
XLowerWindow(dpy, scr->back);
scr->upfront->behind=scr->behind;
scr->behind->upfront=scr->upfront;
scr->upfront=front->upfront;
scr->behind=front;
front->upfront->behind=scr;
front->upfront=scr;
} else if(scr->behind==front) {
scr->upfront = get_front_scr()->upfront;
scr->behind = get_front_scr();
get_front_scr()->upfront->behind=scr;
get_front_scr()->upfront=scr;
} else if(scr->behind == get_front_scr()) {
XRaiseWindow(dpy, scr->back);
front=scr;
set_front_scr(scr);
} else {
XRaiseWindow(dpy, scr->back);
scr->upfront->behind=scr->behind;
scr->behind->upfront=scr->upfront;
scr->upfront=front->upfront;
scr->behind=front;
front->upfront->behind=scr;
front->upfront=scr;
front=scr;
scr->upfront = get_front_scr()->upfront;
scr->behind = get_front_scr();
get_front_scr()->upfront->behind=scr;
get_front_scr()->upfront=scr;
set_front_scr(scr);
}
if((f = getscreenbyroot(scr->root))) {
if((f = getscreenbyrootext(scr->root, 0))) {
init_dri(&f->dri, dpy, f->root, f->cmap, True);
setvirtualroot(f);
}
@@ -106,46 +122,54 @@ static void scanwins()
unsigned int i, nwins;
Client *c;
Window dw1, dw2, *wins;
XWindowAttributes *pattr=NULL;
XPointer dummy;
Scrn *s=scr;
XGrabServer(dpy);
XQueryTree(dpy, scr->root, &dw1, &dw2, &wins, &nwins);
if(nwins && (pattr=calloc(nwins, sizeof(XWindowAttributes)))) {
for (i = 0; i < nwins; i++)
XGetWindowAttributes(dpy, wins[i], pattr+i);
for (int scan_dialogs = 0; nwins > 0 && scan_dialogs <= 1; scan_dialogs++) {
for (i = 0; i < nwins; i++) {
XWindowAttributes attr;
Window leader = None;
XGetTransientForHint(dpy, wins[i], &leader);
if (!scan_dialogs && leader != None)
continue; /* first pass; skip dialogs */
if (scan_dialogs && leader == None)
continue; /* second pass; skip leaders */
XGetWindowAttributes(dpy, wins[i], &attr);
if (!XFindContext(dpy, wins[i], client_context, &dummy))
continue;
if (pattr[i].override_redirect) {
if (attr.override_redirect) {
if(scr->back!=scr->root && XFindContext(dpy, wins[i], screen_context, &dummy))
assimilate(wins[i], pattr[i].x, pattr[i].y);
assimilate(wins[i], attr.x, attr.y);
continue;
}
c = createclient(wins[i]);
if (c != 0 && c->window == wins[i]) {
if (pattr[i].map_state == IsViewable) {
if (c != NULL && c->window == wins[i]) {
if (attr.map_state == IsViewable) {
c->state=NormalState;
getstate(c);
reparent(c);
if(c->state==IconicState) {
if(c->state==IconicState && c->leader == NULL) {
createicon(c);
adjusticon(c->icon);
XMapWindow(dpy, c->icon->window);
if(c->icon->labelwidth)
XMapWindow(dpy, c->icon->labelwin);
c->icon->mapped=1;
} else if(c->state==NormalState)
} else if(c->state==NormalState) {
XMapRaised(dpy, c->parent);
else
} else {
XRaiseWindow(dpy, c->parent);
}
c->reparenting=1;
scr=s;
}
}
}
free(pattr);
}
XUngrabServer(dpy);
XFree((void *) wins);
cleanupicons();
}
@@ -163,8 +187,10 @@ void closescreen(void)
XDeleteContext(dpy,scr->menubardepth,screen_context);
XDestroyWindow(dpy,scr->menubardepth);
XDeleteContext(dpy,scr->menubarparent,screen_context);
XDestroyWindow(dpy,scr->menubarparent);
if (scr->menubarparent != None) {
XDeleteContext(dpy,scr->menubarparent,screen_context);
XDestroyWindow(dpy,scr->menubarparent);
}
XDeleteContext(dpy,scr->menubar,screen_context);
XDestroyWindow(dpy,scr->menubar);
if(scr->inputbox != None) {
@@ -181,8 +207,8 @@ void closescreen(void)
term_dri(&scr->dri, dpy, scr->cmap);
if(scr->iconcolorsallocated)
XFreeColors(dpy, scr->cmap, scr->iconcolor, scr->iconcolorsallocated, 0);
if(front==scr)
front=scr->behind;
if(get_front_scr()==scr)
set_front_scr(scr->behind);
dummy=scr->behind;
free(scr);
scr=dummy;
@@ -292,14 +318,14 @@ Scrn *openscreen(char *deftitle, Window root)
s->default_tool_pm_w=0;
s->default_tool_pm_h=0;
if(front) {
s->behind=front;
s->upfront=front->upfront;
front->upfront->behind=s;
front->upfront=s;
if(get_front_scr()) {
s->behind = get_front_scr();
s->upfront = get_front_scr()->upfront;
get_front_scr()->upfront->behind=s;
get_front_scr()->upfront=s;
} else {
s->behind = s->upfront = s;
front = s;
set_front_scr(s);
}
scr=s;
@@ -309,7 +335,7 @@ Scrn *openscreen(char *deftitle, Window root)
void realizescreens(void)
{
scr = front;
scr = get_front_scr();
do {
if(!scr->realized) {
@@ -342,12 +368,15 @@ void realizescreens(void)
KeyPressMask|KeyReleaseMask|
ButtonPressMask|ButtonReleaseMask);
XStoreName(dpy, scr->back, scr->title);
if (scr->title)
XStoreName(dpy, scr->back, scr->title);
XLowerWindow(dpy, scr->back);
XMapWindow(dpy, scr->back);
if (!scr->deftitle)
scr->realized = 1;
}
scr=scr->behind;
} while(scr!=front);
} while(scr != get_front_scr());
do {
if(!scr->realized) {
scanwins();
@@ -358,29 +387,34 @@ void realizescreens(void)
scr->realized=1;
}
scr=scr->behind;
} while(scr!=front);
} while(scr != get_front_scr());
}
Scrn *getscreen(Window w)
{
Scrn *s=front;
Scrn *s = get_front_scr();
if(w && s)
do {
if(s->back == w || s->root == w)
return s;
s=s->behind;
} while(s!=front);
return front;
} while(s != get_front_scr());
return get_front_scr();
}
Scrn *getscreenbyrootext(Window w, int include_fs)
{
Scrn *s = get_front_scr();
if(s)
do {
if(s->root == w && (include_fs || s->deftitle))
return s;
s=s->behind;
} while(s != get_front_scr());
return NULL;
}
Scrn *getscreenbyroot(Window w)
{
Scrn *s=front;
if(s)
do {
if(s->root == w)
return s;
s=s->behind;
} while(s!=front);
return NULL;
return getscreenbyrootext(w, 0);
}

View File

@@ -3,6 +3,18 @@
#include "icon.h"
/*
* Struct _Scrn - virtual desktop screen
*
* @root: root window for virtual desktop
* @back: background window
* @colormap: current colourmap
* @fh: font height for menu/window, including ascender/descender.
* @bh: title bar / menu bar height; fh + fixed padding.
* @icons: list of icons on this desktop.
* @firstselected: first selected icon on this desktop.
*/
typedef struct _Scrn {
struct _Scrn *behind, *upfront;
Window root, back, inputbox;
@@ -25,6 +37,19 @@ typedef struct _Scrn {
unsigned long iconcolor[256];
} Scrn;
extern Scrn *scr, *front;
extern Scrn *scr;
Scrn * get_front_scr(void);
void set_front_scr(Scrn *s);
extern void closescreen();
extern Scrn * openscreen(char *, Window);
extern void realizescreens();
extern void screentoback();
void closescreen();
Scrn *openscreen(char *deftitle, Window root);
void realizescreens();
void screentoback();
#endif

View File

@@ -1,47 +0,0 @@
PROGRAMS = amiwm requestchoice
AMIWM_HOME = amiwm:
SRCS1 = main.c drawinfo.c client.c frame.c icc.c \
icon.c menu.c diskobject.c gram.c lex.c rc.c
OBJS1 = main.o drawinfo.o client.o frame.o icc.o \
icon.o menu.o diskobject.o gram.o lex.o rc.o
SRCS2 = requestchoice.c drawinfo.c
OBJS2 = requestchoice.o drawinfo.o
all : $(PROGRAMS)
amiwm : $(OBJS1)
sc LINK PNAME amiwm $(OBJS1)
requestchoice : $(OBJS2)
sc LINK PNAME requestchoice $(OBJS2)
gram.c : gram.y
bison -y -d -o gram.c gram.y
lex.c : lex.l
flex -t < lex.l > lex.c
gram.o : gram.c
lex.o : lex.c
menu.o : menu.c
sc menu DEF AMIWM_HOME="$(AMIWM_HOME)"
rc.o : rc.c
sc rc DEF AMIWM_HOME="$(AMIWM_HOME)"
clean : tidy
-delete FORCE $(PROGRAMS)
tidy :
-delete FORCE \#?.(o|q|tmp|lnk) lex.c gram.c gram.h core
install :
copy amiwm requestchoice system.amiwmrc def_tool.info $(AMIWM_HOME)

View File

@@ -1,6 +1,7 @@
FastQuit Off
SizeBorder Right
IconPalette MagicWB
IconDir "@AMIWM_HOME@/"
DefaultIcon "def_tool.info"
CustomIconsOnly Off
ShortLabelIcons Off

View File

@@ -1 +1 @@
#define VERSION "0.22"
#define VERSION "0.22pl2+github"