35 Commits
Author SHA1 Message Date
Martin Duquesnoy eb2dea3a1c Merge pull request #72 from MicroJoe/gh-pages
Add MicroJoe in authors section
2012-08-09 08:41:19 -07:00
Romain Porte c63c12d280 Added MicroJoe in authors section 2012-08-08 16:26:14 +02:00
arnault a081d18e49 add kidanger in authors section 2012-04-20 17:23:01 +02:00
arnault 3920c55f56 remove header shadow - not well dispayed in all browsers 2012-04-01 18:02:19 +02:00
arnault 780de544bc add irc link in support section 2012-02-24 17:31:53 +01:00
arnault 135108b3cb fix irc link 2012-02-24 17:10:55 +01:00
arnault fd16abfa07 add irc page 2012-02-24 17:09:02 +01:00
arnault 1bd6c770a3 test basic favicon 2012-02-22 19:13:40 +01:00
arnault 151a3d41f3 add basic favicon 2012-02-22 19:11:39 +01:00
arnault 965bb197aa remove transparency from favicon 2012-02-22 19:02:33 +01:00
arnault 45b7d02401 change favicon 2012-02-22 18:53:38 +01:00
arnault d80dcd0b0c fix git code 2012-02-22 15:55:44 +01:00
arnault aee8d91837 fix link and add titles 2012-02-22 15:44:05 +01:00
arnault 9c09a0c958 add git link 2012-02-22 15:38:32 +01:00
arnault 870f6ac0ce update logo 2012-02-14 20:06:16 +01:00
arnault f4329419f5 add 6pi in authors 2012-02-14 17:56:04 +01:00
arnault f98a404837 clear and cmpact css 2012-02-14 17:40:37 +01:00
arnault 14b414447a add tar download link 2012-02-13 21:17:28 +01:00
arnault fc3a15fb0e fix slideshow offset + fix doxnload link + add support section 2012-02-13 21:05:37 +01:00
arnault 31db953491 fix download link 2012-02-13 16:02:03 +01:00
arnault 2610380b32 add content to homepage 2012-02-13 13:30:55 +01:00
Martin Duquesnoy 95270b2afe CNAME 2012-02-13 02:18:24 +01:00
Martin Duquesnoy 77861f6cc6 cname 2012-02-12 23:57:04 +01:00
Martin Duquesnoy 20c2c25a66 CNAME 2012-02-12 23:18:39 +01:00
Martin Duquesnoy 5955579c99 CNAME 2012-02-12 23:06:01 +01:00
Martin Duquesnoy eeac90402d CNAME 2012-02-12 23:02:41 +01:00
Martin Duquesnoy e74081a234 page 2012-02-12 21:57:00 +01:00
Martin Duquesnoy 46fe901a0e cname 2012-02-12 21:47:23 +01:00
Martin Duquesnoy 4ff82cae8b add 2012-02-12 21:41:12 +01:00
Martin Duquesnoy 8fbd096923 Arpinux webpages 2012-02-12 21:38:57 +01:00
Martin Duquesnoy a72d232db3 page 2012-02-12 21:06:04 +01:00
Martin Duquesnoy 2c4b6db3b0 page 2012-02-12 21:05:35 +01:00
Martin Duquesnoy 17967150c0 page 2012-02-12 21:05:19 +01:00
Martin Duquesnoy 1f572b9e9a page 2012-02-12 21:04:02 +01:00
Martin Duquesnoy 49ce029ea2 Created gh-pages branch via GitHub 2012-02-11 17:52:45 -08:00
73 changed files with 349 additions and 10472 deletions
-17
View File
@@ -1,17 +0,0 @@
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
cmake_uninstall.cmake
Makefile
*.o
.*.sw?
wmfs
src/config.h
changelog
config.h
#*
\#*
build/
doc/
wmfs.doxygen
wmfsrc
-274
View File
@@ -1,274 +0,0 @@
# -*- mode: cmake -*-
#Cmakelists.txt
# Minimum version of CMake
cmake_minimum_required(VERSION 2.6)
if(COMMAND cmake_policy)
cmake_policy(VERSION 2.6)
endif()
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# Source and build dirs
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
# Project name - wmfs
set(PROJECT_NAME wmfs)
project(${PROJECT_NAME} C)
# Definition of the wmfs source
set(wmfs_src
src/confparse/util.c
src/confparse/confparse.c
src/barwin.c
src/client.c
src/config.c
src/
src/draw.c
src/event.c
src/ewmh.c
src/frame.c
src/getinfo.c
src/infobar.c
src/init.c
src/launcher.c
src/layout.c
src/menu.c
src/mouse.c
src/screen.c
src/status.c
src/tag.c
src/util.c
src/viwmfs.c
src/wmfs.c)
# Set the executable from the wmfs_src
add_executable(wmfs ${wmfs_src})
# Set the version
set(VERSION "WMFS-201003")
# FLAGS
set(CFLAGS "-Wall -ansi")
set(CMAKE_C_FLAGS ${CFLAGS})
# Linker FLAGS
set(DEFAULT_LDFLAGS "-L /usr/local/lib -lpthread")
if(CMAKE_SYSTEM_NAME MATCHES NetBSD)
message("-- NetBSD system found - Using /usr/pkg/lib for linker")
set(LDFLAGS "${DEFAULT_LDFLAGS} -L /usr/pkg/lib")
else(CMAKE_SYSTEM_NAME MATCHES NetBSD)
set(LDFLAGS ${DEFAULT_LDFLAGS})
endif(CMAKE_SYSTEM_NAME MATCHES NetBSD)
set_target_properties(wmfs PROPERTIES LINK_FLAGS ${LDFLAGS})
# Includes dir for libs in build_dir
include_directories(
${BUILD_DIR}/src
)
# Package find
find_package(Freetype)
if(FREETYPE_FOUND)
include_directories(${FREETYPE_INCLUDE_DIRS})
else (FREETYPE_FOUND)
message(FATAL_ERROR "Could not find Freetype")
endif (FREETYPE_FOUND)
find_package(X11)
if(X11_FOUND)
include_directories(${X11_INCLUDE_DIR})
else (X11_FOUND)
message(FATAL_ERROR "Could not find X11")
endif (X11_FOUND)
# Link Libraries
set(LIBRARIES_TO_LINK
${FREETYPE_LIBRARIES}
${X11_LIBRARIES}
Xft)
# Includes
include(FindDoxygen)
include(FindPkgConfig)
# Use pkgconfig to get required libraries
pkg_check_modules(WMFS_REQUIRED REQUIRED
x11
freetype2
xft)
# Optional dependencies check
# Check for xinerama
pkg_check_modules(HAVE_XINERAMA xinerama)
if(HAVE_XINERAMA_FOUND)
set(WMFS_HAVE_XINERAMA "#define HAVE_XINERAMA")
set(LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} Xinerama)
else()
set(WMFS_HAVE_XINERAMA "")
endif()
# Check for xrandr
pkg_check_modules(HAVE_XRANDR xrandr)
if(HAVE_XRANDR_FOUND)
set(WMFS_HAVE_XRANDR "#define HAVE_XRANDR")
set(LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} Xrandr)
else()
set(WMFS_HAVE_XRANDR "")
endif()
# Check for Imlib
pkg_check_modules(HAVE_IMLIB imlib2)
if(HAVE_IMLIB_FOUND)
set(WMFS_HAVE_IMLIB "#define HAVE_IMLIB")
set(LIBRARIES_TO_LINK ${LIBRARIES_TO_LINK} Imlib2)
else()
set(WMFS_HAVE_IMLIB "")
endif()
target_link_libraries(wmfs ${LIBRARIES_TO_LINK})
# Messages
message("Project version: ${VERSION}")
message("Using these CFLAGS: ${CFLAGS}")
message("Using these LDFLAGS: ${LDFLAGS}")
message("Linking with theses libraries : ${LIBRARIES_TO_LINK}")
# Generating man page
find_program(GZIP_EXECUTABLE gzip)
if(NOT GZIP_EXECUTABLE)
message(STATUS "Looking for gzip -- not found")
message(STATUS "Could not generating man page")
else()
message(STATUS "Looking for gzip -- ${GZIP_EXECUTABLE}")
message(STATUS "Generating man page")
set(WMFS_MAN1_FILES ${BUILD_DIR}/wmfs.1.gz)
execute_process(
COMMAND ${GZIP_EXECUTABLE} -c wmfs.1
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_FILE ${WMFS_MAN1_FILES})
endif()
# Generating CHANGELOG
find_program(GIT_EXECUTABLE git)
if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
message(STATUS "Looking for git -- ${GIT_EXECUTABLE}")
message(STATUS "Git dir -- Generating changelog...")
set(PROJECT_CHANGELOG ${SOURCE_DIR}/changelog)
execute_process(
COMMAND ${GIT_EXECUTABLE} log
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_FILE ${PROJECT_CHANGELOG})
else()
message(STATUS "Looking for git -- not found")
message(STATUS "Could not generating changelog")
endif()
# sets
# {{{ Install path and configuration variables
if(DEFINED PREFIX)
set(PREFIX ${PREFIX} CACHE PATH "install prefix")
set(CMAKE_INSTALL_PREFIX ${PREFIX})
else()
set(PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "install prefix")
endif()
#If a sysconfdir is specified, use it instead
#of the default configuration dir.
if(DEFINED SYSCONFDIR)
set(SYSCONFDIR ${SYSCONFDIR} CACHE PATH "config directory")
else()
set(SYSCONFDIR /etc CACHE PATH "config directory")
endif()
#If an XDG Config Dir is specificed, use it instead
#of the default XDG configuration dir.
if(DEFINED XDG_CONFIG_DIR)
set(XDG_CONFIG_DIR ${XDG_CONFIG_SYS} CACHE PATH "xdg config directory")
else()
set(XDG_CONFIG_DIR ${SYSCONFDIR}/xdg CACHE PATH "xdg config directory")
endif()
# setting WMFS_XSESSION_PATH
if(DEFINED WMFS_XSESSION_PATH)
set(WMFS_XSESSION_PATH ${WMFS_XSESSION_PATH} CACHE PATH "wmfs xsessions directory")
else()
set(WMFS_XSESSION_PATH ${PREFIX}/share/xsessions CACHE PATH "wmfs xsessions directory")
endif()
if(DEFINED WMFS_MAN_PATH)
set(WMFS_MAN_PATH ${WMFS_MAN_PATH} CACHE PATH "wmfs manpage directory")
else()
set(WMFS_MAN_PATH ${PREFIX}/share/man CACHE PATH "wmfs manpage directory")
endif()
if(DOXYGEN_EXECUTABLE)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${SOURCE_DIR}/wmfs.doxygen
WORKING_DIRECTORY ${BUILD_DIR})
endif()
find_program(URXVT_EXECUTABLE urxvt)
if(URXVT_EXECUTABLE)
set(WMFS_TERM urxvt)
else()
set(WMFS_TERM xterm)
endif()
# Remplace strings in configs
set(WMFS_VERSION ${VERSION})
set(WMFS_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
set(WMFS_COMPILE_BY $ENV{USER})
set(WMFS_COMPILE_FLAGS ${CFLAGS})
set(WMFS_LINKED_LIBS ${LIBRARIES_TO_LINK})
set(WMFS_SYSCONFDIR ${XDG_CONFIG_DIR}/${PROJECT_NAME})
set(WMFS_SOURCE_DIR ${SOURCE_DIR})
# Configure files
set(wmfs_configure_files
src/config.h.in
wmfs.doxygen.in
wmfsrc.in)
macro(a_configure_file file)
string(REGEX REPLACE ".in\$" "" outfile ${file})
message(STATUS "Configuring ${outfile}")
configure_file(${SOURCE_DIR}/${file}
${SOURCE_DIR}/${outfile}
ESCAPE_QUOTE
@ONLY)
endmacro()
foreach(file ${wmfs_configure_files})
a_configure_file(${file})
endforeach()
set(PROJECT_DATA_PATH share/${PROJECT_NAME})
set(PROJECT_TODO ${SOURCE_DIR}/TODO)
set(PROJECT_README ${SOURCE_DIR}/README)
set(PROJECT_DEFAULT_CONF ${SOURCE_DIR}/wmfsrc)
# installs
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
if(WMFS_MAN1_FILES)
install(FILES ${WMFS_MAN1_FILES} DESTINATION ${WMFS_MAN_PATH}/man1)
endif()
if(PROJECT_CHANGELOG)
install(FILES ${PROJECT_CHANGELOG} DESTINATION ${PROJECT_DATA_PATH})
endif()
install(FILES ${PROJECT_TODO} ${PROJECT_README}
${PROJECT_DEFAULT_CONF} DESTINATION ${PROJECT_DATA_PATH})
install(FILES ${PROJECT_DEFAULT_CONF} DESTINATION ${WMFS_SYSCONFDIR})
install(FILES "wmfs.desktop" DESTINATION ${WMFS_XSESSION_PATH})
+1
View File
@@ -0,0 +1 @@
wmfs.info
-27
View File
@@ -1,27 +0,0 @@
Copyright (c) 1983 The Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-36
View File
@@ -1,36 +0,0 @@
ABOUT :
WMFS Window Manager.
* Window Manager From Scratch
A highly configurable and manageable tiling Window Manager created from scratch
AUTHORS :
Martin Duquesnoy <xorg62@gmail.com>
LICENSE : BSD
REQUIREMENT :
- freetype2
- libxinerama (optional)
- libxrandr (optional)
- libxft
- libx11
- CMake >= 2.6
OS :
- GNU/Linux : Supported.
- FreeBSD : Supported.
INSTALL :
- mkdir build
- cd build
- cmake ..
- make
- sudo make install
- sudo make uninstall # if you would to remove it.
If you have doxygen installed you can generate doxygen documentation via custom target 'make doc' in the build dir.
DISTROS :
- wmfs port for FreeBSD at x11-wm/wmfs
- wmfs is available with AUR in ArchLinux
-5
View File
@@ -1,5 +0,0 @@
· Add Doxygen comment <-> OK
· Mouse bindings in the config file
· Can change client position in the tile grid
· Fix all the bug \o/
· XCB ?
-21
View File
@@ -1,21 +0,0 @@
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

+77
View File
@@ -0,0 +1,77 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="Shortcut Icon" href="favicon-basic.ico" type="image/x-icon" />
<!-- Page Title -->
<title>WMFS - Window Manager From Scratch</title>
</head>
<body>
<div id="container">
<div id="header">
<h1><span>window manager from scratch by <a href="https://github.com/xorg62" title ="who is...">xorg62</a></span><a href="https://github.com/xorg62/wmfs" title="go to github">WMFS2</a></h1>
<h2><a href="https://github.com/xorg62/wmfs" title="go to git repository">git</a> | <a href="https://github.com/xorg62/wmfs/wiki" title="visit wmfs wiki eng/fr">wiki</a> | <a href="https://github.com/xorg62/wmfs/tarball/master" title="download wmfs as tgz">download</a> | <a href="mailto:xorg62@gmail.com" title="mail to xorg62">contact</a> | <a href="irc.html" title="chan #wmfs on freenode">irc</a></h2>
</div>
<div id="links">
<div class="categorie">
<img src="images/logo-snap2.png" alt="wmfs2"/>
<h2> - what ?</h2>
<p>WMFS2 is a lightweight and highly configurable tiling window manager for X written in C. wmfs2 is a free software distributed under the <a href="http://en.wikipedia.org/wiki/BSD_licenses">BSD license</a>. it can be drive from keyboard or mouse and it's configuration stands in one text file easily understandable</p>
<h2> - where ?</h2>
<p>You can download this project either in <a href="https://github.com/xorg62/wmfs/zipball/master">zip</a> or <a href="https://github.com/xorg62/wmfs/tarball/master">tar</a> formats. You can also clone the project with <a href="http://git-scm.com">Git</a> by running: <pre>$ git clone git://github.com/xorg62/wmfs.git</pre></p>
<h2> - look</h2>
<p>wmfs2 supports themable statusbars and clients</p>
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<a href="shots/wmfs2_shots_01.png"><img src="images/wmfs2_thmb_01.png" alt=""/></a>
<a href="shots/wmfs2_shots_02.png"><img src="images/wmfs2_thmb_01.png" alt=""/></a>
<a href="shots/wmfs2_shots_03.png"><img src="images/wmfs2_thmb_03.png" alt=""/></a>
<a href="shots/wmfs2_shots_04.png"><img src="images/wmfs2_thmb_04.png" alt=""/></a>
<a href="shots/wmfs2_shots_05.png"><img src="images/wmfs2_thmb_05.png" alt=""/></a>
<a href="shots/wmfs2_shots_06.png"><img src="images/wmfs2_thmb_06.png" alt=""/></a>
<a href="shots/wmfs2_shots_07.png"><img src="images/wmfs2_thmb_07.png" alt=""/></a>
<a href="shots/wmfs2_shots_08.png"><img src="images/wmfs2_thmb_08.png" alt=""/></a>
<a href="shots/wmfs2_shots_09.png"><img src="images/wmfs2_thmb_09.png" alt=""/></a>
<a href="shots/wmfs2_shots_10.png"><img src="images/wmfs2_thmb_10.png" alt=""/></a>
</div>
<h2> - support</h2>
<a href="https://github.com/xorg62/wmfs/wiki">the wiki</a> is a good place to find answers to common questions.<br/>
need more help ? the best way to get direct support is to join our IRC channel, <a href="irc.html" title="wmfs on freenode">#wmfs on freenode</a>.
<h2> - authors</h2>
<p>Martin Duquesnoy (xorg62@gmail.com)<br />
David Delassus (david.jose.delassus@gmail.com)<br />
Paul Fariello (fariello@archos.com)<br />
Hobbestigrou (hobbestigrou@erakis.im)<br />
Philippe Pepiot (phil@philpep.org)<br />
m-r-r (raybaudroigm@gmail.com)<br />
6pi (c.sipieter@gmail.com)<br />
Jeremy Anger (angerj.dev@gmail.com)<br />
arnault (contact@arpinux.org)<br />
Romain Porte (microjoe@mailoo.org)</p>
</div>
<script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="scripts/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider({
effect: 'fade',
pauseTime: 5000,
controlNav: false,
randomStart: true
});
});
</script>
</div>
</div>
<div id="footer">
<p>:: theme by <a href="http://arpinux.org">arpinux</a> inspired by <a href="http://wiscot.deviantart.com">wiscot</a> :: slider by <a href="license.txt">dev7</a> :: arpinux 2012 :: license <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">cc BY-NC-SA</a> :: <a href="http://validator.w3.org/check/referer" title="Valid XHTML 1.0">XHTML</a> :: <!--a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS">CSS</a--></p>
</div>
</div>
</body>
</html>
<!-- cc BY-NC-SA License :: arpinux :: 2012 :: http://arpinux.org -->
+31
View File
@@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="Shortcut Icon" href="favicon-basic.ico" type="image/x-icon" />
<!-- Page Title -->
<title>WMFS on freenode</title>
</head>
<body>
<div id="container">
<div id="header">
<h1><span>window manager from scratch by <a href="https://github.com/xorg62" title ="who is...">xorg62</a></span><a href="https://github.com/xorg62/wmfs" title="go to github">WMFS2</a></h1>
<h2><a href="https://github.com/xorg62/wmfs" title="go to git repository">git</a> | <a href="https://github.com/xorg62/wmfs/wiki" title="visit wmfs wiki eng/fr">wiki</a> | <a href="https://github.com/xorg62/wmfs/tarball/master" title="download wmfs as tgz">download</a> | <a href="mailto:xorg62@gmail.com" title="mail to xorg62">contact</a> | <a href="irc.html" title="chan #wmfs on freenode">irc</a></h2>
</div>
<div id="links">
<div class="categorie">
<iframe src="http://webchat.freenode.net?channels=wmfs" frameborder="0" width="100%" height="400"><p>your browser does not support iframes. please use an irc client like irssi, weechat or pidgin.</p></iframe>
</div>
</div>
<div id="footer">
<p>:: theme by arpinux inspired by <a href="http://wiscot.deviantart.com">wiscot</a> :: irc by <a href="http://www.qwebirc.org/">qwebirc</a> :: arpinux 2012 :: license <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">cc BY-NC-SA</a> :: <!--a href="http://validator.w3.org/check/referer" title="Valid XHTML 1.0">XHTML</a> :: <a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS">CSS</a--></p>
</div>
</div>
</body>
</html>
<!-- cc BY-NC-SA License :: arpinux :: 2011 :: http://arpinux.org -->
+25
View File
@@ -0,0 +1,25 @@
Nivo Slider is "The Most Awesome jQuery Image Slider".
See http://nivo.dev7studios.com for more info.
Copyright (c) 2011 Gilbert Pellegrom
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 AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
#WMFS status.sh example file
#Will be executed if put in ~/.config/wmfs/
#Timing adjustable in wmfsrc (misc -> status_timing)
statustext()
{
wmfs -s "`date`"
}
statustext
Vendored Executable
+4
View File
File diff suppressed because one or more lines are too long
+12
View File
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 KiB

-308
View File
@@ -1,308 +0,0 @@
/*
* barwin.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Create a BarWindow
* \param parent Parent window of the BarWindow
* \param x X position
* \param y Y position
* \param w BarWindow Width
* \param h BarWindow Height
* \param color BarWindow color
* \param entermask Bool for know if the EnterMask mask is needed
* \return The BarWindow pointer
*/
BarWindow*
barwin_create(Window parent,
int x,
int y,
uint w,
uint h,
uint bg,
char *fg,
Bool entermask,
Bool stipple,
Bool border)
{
XSetWindowAttributes at;
BarWindow *bw;
/* Allocate memory */
bw = emalloc(1, sizeof(BarWindow));
/* Barwin attributes */
at.override_redirect = True;
at.background_pixmap = ParentRelative;
at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|ButtonMask|MouseMask
|ExposureMask|VisibilityChangeMask
|StructureNotifyMask|SubstructureRedirectMask;
if(entermask)
at.event_mask |= EnterWindowMask|LeaveWindowMask|FocusChangeMask;
/* Create window */
bw->win = XCreateWindow(dpy, parent, x, y, w, h, 0, DefaultDepth(dpy, SCREEN),
CopyFromParent, DefaultVisual(dpy, SCREEN),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &at);
bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, SCREEN));
/* His border */
if(border)
{
bw->bord = True;
CWIN(bw->border.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(bg), &at);
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(bg), &at);
CWIN(bw->border.bottom, bw->win, 0, h - SHADH, w, SHADH, 0, CWBackPixel, SHADC, &at);
CWIN(bw->border.right, bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, SHADC, &at);
}
/* Property */
bw->geo.x = x;
bw->geo.y = y;
bw->geo.width = w;
bw->geo.height = h;
bw->bg = bg;
bw->fg = fg;
bw->border.light = color_enlight(bg);
bw->border.dark = SHADC;
bw->stipple = stipple;
bw->stipple_color = -1;
return bw;
}
/** Draw text in a Barwindow
*/
void
barwin_draw_text(BarWindow *bw, int x, int y, char *text)
{
if(!text)
return;
/* Background color of the text if there is stipple */
if(bw->stipple)
draw_rectangle(bw->dr, x - 4, 0, textw(text) + 8, bw->geo.height, bw->bg);
/* Draw text */
draw_text(bw->dr, x, y, bw->fg, 0, text);
barwin_refresh(bw);
return;
}
/** Delete a BarWindow
* \param bw BarWindow pointer
*/
void
barwin_delete(BarWindow *bw)
{
CHECK(bw);
XSelectInput(dpy, bw->win, NoEventMask);
XDestroyWindow(dpy, bw->win);
XFreePixmap(dpy, bw->dr);
free(bw);
return;
}
/** Delete the BarWindow sub windows
* \param bw BarWindow pointer
*/
void
barwin_delete_subwin(BarWindow *bw)
{
CHECK(bw);
XDestroySubwindows(dpy, bw->win);
return;
}
/** Map a BarWindow
* \param bw BarWindow pointer
*/
void
barwin_map(BarWindow *bw)
{
CHECK(!bw->mapped);
XMapWindow(dpy, bw->win);
bw->mapped = True;
return;
}
/** Map the subwindows of a BarWindow
* Use for the BarWindow special border...
* \param bw BarWindow pointer
*/
void
barwin_map_subwin(BarWindow *bw)
{
CHECK(bw);
XMapSubwindows(dpy, bw->win);
return;
}
/** Unmap a BarWindow
* \param bw BarWindow pointer
*/
void
barwin_unmap(BarWindow *bw)
{
CHECK(bw->mapped);
XUnmapWindow(dpy, bw->win);
bw->mapped = False;
return;
}
/** Unmap the BarWindow sub windows
* \param bw BarWindow pointer
*/
void
barwin_unmap_subwin(BarWindow *bw)
{
CHECK(bw);
XUnmapSubwindows(dpy, bw->win);
return;
}
/** Move a BarWindow
* \param bw BarWindow pointer
* \param x X position
* \param y Y poistion
*/
void
barwin_move(BarWindow *bw, int x, int y)
{
CHECK(bw);
bw->geo.x = x;
bw->geo.y = y;
XMoveWindow(dpy, bw->win, x, y);
return;
}
/** Resize a BarWindow
* \param bw BarWindow pointer
* \param w Width
* \param h Height
*/
void
barwin_resize(BarWindow *bw, uint w, uint h)
{
CHECK(bw);
bw->geo.width = w;
bw->geo.height = h;
XFreePixmap(dpy, bw->dr);
/* Frame */
bw->dr = XCreatePixmap(dpy, ROOT,
w - ((bw->bord) ? SHADH : 0),
h - ((bw->bord) ? SHADH : 0),
DefaultDepth(dpy, SCREEN));
XResizeWindow(dpy, bw->win, w, h);
/* Border */
if(bw->bord)
{
XResizeWindow(dpy, bw->border.left, SHADH, h);
XResizeWindow(dpy, bw->border.top, w, SHADH);
XResizeWindow(dpy, bw->border.bottom, w, SHADH);
XMoveResizeWindow(dpy, bw->border.right, w - SHADH, 0, SHADH, h);
}
return;
}
/** Refresh the BarWindow Color
* \param bw BarWindow pointer
*/
void
barwin_refresh_color(BarWindow *bw)
{
CHECK(bw);
draw_rectangle(bw->dr, 0, 0, bw->geo.width, bw->geo.height, bw->bg);
if(bw->stipple)
{
XSetForeground(dpy, gc_stipple, ((bw->stipple_color != -1) ? bw->stipple_color : getcolor(bw->fg)));
XFillRectangle(dpy, bw->dr, gc_stipple, 3, 2, bw->geo.width - 6, bw->geo.height - 4);
}
if(bw->bord)
{
XSetWindowBackground(dpy, bw->border.left, bw->border.light);
XSetWindowBackground(dpy, bw->border.top, bw->border.light);
XSetWindowBackground(dpy, bw->border.bottom, bw->border.dark);
XSetWindowBackground(dpy, bw->border.right, bw->border.dark);
XClearWindow(dpy, bw->border.left);
XClearWindow(dpy, bw->border.top);
XClearWindow(dpy, bw->border.bottom);
XClearWindow(dpy, bw->border.right);
}
return;
}
/** Refresh the BarWindow
* \param bw BarWindow pointer
*/
void
barwin_refresh(BarWindow *bw)
{
if(!bw || !bw->dr || !bw->win)
return;
XCopyArea(dpy, bw->dr, bw->win, gc, 0, 0, bw->geo.width, bw->geo.height, 0, 0);
return;
}
-1151
View File
File diff suppressed because it is too large Load Diff
-654
View File
@@ -1,654 +0,0 @@
/*
* config.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/* local function definition */
static void conf_section(void (*)(char*), char *, char *);
func_name_list_t tmp_func_list[] =
{
{"spawn", uicb_spawn },
{"client_kill", uicb_client_kill },
{"client_prev", uicb_client_prev },
{"client_next", uicb_client_next },
{"client_swap_next", uicb_client_swap_next },
{"client_swap_prev", uicb_client_swap_prev },
{"client_screen_next", uicb_client_screen_next },
{"client_screen_prev", uicb_client_screen_prev },
{"client_move", uicb_client_move },
{"client_resize", uicb_client_resize },
{"toggle_max", uicb_togglemax },
{"layout_next", uicb_layout_next },
{"layout_prev", uicb_layout_prev },
{"tag", uicb_tag },
{"tag_next", uicb_tag_next },
{"tag_prev", uicb_tag_prev },
{"tag_prev_sel", uicb_tag_prev_sel },
{"tag_transfert", uicb_tagtransfert },
{"tag_transfert_next", uicb_tagtransfert_next },
{"tag_transfert_prev", uicb_tagtransfert_prev },
{"set_mwfact", uicb_set_mwfact },
{"set_nmaster", uicb_set_nmaster },
{"quit", uicb_quit },
{"toggle_infobar_position", uicb_infobar_togglepos },
{"toggle_resizehint", uicb_toggle_resizehint },
{"mouse_move", uicb_mouse_move },
{"mouse_resize", uicb_mouse_resize },
{"client_raise", uicb_client_raise },
{"toggle_free", uicb_togglefree },
{"toggle_abovefc", uicb_toggle_abovefc },
{"screen_select", uicb_screen_select },
{"screen_next", uicb_screen_next },
{"screen_prev", uicb_screen_prev },
{"screen_prev_sel", uicb_screen_prev_sel},
{"reload", uicb_reload },
{"launcher", uicb_launcher },
{"set_layout", uicb_set_layout },
{"menu", uicb_menu },
{"set_client_layer", uicb_set_client_layer },
{"set_layer", uicb_set_layer },
{"ignore_next_client_rules", uicb_ignore_next_client_rules }
};
key_name_list_t key_list[] =
{
{"Control", ControlMask },
{"Shift", ShiftMask },
{"Lock", LockMask },
{"Alt", Mod1Mask },
{"Mod2", Mod2Mask },
{"Mod3", Mod3Mask },
{"Mod4", Mod4Mask },
{"Super", Mod4Mask },
{"Mod5", Mod5Mask },
{NULL, NoSymbol }
};
name_to_uint_t mouse_button_list[] =
{
{"Button1", Button1 },
{"Button2", Button2 },
{"Button3", Button3 },
{"Button4", Button4 },
{"Button5", Button5 },
{"1", Button1 },
{"2", Button2 },
{"3", Button3 },
{"4", Button4 },
{"5", Button5 },
};
void
mouse_section(MouseBinding mb[], char *src, int ns)
{
int i;
char *tmp;
for(i = 0; i < ns; ++i)
{
tmp = get_nsec(src, "mouse", i);
cfg_set_sauv(tmp);
mb[i].tag = get_opt(tmp, "-1", "tag").num;
mb[i].screen = get_opt(tmp, "-1", "screen").num;
mb[i].button = char_to_button(get_opt(tmp, "1", "button").str, mouse_button_list);
mb[i].func = name_to_func(get_opt(tmp, "", "func").str, func_list);
mb[i].cmd = get_opt(tmp, "", "cmd").str;
cfg_set_sauv(src);
}
return;
}
void
conf_misc_section(char *src)
{
int pad = 12;
cfg_set_sauv(src);
conf.font = get_opt(src, "sans-9", "font").str;
conf.raisefocus = get_opt(src, "false", "raisefocus").bool;
conf.raiseswitch = get_opt(src, "false", "raiseswitch").bool;
conf.focus_fmouse = get_opt(src, "true", "focus_follow_mouse").bool;
conf.status_timing = get_opt(src, "1", "status_timing").num;
conf.status_path = get_opt(src, "", "status_path").str;
pad = get_opt(src, "12", "pad").num;
if(pad > 24 || pad < 1)
{
warnx("configuration : pad value (%d) incorrect.", pad);
pad = 12;
}
conf.pad = pad;
if(conf.status_timing <= 0)
{
warnx("configuration : status_timing value (%d) incorrect.", conf.status_timing);
conf.status_timing = 1;
}
return;
}
void
conf_bar_section(char *src)
{
cfg_set_sauv(src);
conf.border.bar = get_opt(src, "false", "border").bool;
conf.bars.height = get_opt(src, "-1", "height").num;
conf.colors.bar = getcolor(get_opt(src, "#000000", "bg").str);
conf.colors.text = get_opt(src, "#ffffff", "fg").str;
conf.bars.selbar = get_opt(src, "false", "selbar").bool;
if((conf.bars.nmouse = get_size_sec(src, "mouse")))
{
conf.bars.mouse = emalloc(conf.bars.nmouse, sizeof(MouseBinding));
mouse_section(conf.bars.mouse, src, conf.bars.nmouse);
}
return;
}
void
conf_root_section(char *src)
{
cfg_set_sauv(src);
conf.root.background_command = get_opt(src, "", "background_command").str;
if((conf.root.nmouse = get_size_sec(src, "mouse")))
{
conf.root.mouse = emalloc(conf.root.nmouse, sizeof(MouseBinding));
mouse_section(conf.root.mouse, src, conf.root.nmouse);
}
return;
}
void
conf_client_section(char *src)
{
int i, j, d;
char *tmp, *tmp2, *tmp3, *p;
opt_type *buf;
/* Client misc */
cfg_set_sauv(src);
conf.client.borderheight = (get_opt(src, "1", "border_height").num) ? get_opt(src, "1", "border_height").num : 1;
conf.client.border_shadow = get_opt(src, "false", "border_shadow").bool;
conf.client.place_at_mouse = get_opt(src, "false", "place_at_mouse").bool;
conf.client.bordernormal = getcolor(get_opt(src, "#000000", "border_normal").str);
conf.client.borderfocus = getcolor(get_opt(src, "#ffffff", "border_focus").str);
conf.client.resizecorner_normal = getcolor(get_opt(src, "#222222", "resize_corner_normal").str);
conf.client.resizecorner_focus = getcolor(get_opt(src, "#DDDDDD", "resize_corner_focus").str);
conf.client.mod |= char_to_modkey(get_opt(src, "Alt", "modifier").str, key_list);
conf.client.set_new_win_master = get_opt(src, "true", "set_new_win_master").bool;
if((conf.client.nmouse = get_size_sec(src, "mouse")))
{
conf.client.mouse = emalloc(conf.client.nmouse, sizeof(MouseBinding));
mouse_section(conf.client.mouse, src, conf.client.nmouse);
}
/* Titlebar part {{ */
tmp = get_sec(src, "titlebar");
cfg_set_sauv(tmp);
conf.titlebar.height = get_opt(tmp, "0", "height").num;
conf.titlebar.fg_normal = get_opt(tmp, "#ffffff", "fg_normal").str;
conf.titlebar.fg_focus = get_opt(tmp, "#000000", "fg_focus").str;
/* Stipple */
conf.titlebar.stipple.active = get_opt(tmp, "false", "stipple").bool;
if(!strcmp((p = get_opt(tmp, "-1", "stipple_normal").str), "-1"))
conf.titlebar.stipple.colors.normal = getcolor(conf.titlebar.fg_normal);
else
conf.titlebar.stipple.colors.normal = getcolor(p);
if(!strcmp((p = get_opt(tmp, "-1", "stipple_focus").str), "-1"))
conf.titlebar.stipple.colors.focus = getcolor(conf.titlebar.fg_focus);
else
conf.titlebar.stipple.colors.focus = getcolor(p);
if((conf.titlebar.nmouse = get_size_sec(tmp, "mouse")))
{
conf.titlebar.mouse = emalloc(conf.titlebar.nmouse, sizeof(MouseBinding));
mouse_section(conf.titlebar.mouse, tmp, conf.titlebar.nmouse);
}
/* Multi button part */
if((conf.titlebar.nbutton = get_size_sec(tmp, "button")))
{
conf.titlebar.button = emalloc(conf.titlebar.nbutton, sizeof(Button));
for(i = 0; i < conf.titlebar.nbutton; ++i)
{
tmp2 = get_nsec(tmp, "button", i);
cfg_set_sauv(tmp2);
tmp3 = get_opt(tmp2, "none", "flags").str;
conf.titlebar.button[i].flags = 0;
if(strstr(tmp3, "free"))
conf.titlebar.button[i].flags |= FreeFlag;
if(strstr(tmp3, "max"))
conf.titlebar.button[i].flags |= MaxFlag;
if(strstr(tmp3, "tile"))
conf.titlebar.button[i].flags |= TileFlag;
/* Multi mouse section */
if((conf.titlebar.button[i].nmouse = get_size_sec(tmp2, "mouse")))
{
conf.titlebar.button[i].mouse = emalloc(conf.titlebar.button[i].nmouse, sizeof(MouseBinding));
mouse_section(conf.titlebar.button[i].mouse, tmp2, conf.titlebar.button[i].nmouse);
}
/* Multi line section */
if((conf.titlebar.button[i].nlines = get_size_sec(tmp2, "line")))
{
conf.titlebar.button[i].linecoord = emalloc(conf.titlebar.button[i].nlines, sizeof(XSegment));
for(j = 0; j < conf.titlebar.button[i].nlines; ++j)
{
tmp3 = get_nsec(tmp2, "line", j);
cfg_set_sauv(tmp3);
buf = get_list_opt(tmp3, "{0, 0, 0, 0}", "coord", &d);
conf.titlebar.button[i].linecoord[j].x1 = buf[0].num;
conf.titlebar.button[i].linecoord[j].y1 = buf[1].num;
conf.titlebar.button[i].linecoord[j].x2 = buf[2].num;
conf.titlebar.button[i].linecoord[j].y2 = buf[3].num;
cfg_set_sauv(tmp2);
}
}
cfg_set_sauv(tmp);
}
}
/* }} */
return;
}
void
conf_layout_section(char *src)
{
int i;
char *tmp = NULL, *p;
/* Set conf.layout NULL for conf reload */
for(i = 0; i < NUM_OF_LAYOUT; ++i)
{
conf.layout[i].symbol = NULL;
conf.layout[i].func = NULL;
}
cfg_set_sauv(src);
conf.border.layout = get_opt(src, "false", "border").bool;
conf.colors.layout_fg = get_opt(src, "#ffffff", "fg").str;
conf.colors.layout_bg = getcolor((get_opt(src, "#000000", "bg").str));
if((tmp = get_opt(src, "menu", "system").str) && !strcmp(tmp, "menu"))
conf.layout_system = True;
if((tmp = get_opt(src, "right", "placement").str) && !strcmp(tmp, "left"))
conf.layout_placement = True;
conf.nlayout = get_size_sec(src, "layout");
if(conf.nlayout > NUM_OF_LAYOUT || !(conf.nlayout))
{
warnx("configuration : Too many or no layouts (%d).", conf.nlayout);
conf.nlayout = 1;
conf.layout[0].symbol = _strdup("TILE");
conf.layout[0].func = tile;
}
if(conf.layout_system && conf.nlayout > 1)
{
menu_init(&menulayout, "menulayout", conf.nlayout,
/* Colors */
conf.colors.layout_bg,
conf.colors.layout_fg,
conf.colors.bar,
conf.colors.text);
}
if(!conf.layout[0].symbol
&& !conf.layout[0].func)
{
for(i = 0; i < conf.nlayout; ++i)
{
tmp = get_nsec(src, "layout", i);
cfg_set_sauv(tmp);
if(!name_to_func((p = get_opt(tmp, "tile", "type").str), layout_list))
warnx("configuration : Unknown Layout type : \"%s\".", p);
else
{
if(conf.layout_system && conf.nlayout > 1)
menu_new_item(&menulayout.item[i], get_opt(tmp, "", "symbol").str,
uicb_set_layout, p);
conf.layout[i].symbol = get_opt(tmp, "TILE (default)", "symbol").str;
conf.layout[i].func = name_to_func(p, layout_list);
}
cfg_set_sauv(src);
}
}
return;
}
void
conf_tag_section(char *src)
{
int i, j, k, l = 0, m, n, sc;
char *cfgtmp, *tmp;
opt_type *buf;
/* If there is no tag in the conf or more than
* MAXTAG (32) print an error and create only one.
*/
Tag default_tag = { "WMFS", NULL, 0, 1,
0.50, 1, False, False, False, IB_Top,
layout_name_to_struct(conf.layout, "tile_right", conf.nlayout, layout_list) };
cfg_set_sauv(src);
conf.tag_round = get_opt(src, "false", "tag_round").bool;
conf.colors.tagselfg = get_opt(src, "#ffffff", "sel_fg").str;
conf.colors.tagselbg = getcolor(get_opt(src, "#000000", "sel_bg").str);
conf.colors.tag_occupied_bg = getcolor(get_opt(src, "#222222", "occupied_bg").str);
conf.border.tag = get_opt(src, "false", "border").bool;
sc = screen_count();
/* Alloc all */
conf.ntag = emalloc(sc, sizeof(int));
tags = emalloc(sc, sizeof(Tag*));
seltag = emalloc(sc, sizeof(int));
prevseltag = emalloc(sc, sizeof(int));
for(i = 0; i < sc; ++i)
seltag[i] = 1;
for(i = 0; i < sc; ++i)
tags[i] = emalloc(get_size_sec(src, "tag") + 2, sizeof(Tag));
for(i = 0; i < get_size_sec(src, "tag"); ++i)
{
/* printf("%d -> %s\n", i, (cfgtmp = get_nsec(src, "tag", i)));*/
cfgtmp = get_nsec(src, "tag", i);
cfg_set_sauv(cfgtmp);
j = get_opt(cfgtmp, "-1", "screen").num;
if(j < 0 || j > sc - 1)
j = -1;
for(k = ((j == -1) ? 0 : j);
((j == -1) ? (k < sc) : !l);
((j == -1) ? ++k : --l))
{
++conf.ntag[k];
tags[k][conf.ntag[k]].name = get_opt(cfgtmp, "", "name").str;
tags[k][conf.ntag[k]].mwfact = get_opt(cfgtmp, "0.65", "mwfact").fnum;
tags[k][conf.ntag[k]].nmaster = get_opt(cfgtmp, "1", "nmaster").num;
tags[k][conf.ntag[k]].resizehint = get_opt(cfgtmp, "false", "resizehint").bool;
tags[k][conf.ntag[k]].abovefc = get_opt(cfgtmp, "false", "abovefc").bool;
tags[k][conf.ntag[k]].layers = 1;
tmp = _strdup(get_opt(cfgtmp, "top", "infobar_position").str);
if(!strcmp(tmp ,"none") || !strcmp(tmp, "hide") || !strcmp(tmp, "hidden"))
tags[k][conf.ntag[k]].barpos = IB_Hide;
else if(!strcmp(tmp, "bottom") || !strcmp(tmp, "down"))
tags[k][conf.ntag[k]].barpos = IB_Bottom;
else
tags[k][conf.ntag[k]].barpos = IB_Top;
tags[k][conf.ntag[k]].layout = layout_name_to_struct(conf.layout,
get_opt(cfgtmp, "tile_right", "layout").str,
conf.nlayout,
layout_list);
/* Clients list */
buf = get_list_opt(cfgtmp, "", "clients", &n);
if(n)
{
tags[k][conf.ntag[k]].nclients = n;
tags[k][conf.ntag[k]].clients = emalloc(n, sizeof(char *));
for(m = 0; m < n; ++m)
tags[k][conf.ntag[k]].clients[m] = (buf[m].str) ? buf[m].str : NULL;
}
}
l = 0;
cfg_set_sauv(src);
}
for(i = 0; i < sc; ++i)
if(!conf.ntag[i] || conf.ntag[i] > MAXTAG)
{
warnx("configuration : Too many or no tag (%d) in the screen %d.", conf.ntag[i], i);
conf.ntag[i] = 1;
tags[i][1] = default_tag;
}
return;
}
void
conf_menu_section(char *src)
{
char *tmp, *tmp2;
int i, j;
cfg_set_sauv(src);
CHECK((conf.nmenu = get_size_sec(src, "set_menu")));
conf.menu = calloc(conf.nmenu, sizeof(Menu));
for(i = 0; i < conf.nmenu; ++i)
{
tmp = get_nsec(src, "set_menu", i);
cfg_set_sauv(tmp);
conf.menu[i].name = get_opt(tmp, "menu_wname", "name").str;
if(!(conf.menu[i].place_at_mouse = get_opt(tmp, "true", "place_at_mouse").bool))
{
conf.menu[i].x = get_opt(tmp, "0", "x").num;
conf.menu[i].y = get_opt(tmp, "0", "y").num;
}
conf.menu[i].colors.focus.bg = getcolor(get_opt(tmp, "#000000", "bg_focus").str);
conf.menu[i].colors.focus.fg = get_opt(tmp, "#ffffff", "fg_focus").str;
conf.menu[i].colors.normal.bg = getcolor(get_opt(tmp, "#000000", "bg_normal").str);
conf.menu[i].colors.normal.fg = get_opt(tmp, "#ffffff", "fg_normal").str;
if((conf.menu[i].nitem = get_size_sec(tmp, "item")))
{
conf.menu[i].item = emalloc(conf.menu[i].nitem, sizeof(MenuItem));
for(j = 0; j < get_size_sec(tmp, "item"); ++j)
{
tmp2 = get_nsec(tmp, "item", j);
cfg_set_sauv(tmp2);
conf.menu[i].item[j].name = get_opt(tmp2, "item_wname", "name").str;
conf.menu[i].item[j].func = name_to_func(get_opt(tmp2, "", "func").str, func_list);
conf.menu[i].item[j].cmd = (!get_opt(tmp2, "", "cmd").str) ? NULL : get_opt(tmp2, "", "cmd").str;
cfg_set_sauv(tmp);
}
}
cfg_set_sauv(src);
}
return;
}
void
conf_launcher_section(char *src)
{
int i;
char *tmp;
cfg_set_sauv(src);
CHECK((conf.nlauncher = get_size_sec(src, "set_launcher")));
conf.launcher = emalloc(conf.nlauncher, sizeof(Launcher));
for(i = 0; i < conf.nlauncher; ++i)
{
tmp = get_nsec(src, "set_launcher", i);
cfg_set_sauv(tmp);
conf.launcher[i].name = get_opt(tmp, "launcher", "name").str;
conf.launcher[i].prompt = get_opt(tmp, "Exec:", "prompt").str;
conf.launcher[i].command = get_opt(tmp, "exec", "command").str;
cfg_set_sauv(src);
}
return;
}
void
conf_keybind_section(char *src)
{
int i, j, n = 0;
char *tmp;
opt_type *buf;
cfg_set_sauv(src);
conf.nkeybind = get_size_sec(src, "key");
keys = emalloc(conf.nkeybind, sizeof(Key));
for(i = 0; i < conf.nkeybind; ++i)
{
tmp = get_nsec(src, "key", i);
cfg_set_sauv(tmp);
buf = get_list_opt(tmp, "", "mod", &n);
for(j = 0; j < n; ++j)
keys[i].mod |= char_to_modkey(buf[j].str, key_list);
keys[i].keysym = XStringToKeysym(get_opt(tmp, "None", "key").str);
keys[i].func = name_to_func(get_opt(tmp, "", "func").str, func_list);
if(keys[i].func == NULL)
{
warnx("configuration : Unknown Function \"%s\".", get_opt(tmp, "", "func").str);
keys[i].func = uicb_spawn;
}
keys[i].cmd = (!get_opt(tmp, "", "cmd").str) ? NULL : get_opt(tmp, "", "cmd").str;
cfg_set_sauv(src);
}
return;
}
/** Configuration initialization
*/
void
init_conf(void)
{
char *file;
if(!(file = file_to_str(conf.confpath)))
{
warnx("parsing configuration file (%s) failed.", conf.confpath);
sprintf(conf.confpath, "%s/wmfs/wmfsrc", XDG_CONFIG_DIR);
warnx("Use the default configuration (%s).", conf.confpath);
file = file_to_str(conf.confpath);
}
/* Set func_list */
func_list = emalloc(LEN(tmp_func_list), sizeof(func_name_list_t));
memcpy(func_list, tmp_func_list, LEN(tmp_func_list) * sizeof(func_name_list_t));
conf_section(conf_misc_section, file, "misc");
conf_section(conf_bar_section, file, "bar");
conf_section(conf_root_section, file, "root");
conf_section(conf_client_section, file, "client");
conf_section(conf_layout_section, file, "layouts");
conf_section(conf_tag_section, file, "tags");
conf_section(conf_menu_section, file, "menu");
conf_section(conf_launcher_section, file, "launcher");
conf_section(conf_keybind_section, file, "keys");
free(file);
return;
}
/** Simple wrapper for calling functions and free pointer
*/
static void
conf_section(void (*func)(char*), char *src, char *name)
{
char *sec;
sec = get_sec(src, name);
func(sec);
IFREE(sec);
return;
}
-50
View File
@@ -1,50 +0,0 @@
/*
* config.h
* Copyright © 2008 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "wmfs.h"
#define WMFS_VERSION "@WMFS_VERSION@"
#define WMFS_COMPILE_MACHINE "@WMFS_COMPILE_MACHINE@"
#define WMFS_COMPILE_BY "@WMFS_COMPILE_BY@"
#define WMFS_COMPILE_FLAGS "@WMFS_COMPILE_FLAGS@"
#define WMFS_LINKED_LIBS "@WMFS_LINKED_LIBS@"
#define XDG_CONFIG_DIR "@XDG_CONFIG_DIR@"
/* Optional dependencies */
@WMFS_HAVE_XINERAMA@
@WMFS_HAVE_XRANDR@
@WMFS_HAVE_IMLIB@
#endif /* CONFIG_H */
-289
View File
@@ -1,289 +0,0 @@
/*
* confparse.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "confparse.h"
char*
file_to_str(char *path)
{
char *buf, *ret, *p, *c;
int fd, i;
struct stat st;
Bool is_char = False;
if (!path)
return NULL;
if (!(fd = open(path, O_RDONLY)))
{
warn("%s", path);
return NULL;
}
/* Get the file size */
stat(path, &st);
/* Bufferize file */
if((buf = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, SEEK_SET)) == (char*) MAP_FAILED)
return NULL;
/* Copy buffer without comments in return value */
ret = emalloc(strlen(buf) + 1, sizeof(char));
for(p = buf, i = 0; *p != '\0'; p++)
{
if(!is_char && (c = strchr("\"'", *p)))
is_char = !is_char;
else if (is_char && *p == *c)
is_char = !is_char;
if(*p == COMMENT_CHAR && !is_char)
{
if(!(p = strchr(p, '\n')))
break;
ret[i++] = '\n';
}
else
ret[i++] = *p;
}
ret[i++] = '\0';
/* Unmap buffer, thanks linkdd. */
munmap(buf, st.st_size);
close(fd);
warnx("%s read.", path);
return ret;
}
char*
get_sec(char *src, char *name)
{
char *ret = NULL, *start, *end, *p;
char **sec;
size_t len;
if(!src)
return NULL;
if(!name)
return src;
sec = secname(name);
len = strlen(sec[SecStart]);
/* Find start section pointer */
for(start = src; *start != '\0'; start++)
{
if( (p = strchr("\"'", *start)) )
while (*(++start) && *start != *p);
if(!strncmp(start, sec[SecStart], len))
break;
}
if(*start != '\0')
{
/* Here is_char == False */
start += len;
/* Find end section pointer */
for(end = start; *end != '\0'; end++)
{
if( (p = strchr("\"'", *start)) )
while (*(++start) && *start != *p);
if(!strncmp(end, sec[SecEnd], len+1))
break;
}
/* Allocate and set ret */
if(end != '\0')
{
len = end - start;
ret = emalloc(len + 1, sizeof(char));
memcpy(ret, start, len);
ret[len] = '\0';
}
}
free_secname(sec);
return ret;
}
char*
get_nsec(char *src, char *name, int n)
{
int i;
char *ret, *buf, **sec;
if(!src || !strlen(src))
return NULL;
if(!name)
return src;
if(!n)
return get_sec(src, name);
sec = secname(name);
buf = _strdup(sauv_delimc);
for(i = 0; i < n && (buf = strstr(buf, sec[SecStart])); ++i, buf += strlen(sec[SecStart]));
ret = get_sec(src + strlen(src) - strlen(buf), name);
free_secname(sec);
return ret;
}
int
get_size_sec(char *src, char *name)
{
int ret;
char **sec, *buf;
if(!src || !name)
return 0;
sec = secname(name);
buf = _strdup(sauv_secc);
for(ret = 0; (buf = strstr(buf, sec[SecStart])); ++ret, buf += strlen(sec[SecStart]));
free_secname(sec);
return ret;
}
opt_type
get_opt(char *src, char *def, char *name)
{
int i;
char *p = NULL, *p2 = NULL;
opt_type ret = null_opt_type;
if(!src || !name)
return (def) ? str_to_opt(def) : ret;
if((p = opt_srch(sauv_secc, name)))
{
for(i = 0; p[i] && p[i] != '\n'; ++i);
p[i] = '\0';
p2 = _strdup(p + strlen(name));
if((p = strchr(p, '=')) && !is_in_delimiter(p, 0))
{
for(i = 0; p2[i] && p2[i] != '='; ++i);
p2[i] = '\0';
/* Check if there is anything else that spaces
* between option name and '=' */
for(i = 0; i < strlen(p2); ++i)
if(p2[i] != ' ')
{
warnx("Configuration warning: Missing '=' after option: '%s'"
" and before expression: '%s'\n", name, p2);
return str_to_opt(def);
}
ret = str_to_opt(clean_value(++p));
}
}
if(!ret.str)
ret = str_to_opt(def);
return ret;
}
/* option = {val1, val2, val3} */
opt_type*
get_list_opt(char *src, char *def, char *name, int *n)
{
int i, j;
char *p, *p2;
opt_type *ret;
if(!src || !name)
return NULL;
*n = 0;
if(!(p = get_opt(src, def, name).str))
return NULL;
for(i = 0; p[i] && (p[i] != LIST_DEL_E || is_in_delimiter(p, i)); ++i);
p[i + 1] = '\0';
/* Syntax of list {val1, val2, ..., valx} */
if(*p != LIST_DEL_S || *(p + strlen(p) - 1) != LIST_DEL_E)
return NULL;
/* Erase ( ) */
++p;
*(p + strlen(p) - 1) = '\0';
/* > 1 value in list */
if(strchr(p, ','))
{
/* Count ',' */
for(i = 0, *n = 1; i < strlen(p); ++i)
if(p[i] == ',' && !is_in_delimiter(p, i))
++(*n);
ret = emalloc(*n, sizeof(opt_type));
p2 = _strdup(p);
/* Set all value in return array */
for(i = j = 0; i < *n; ++i, p2 += ++j)
{
for(j = 0; j < strlen(p2) && (p2[j] != ',' || is_in_delimiter(p2, j)); ++j);
p2[j] = '\0';
ret[i] = str_to_opt(clean_value(p2));
}
}
else
{
ret = emalloc((*n = 1), sizeof(opt_type));
*ret = str_to_opt(clean_value(p));
}
return ret;
}
-87
View File
@@ -1,87 +0,0 @@
/*
* confparse.h
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CONFPARSE_H
#define CONFPARSE_H
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "../wmfs.h"
/* Section delimiter */
#define SEC_DEL_S '['
#define SEC_DEL_E ']'
/* List delimiter */
#define LIST_DEL_S '{'
#define LIST_DEL_E '}'
/* Comment character */
#define COMMENT_CHAR '#'
enum { SecStart, SecEnd, SecLast };
typedef struct
{
long int num;
float fnum;
Bool bool;
char *str;
} opt_type;
/* util.c */
char *erase_delim_content(char *buf);
Bool is_in_delimiter(char *buf, int p);
char *erase_sec_content(char *buf);
char *opt_srch(char *buf, char *opt);
opt_type str_to_opt(char *str);
char *clean_value(char *str);
void cfg_set_sauv(char *str);
char **secname(char *name);
void free_secname(char **secname);
/* confparse.c */
char *file_to_str(char *path);
char *get_sec(char *src, char *name);
char *get_nsec(char *src, char *name, int n);
int get_size_sec(char *src, char *name);
opt_type get_opt(char *src, char *def, char *name);
opt_type *get_list_opt(char *src, char *def, char *name, int *n);
static const opt_type null_opt_type = {0, 0, 0, NULL};
char *sauv_delimc;
char *sauv_secc;
#endif /* CONFPARSE_H */
-220
View File
@@ -1,220 +0,0 @@
/*
* confparse/util.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "confparse.h"
char*
erase_delim_content(char *buf)
{
int i, j;
char *str, c;
if(!buf || !(str = _strdup(buf)))
return NULL;
for(i = 0; i < strlen(str); ++i)
if(strchr("\"'", (c = str[i])))
{
for(*(str + (j = i)) = ' '; str[j] && str[j] != c; str[j++] = ' ');
str[j] = ' ';
}
return str;
}
/* Erase all content of all delimiters, put it
* int str, and check if buf[p] is in an delimiter. */
Bool
is_in_delimiter(char *buf, int p)
{
if(*(erase_delim_content(buf) + p) != buf[p])
return True;
return False;
}
char*
erase_sec_content(char *buf)
{
int i, j;
char *p, *str, *name, *ret;
char **sec;
if(!buf || !(str = _strdup(sauv_delimc)))
return NULL;
ret = _strdup(buf);
for(i = 1, name = _strdup(str + i); strchr(str + i, SEC_DEL_S); ++i, name = _strdup(str + i))
{
for(; str[i] && str[i] != SEC_DEL_S; ++i);
for(j = 0; str[i] && str[i] != SEC_DEL_E; name[j++] = str[i++]);
++name;
name[j - 1] = '\0';
if(*name == '/')
continue;
sec = secname(name);
if((p = strstr(str + i, sec[SecEnd])))
for(++i; i < strlen(ret) - strlen(p); ret[i++] = ' ');
else
break;
}
free_secname(sec);
return ret;
}
/* To get the RIGHT name of an option; if option needed is
* pwet and there is tagadapwettagada in the configuration,
* with strstr(), the name will matchs */
char*
opt_srch(char *buf, char *opt)
{
char *p;
if(!buf || !opt)
return NULL;
if((p = strstr(sauv_delimc /*erase_delim_content(buf)*/, opt)))
if((*(p + strlen(opt)) == ' ' || *(p + strlen(opt)) == '=')
&& (*(p - 1) == ' ' || *(p - 1) == '\n' || *(p - 1) == '\t' || !(*(p - 1))))
return _strdup(buf + (strlen(buf) - strlen(p)));
return NULL;
}
opt_type
str_to_opt(char *str)
{
opt_type ret = null_opt_type;
if(!strlen(str))
return ret;
/* Integer */
ret.num = atoi(str);
/* Float */
sscanf(str, "%f", &ret.fnum);
/* Boolean */
if(strstr(str, "true") || strstr(str, "True")
|| strstr(str, "TRUE") || strstr(str, "1"))
ret.bool = True;
/* String */
ret.str = _strdup(str);
return ret;
}
char*
clean_value(char *str)
{
int i;
char c, *p;
if(!str || !(p = _strdup(str)))
return NULL;
/* Remove useless spaces */
for(; *p == ' '; ++p);
for(; *(p + strlen(p) - 1) == ' '; *(p + strlen(p) - 1) = '\0');
/* For string delimiter (" or ') */
if(((c = *p) == '"' || (c = *p) == '\'') && strchr(p + 1, c))
{
for(++p, i = 0; p[i] && p[i] != c; ++i);
p[i] = '\0';
}
return p;
}
void
cfg_set_sauv(char *str)
{
if(!str)
{
sauv_delimc = NULL;
sauv_secc = NULL;
return;
}
sauv_delimc = erase_delim_content(_strdup(str));
sauv_secc = erase_sec_content(_strdup(str));
return;
}
char**
secname(char *name)
{
char **ret = NULL;
if(!name)
return NULL;
ret = emalloc(SecLast, sizeof(char*));
/* Len of name + '[' + ']' + '\0' */
ret[SecStart] = emalloc(strlen(name) + 3, sizeof(char));
/* Len of name + '[' + '/' + ']' + '\0' */
ret[SecEnd] = emalloc(strlen(name) + 4, sizeof(char));
sprintf(ret[SecStart], "%c%s%c", SEC_DEL_S, name, SEC_DEL_E);
sprintf(ret[SecEnd], "%c/%s%c", SEC_DEL_S, name, SEC_DEL_E);
return ret;
}
void
free_secname(char **secname)
{
if(!secname || LEN(secname) != SecLast)
return;
if(secname[SecStart])
free(secname[SecStart]);
if(secname[SecEnd])
free(secname[SecEnd]);
free(secname);
return;
}
-189
View File
@@ -1,189 +0,0 @@
/*
* draw.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Draw a string in a Drawable
* \param d Drawable
* \param x X position
* \param y Y position
* \param fg Foreground text color
* \param pad Text padding
* \param str String that will be draw
*/
void
draw_text(Drawable d, int x, int y, char* fg, int pad, char *str)
{
XftColor xftcolor;
XftDraw *xftd;
if(!str)
return;
/* To draw image everywhere we can draw text */
#ifdef HAVE_IMLIB
char *ostr = NULL;
int i, ni;
ImageAttr im[128];
ostr = _strdup(str);
if(strstr(str, "i["))
{
ni = parse_image_block(im, str);
for(i = 0; i < ni; ++i)
draw_image(d, im[i].x, im[i].y, im[i].w, im[i].h, im[i].name);
}
#endif /* HAVE_IMLIB */
/* Transform X Drawable -> Xft Drawable */
xftd = XftDrawCreate(dpy, d, DefaultVisual(dpy, SCREEN), DefaultColormap(dpy, SCREEN));
/* Alloc text color */
XftColorAllocName(dpy, DefaultVisual(dpy, SCREEN),
DefaultColormap(dpy, SCREEN), fg, &xftcolor);
XftDrawStringUtf8(xftd, &xftcolor, font, x, y, (FcChar8 *)str, strlen(str));
/* Free the text color and XftDraw */
XftColorFree(dpy, DefaultVisual(dpy, SCREEN), DefaultColormap(dpy, SCREEN), &xftcolor);
XftDrawDestroy(xftd);
#ifdef HAVE_IMLIB
if(strstr(ostr, "i["))
strcpy(str, ostr);
IFREE(ostr);
#endif /* HAVE_IMLIB */
return;
}
/** Draw a Rectangle in a drawable
* \param dr Drawable
* \param x X position
* \param y Y position
* \param w Width
* \param h Height
* \param color Color of the rectangle
*/
void
draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color)
{
XRectangle r = { x, y, w, h };
XSetForeground(dpy, gc, color);
XFillRectangles(dpy, dr, gc, &r, 1);
return;
}
#ifdef HAVE_IMLIB
/** Draw an image in a drawable
* \param dr Drawable
* \param x X position
* \param y Y position
* \param name Path of the image
*/
void
draw_image(Drawable dr, int x, int y, int w, int h, char *name)
{
Imlib_Image image;
if(!name)
return;
imlib_set_cache_size(2048 * 1024);
imlib_context_set_display(dpy);
imlib_context_set_visual(DefaultVisual(dpy, DefaultScreen(dpy)));
imlib_context_set_colormap(DefaultColormap(dpy, DefaultScreen(dpy)));
imlib_context_set_drawable(dr);
image = imlib_load_image(name);
imlib_context_set_image(image);
if(w <= 0)
w = imlib_image_get_width();
if(h <= 0)
h = imlib_image_get_height();
if(image)
{
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
else
warnx("Can't draw image: '%s'", name);
return;
}
#endif /* HAVE_IMLIB */
/** Calculates the text's size relatively to the font
* \param text Text string
* \return final text width
*/
ushort
textw(char *text)
{
XGlyphInfo gl;
if(!text)
return 0;
#ifdef HAVE_IMLIB
char *ostr = NULL;
ImageAttr im[128];
ostr = _strdup(text);
if(strstr(text, "i["))
parse_image_block(im, text);
#endif /* HAVE_IMLIB */
XftTextExtentsUtf8(dpy, font, (FcChar8 *)text, strlen(text), &gl);
#ifdef HAVE_IMLIB
if(strstr(ostr, "i["))
strcpy(text, ostr);
IFREE(ostr);
#endif /* HAVE_IMLIB */
return gl.width + font->descent;
}
-578
View File
@@ -1,578 +0,0 @@
/*
* event.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** ButtonPress handle event
* \param ev XButtonEvent pointer
*/
void
buttonpress(XButtonEvent *ev)
{
Client *c;
int i, j, n;
screen_get_sel();
/* If the mouse is on a not selected client and you click on it. */
if(((c = client_gb_win(ev->window)) || (c = client_gb_titlebar(ev->window))) && c != sel
&& (ev->button == Button1 || ev->button == Button2 || ev->button == Button3))
{
client_focus(c);
client_raise(c);
}
/* Titlebar */
if((c = client_gb_titlebar(ev->window)) && c == sel)
for(i = 0; i < conf.titlebar.nmouse; ++i)
if(ev->button == conf.titlebar.mouse[i].button)
if(conf.titlebar.mouse[i].func)
conf.titlebar.mouse[i].func(conf.titlebar.mouse[i].cmd);
/* Titlebar buttons */
if((c = client_gb_button(ev->window, &n)))
for(i = 0; i < conf.titlebar.button[n].nmouse; ++i)
if(ev->button == conf.titlebar.button[n].mouse[i].button)
if(conf.titlebar.button[n].mouse[i].func)
conf.titlebar.button[n].mouse[i].func(conf.titlebar.button[n].mouse[i].cmd);
/* Frame Resize Area */
if((c = client_gb_resize(ev->window)))
mouse_resize(c);
/* Client */
if((c = client_gb_win(ev->window)) && c == sel)
for(i = 0; i < conf.client.nmouse; ++i)
if(ev->button == conf.client.mouse[i].button)
if(conf.client.mouse[i].func)
conf.client.mouse[i].func(conf.client.mouse[i].cmd);
/* Root */
if(ev->window == ROOT)
for(i = 0; i < conf.root.nmouse; ++i)
if(conf.root.mouse[i].tag == seltag[conf.root.mouse[i].screen]
|| conf.root.mouse[i].tag < 0)
if(ev->button == conf.root.mouse[i].button)
if(conf.root.mouse[i].func)
conf.root.mouse[i].func(conf.root.mouse[i].cmd);
/* Infobars */
for(i = 0; i < screen_count(); ++i)
if(ev->window == infobar[i].bar->win)
for(j = 0; j < conf.bars.nmouse; ++j)
if(conf.bars.mouse[j].screen == i
|| conf.bars.mouse[j].screen < 0)
if(conf.bars.mouse[j].tag == seltag[i]
|| conf.bars.mouse[j].tag < 0)
if(ev->button == conf.bars.mouse[j].button)
if(conf.bars.mouse[j].func)
conf.bars.mouse[j].func(conf.bars.mouse[j].cmd);
/* Tags */
for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
if(ev->window == infobar[selscreen].tags[i]->win)
switch(ev->button)
{
case Button1: tag_set(i); break;
case Button3: tag_transfert(sel, i); break;
case Button4: tag_set(seltag[selscreen] + 1); break;
case Button5: tag_set(seltag[selscreen] - 1); break;
}
/* Layout button */
if(ev->window == infobar[selscreen].layout_button->win && conf.nlayout > 1)
{
if(conf.layout_system && (ev->button == Button1 || ev->button == Button3)) /* True -> menu */
{
menulayout.y = spgeo[selscreen].y + infobar[selscreen].layout_button->geo.y + INFOBARH;
menulayout.x = infobar[selscreen].layout_button->geo.x + (sgeo[selscreen].x - BORDH);
if(infobar[selscreen].geo.y != spgeo[selscreen].y)
menulayout.y = infobar[selscreen].geo.y - (INFOBARH * menulayout.nitem) - SHADH;
uicb_menu("menulayout");
}
else
{
switch(ev->button)
{
case Button1: case Button4: layoutswitch(True); break;
case Button3: case Button5: layoutswitch(False); break;
}
}
}
return;
}
/* ClientMessage handle event
*\param ev XClientMessageEvent pointer
*/
void
clientmessageevent(XClientMessageEvent *ev)
{
Client *c;
int s, i, mess_t = 0;
Atom rt;
int rf;
ulong ir, il;
uchar *ret = NULL;
uchar *ret_cmd = NULL;
void (*func)(uicb_t);
if(ev->format != 32)
return;
s = screen_count();
for(i = 0; i < net_last + s; ++i)
if(net_atom[i] == ev->message_type)
mess_t = i;
if(ev->window == ROOT)
{
/* Manage _NET_CURRENT_DESKTOP */
if(mess_t == net_current_desktop
&& ev->data.l[0] >= 0
&& ev->data.l[0] < conf.ntag[selscreen])
tag_set((int)(ev->data.l[0] + 1));
/* Manage _WMFS_SET_SCREEN */
if(mess_t == wmfs_set_screen
&& ev->data.l[0] >= 0
&& ev->data.l[0] <= s)
screen_set_sel((int)(ev->data.l[0]));
/* Manage _NET_ACTIVE_WINDOW */
else if(mess_t == net_active_window)
if((c = client_gb_win(ev->window)))
client_focus(c);
}
/* Manage _NET_WM_STATE */
if(mess_t == net_wm_state)
if((c = client_gb_win(ev->window)))
ewmh_manage_net_wm_state(ev->data.l, c);
/* Manage _NET_CLOSE_WINDOW */
if(mess_t == net_close_window)
if((c = client_gb_win(ev->window)))
client_kill(c);
/* Manage _NET_WM_DESKTOP */
if(mess_t == net_wm_desktop)
if((c = client_gb_win(ev->window)))
tag_transfert(c, ev->data.l[0]);
/* Manage _WMFS_STATUSTEXT_x */
if(mess_t >= wmfs_statustext && ev->data.l[4] == True)
{
if(XGetWindowProperty(dpy, ROOT, net_atom[mess_t], 0, 4096,
False, net_atom[utf8_string], &rt, &rf, &ir, &il, &ret) == Success)
{
statustext_handle(mess_t - wmfs_statustext, (char*)ret);
XFree(ret);
}
}
/* Manage _WMFS_FUNCTION && _WMFS_CMD */
if((mess_t == wmfs_function && ev->data.l[4] == True)
|| (mess_t == wmfs_cmd && ev->data.l[4] == True))
{
XGetWindowProperty(dpy, ROOT, net_atom[wmfs_function], 0, 4096,
False, net_atom[utf8_string], &rt, &rf, &ir, &il, &ret);
XGetWindowProperty(dpy, ROOT, net_atom[wmfs_cmd], 0, 4096,
False, net_atom[utf8_string], &rt, &rf, &ir, &il, &ret_cmd);
if((func = name_to_func((char*)ret, func_list)))
func((uicb_t)ret_cmd);
XFree(ret_cmd);
XFree(ret);
}
/* Manage _WMFS_UPDATE_HINTS */
if(mess_t == wmfs_update_hints)
{
ewmh_get_number_of_desktop();
ewmh_update_current_tag_prop();
ewmh_get_client_list();
ewmh_get_desktop_names();
ewmh_set_desktop_geometry();
ewmh_set_workarea();
screen_count();
screen_get_sel();
}
if(mess_t == wmfs_update_status
&& estatus)
spawn(conf.status_path);
return;
}
/** ConfigureRequest & ConfigureNotify handle events
* \param ev XEvent pointer
*/
void
configureevent(XConfigureRequestEvent *ev)
{
XWindowChanges wc;
Client *c;
/* Check part */
if((c = client_gb_win(ev->window))
|| (c = client_gb_win(ev->window)))
{
CHECK(!(c->flags & TileFlag));
CHECK(!(c->flags & LMaxFlag));
CHECK(!(c->flags & MaxFlag));
CHECK(!(c->flags & FSSFlag));
}
if((c = client_gb_win(ev->window)))
{
if(ev->value_mask & CWX)
c->geo.x = ev->x + BORDH;
if(ev->value_mask & CWY)
c->geo.y = ev->y + TBARH;
if(ev->value_mask & CWWidth)
c->geo.width = ev->width;
if(ev->value_mask & CWHeight)
c->geo.height = ev->height;
if(c->flags & FreeFlag)
client_moveresize(c, c->geo, False);
}
else
{
wc.x = ev->x;
wc.y = ev->y;
wc.width = ev->width;
wc.height = ev->height;
wc.border_width = ev->border_width;
wc.sibling = ev->above;
wc.stack_mode = ev->detail;
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
}
return;
}
/** DestroyNotify handle event
* \param ev XDestroyWindowEvent pointer
*/
void
destroynotify(XDestroyWindowEvent *ev)
{
Client *c;
if((c = client_gb_win(ev->window)))
{
client_unmanage(c);
XSetErrorHandler(errorhandler);
}
return;
}
/** EnterNotify handle event
* \param ev XCrossingEvent pointer
*/
void
enternotify(XCrossingEvent *ev)
{
Client *c;
int n;
if((ev->mode != NotifyNormal
|| ev->detail == NotifyInferior)
&& ev->window != ROOT)
return;
if(conf.focus_fmouse)
{
if((c = client_gb_win(ev->window))
|| (c = client_gb_frame(ev->window))
|| (c = client_gb_titlebar(ev->window))
|| (c = client_gb_button(ev->window, &n)))
client_focus(c);
else
client_focus(NULL);
}
return;
}
/** ExposeEvent handle event
* \param ev XExposeEvent pointer
*/
void
expose(XExposeEvent *ev)
{
Client *c;
int i, sc;
/* InfoBar member */
for(sc = 0; sc < screen_count(); ++sc)
{
if(ev->window == infobar[sc].bar->win)
barwin_refresh(infobar[sc].bar);
if(ev->window == infobar[sc].layout_button->win)
barwin_refresh(infobar[sc].layout_button);
if(conf.bars.selbar && ev->window == infobar[sc].selbar->win)
barwin_refresh(infobar[sc].selbar);
for(i = 1; i < conf.ntag[sc] + 1; ++i)
if(ev->window == infobar[sc].tags[i]->win)
barwin_refresh(infobar[sc].tags[i]);
}
/* Client frame */
if((c = client_gb_titlebar(ev->window)))
frame_update(c);
return;
}
/** FocusChange handle event
* \param ev XFocusChangeEvent pointer
* \return
*/
void
focusin(XFocusChangeEvent *ev)
{
if(sel && ev->window != sel->win)
client_focus(sel);
return;
}
/** Key grabbing function
*/
void
grabkeys(void)
{
uint i;
KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, ROOT);
for(i = 0; i < conf.nkeybind; ++i)
{
code = XKeysymToKeycode(dpy, keys[i].keysym);
XGrabKey(dpy, code, keys[i].mod, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
}
return;
}
/** KeyPress handle event
* \param ev XKeyPressedEvent pointer
*/
void
keypress(XKeyPressedEvent *ev)
{
uint i;
KeySym keysym;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < conf.nkeybind; ++i)
if(keysym == keys[i].keysym
&& (keys[i].mod & ~(numlockmask | LockMask))
== (ev->state & ~(numlockmask | LockMask))
&& keys[i].func)
keys[i].func(keys[i].cmd);
return;
}
/** MapNotify handle event
* \param ev XMappingEvent pointer
*/
void
mappingnotify(XMappingEvent *ev)
{
if(ev->request == MappingKeyboard)
grabkeys();
return;
}
/** MapRequest handle event
* \param ev XMapRequestEvent pointer
*/
void
maprequest(XMapRequestEvent *ev)
{
XWindowAttributes at;
Client *c;
CHECK(XGetWindowAttributes(dpy, ev->window, &at));
CHECK(!at.override_redirect);
if(!(c = client_gb_win(ev->window)))
client_manage(ev->window, &at, True);
return;
}
/** PropertyNotify handle event
* \param ev XPropertyEvent pointer
*/
void
propertynotify(XPropertyEvent *ev)
{
Client *c;
Window trans;
if(ev->state == PropertyDelete)
return;
if((c = client_gb_win(ev->window)))
{
switch(ev->atom)
{
default: break;
case XA_WM_TRANSIENT_FOR:
XGetTransientForHint(dpy, c->win, &trans);
if((c->flags & TileFlag || c->flags & MaxFlag))
if(((c->flags & HintFlag && (client_gb_win(trans) != NULL)))
|| (!(c->flags & HintFlag && (client_gb_win(trans) != NULL))))
arrange(c->screen, True);
break;
case XA_WM_NORMAL_HINTS:
client_size_hints(c);
break;
case XA_WM_NAME:
client_get_name(c);
break;
}
if(ev->atom == net_atom[net_wm_name])
client_get_name(c);
}
return;
}
/** UnmapNotify handle event
* \param ev XUnmapEvent pointer
*/
void
unmapnotify(XUnmapEvent *ev)
{
Client *c;
if((c = client_gb_win(ev->window))
&& ev->send_event
&& !(c->flags & HideFlag))
{
client_unmanage(c);
XSetErrorHandler(errorhandler);
}
return;
}
/** Send a client event
*\param data Event data
*\param atom_name Event atom name
*/
void
send_client_event(long data[5], char *atom_name)
{
XEvent ev;
int i;
ev.xclient.type = ClientMessage;
ev.xclient.serial = 0;
ev.xclient.send_event = True;
ev.xclient.message_type = ATOM(atom_name);
ev.xclient.window = ROOT;
ev.xclient.format = 32;
for(i = 0; i < 5; ++i, ev.xclient.data.l[i] = data[i]);
XSendEvent(dpy, ROOT, False, SubstructureRedirectMask | SubstructureNotifyMask, &ev);
XSync(dpy, False);
return;
}
/** Event handle function: execute every function
* handle by event
* \param ev Event
*/
void
getevent(XEvent ev)
{
switch(ev.type)
{
case ButtonPress: buttonpress(&ev.xbutton); break;
case ClientMessage: clientmessageevent(&ev.xclient); break;
case ConfigureRequest: configureevent(&ev.xconfigurerequest); break;
case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
case EnterNotify: enternotify(&ev.xcrossing); break;
case Expose: expose(&ev.xexpose); break;
case FocusIn: focusin(&ev.xfocus); break;
case KeyPress: keypress(&ev.xkey); break;
case MapRequest: maprequest(&ev.xmaprequest); break;
case MappingNotify: mappingnotify(&ev.xmapping); break;
case PropertyNotify: propertynotify(&ev.xproperty); break;
case UnmapNotify: unmapnotify(&ev.xunmap); break;
default:
#ifdef HAVE_XRANDR
/* Check Xrandr event */
if(ev.type == xrandr_event)
{
/* Update xrandr configuration */
XRRUpdateConfiguration(&ev);
/* Reload WMFS to update the screen(s) geometry changement */
quit();
for(; argv_global[0] && argv_global[0] == ' '; ++argv_global);
execlp(argv_global, argv_global, NULL);
}
#endif /* HAVE_XRANDR */
break;
}
wait((int[]){0});
return;
}
-398
View File
@@ -1,398 +0,0 @@
/*
* ewmh.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/* Taken From standards.freedesktop.org */
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
/** Init ewmh atoms
*/
void
ewmh_init_hints(void)
{
int i = 1, s, j, showing_desk = 0;
char root_name[] = WMFS_VERSION;
char class[] = "wmfs", st[64];
long pid = (long)getpid();
s = screen_count();
net_atom = emalloc(net_last + s, sizeof(Atom));
/* EWMH hints */
net_atom[net_supported] = ATOM("_NET_SUPPORTED");
net_atom[net_client_list] = ATOM("_NET_CLIENT_LIST");
net_atom[net_frame_extents] = ATOM("_NET_FRAME_EXTENTS");
net_atom[net_number_of_desktops] = ATOM("_NET_NUMBER_OF_DESKTOPS");
net_atom[net_current_desktop] = ATOM("_NET_CURRENT_DESKTOP");
net_atom[net_desktop_names] = ATOM("_NET_DESKTOP_NAMES");
net_atom[net_desktop_geometry] = ATOM("_NET_DESKTOP_GEOMETRY");
net_atom[net_workarea] = ATOM("_NET_WORKAREA");
net_atom[net_active_window] = ATOM("_NET_ACTIVE_WINDOW");
net_atom[net_close_window] = ATOM("_NET_CLOSE_WINDOW");
net_atom[net_wm_name] = ATOM("_NET_WM_NAME");
net_atom[net_wm_pid] = ATOM("_NET_WM_PID");
net_atom[net_wm_desktop] = ATOM("_NET_WM_DESKTOP");
net_atom[net_showing_desktop] = ATOM("_NET_SHOWING_DESKTOP");
net_atom[net_wm_icon_name] = ATOM("_NET_WM_ICON_NAME");
net_atom[net_wm_window_type] = ATOM("_NET_WM_WINDOW_TYPE");
net_atom[net_supporting_wm_check] = ATOM("_NET_SUPPORTING_WM_CHECK");
net_atom[net_wm_window_type_normal] = ATOM("_NET_WM_WINDOW_TYPE_NORMAL");
net_atom[net_wm_window_type_dock] = ATOM("_NET_WM_WINDOW_TYPE_DOCK");
net_atom[net_wm_window_type_splash] = ATOM("_NET_WM_WINDOW_TYPE_SPLASH");
net_atom[net_wm_window_type_dialog] = ATOM("_NET_WM_WINDOW_TYPE_DIALOG");
net_atom[net_wm_icon] = ATOM("_NET_WM_ICON");
net_atom[net_wm_state] = ATOM("_NET_WM_STATE");
net_atom[net_wm_state_fullscreen] = ATOM("_NET_WM_STATE_FULLSCREEN");
net_atom[net_wm_state_demands_attention] = ATOM("_NET_WM_STATE_DEMANDS_ATTENTION");
net_atom[utf8_string] = ATOM("UTF8_STRING");
/* WMFS hints */
net_atom[wmfs_running] = ATOM("_WMFS_RUNNING");
net_atom[wmfs_update_hints] = ATOM("_WMFS_UPDATE_HINTS");
net_atom[wmfs_update_status] = ATOM("_WMFS_UPDATE_STATUS");
net_atom[wmfs_set_screen] = ATOM("_WMFS_SET_SCREEN");
net_atom[wmfs_screen_count] = ATOM("_WMFS_SCREEN_COUNT");
net_atom[wmfs_current_tag] = ATOM("_WMFS_CURRENT_TAG");
net_atom[wmfs_tag_list] = ATOM("_WMFS_TAG_LIST");
net_atom[wmfs_current_screen] = ATOM("_WMFS_CURRENT_SCREEN");
net_atom[wmfs_current_layout] = ATOM("_WMFS_CURRENT_LAYOUT");
net_atom[wmfs_mwfact] = ATOM("_WMFS_MWFACT");
net_atom[wmfs_nmaster] = ATOM("_WMFS_NMASTER");
net_atom[wmfs_function] = ATOM("_WMFS_FUNCTION");
net_atom[wmfs_cmd] = ATOM("_WMFS_CMD");
/* Multi atom _WMFS_STATUSTEXT_<screennum> */
for(j = 0; j < s; ++j)
{
sprintf(st, "_WMFS_STATUSTEXT_%d", j);
net_atom[wmfs_statustext + j] = ATOM(st);
}
XChangeProperty(dpy, ROOT, net_atom[net_supported], XA_ATOM, 32,
PropModeReplace, (uchar*)net_atom, net_last + s);
XChangeProperty(dpy, ROOT, net_atom[wmfs_running], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&i, 1);
/* Set _NET_SUPPORTING_WM_CHECK */
XChangeProperty(dpy, ROOT, net_atom[net_supporting_wm_check], XA_WINDOW, 32,
PropModeReplace, (uchar*)&ROOT, 1);
XChangeProperty(dpy, ROOT, net_atom[net_wm_name], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)&root_name, strlen(root_name));
XChangeProperty(dpy, ROOT, ATOM("WM_CLASS"), XA_STRING, 8,
PropModeReplace, (uchar*)&class, strlen(class));
/* Set _NET_WM_PID */
XChangeProperty(dpy, ROOT, net_atom[net_wm_pid], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&pid, 1);
/* Set _NET_SHOWING_DESKTOP */
XChangeProperty(dpy, ROOT, net_atom[net_showing_desktop], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&showing_desk, 1);
return;
}
/** Get the number of desktop (tag)
*/
void
ewmh_get_number_of_desktop(void)
{
int c = 0, i;
for(i = 0; i < screen_count(); ++i)
c += conf.ntag[i];
XChangeProperty(dpy, ROOT, net_atom[net_number_of_desktops], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&c, 1);
return;
}
/** Get the current desktop
*/
void
ewmh_update_current_tag_prop(void)
{
int t;
char *s = NULL;
screen_get_sel();
t = seltag[selscreen] - 1;
s = emalloc(8, sizeof(char));
/* Get current desktop (tag) */
XChangeProperty(dpy, ROOT, net_atom[net_current_desktop], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&t, 1);
/* Current tag name */
XChangeProperty(dpy, ROOT, net_atom[wmfs_current_tag], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].name,
strlen(tags[selscreen][seltag[selscreen]].name));
sprintf(s, "%.3f", tags[selscreen][t + 1].mwfact);
/* Current tag mwfact */
XChangeProperty(dpy, ROOT, net_atom[wmfs_mwfact], XA_STRING, 8,
PropModeReplace, (uchar*)s, strlen(s));
/* Current nmaster */
XChangeProperty(dpy, ROOT, net_atom[wmfs_nmaster], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&tags[selscreen][t + 1].nmaster, 1);
/* Current layout */
XChangeProperty(dpy, ROOT, net_atom[wmfs_current_layout], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].layout.symbol,
strlen(tags[selscreen][seltag[selscreen]].layout.symbol));
free(s);
return;
}
/** Get _NET_CLIENT_LIST
*/
void
ewmh_get_client_list(void)
{
Window *list;
Client *c;
int win_n;
for(win_n = 0, c = clients; c; c = c->next, ++win_n);
list = emalloc(win_n, sizeof(Window));
for(win_n = 0, c = clients; c; c = c->next, ++win_n)
list[win_n] = c->win;
XChangeProperty(dpy, ROOT, net_atom[net_client_list], XA_WINDOW, 32,
PropModeReplace, (uchar *)list, win_n);
free(list);
return;
}
/** The desktop names
*/
void
ewmh_get_desktop_names(void)
{
char *str = NULL;
int S, s, i, len = 0, pos = 0;
S = screen_count();
for(s = 0 ; s < S; ++s)
for(i = 1; i < conf.ntag[s] + 1; ++i)
len += strlen(tags[s][i].name);
str = emalloc(len + i + 1, sizeof(char*));
for(s = 0; s < S; ++s)
for(i = 1; i < conf.ntag[s] + 1; ++i, ++pos)
{
strncpy(str + pos, tags[s][i].name, strlen(tags[s][i].name));
pos += strlen(tags[s][i].name);
str[pos] = '\0';
}
XChangeProperty(dpy, ROOT, net_atom[net_desktop_names], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)str, pos);
for(i = 0; i < pos; ++i)
if(str[i] == '\0' && i < pos - 1)
str[i] = ' ';
XChangeProperty(dpy, ROOT, net_atom[wmfs_tag_list], net_atom[utf8_string], 8,
PropModeReplace, (uchar*)str, pos);
free(str);
return;
}
/** Manage _NET_DESKTOP_GEOMETRY
*/
void
ewmh_set_desktop_geometry(void)
{
long data[2] = { MAXW, MAXH };
XChangeProperty(dpy, ROOT, net_atom[net_desktop_geometry], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&data, 2);
return;
}
/** Manage _NET_WORKAREA
*/
void
ewmh_set_workarea(void)
{
long *data;
int i, s, j, tag_c = 0, pos = 0;
s = screen_count();
for(i = 0; i < s; ++i)
tag_c += conf.ntag[i];
data = emalloc(tag_c * 4, sizeof(long));
for(i = 0; i < s; ++i)
for(j = 0; j < conf.ntag[i]; ++j)
{
data[pos++] = spgeo[i].x;
data[pos++] = spgeo[i].y;
data[pos++] = spgeo[i].width;
data[pos++] = spgeo[i].height;
}
XChangeProperty(dpy, ROOT, net_atom[net_workarea], XA_CARDINAL, 32,
PropModeReplace, (uchar*)data, 4 * tag_c);
free(data);
return;
}
/** Manage _NET_WM_STATE_* ewmh
*/
void
ewmh_manage_net_wm_state(long data_l[], Client *c)
{
/* Manage _NET_WM_STATE_FULLSCREEN */
if(data_l[1] == net_atom[net_wm_state_fullscreen])
{
if(data_l[0] == _NET_WM_STATE_ADD && !(c->flags & FSSFlag))
{
c->screen = screen_get_with_geo(c->geo.x, c->geo.y);
client_unmap(c);
c->flags &= ~UnmapFlag;
XMapWindow(dpy, c->win);
XReparentWindow(dpy, c->win, ROOT, spgeo[c->screen].x, spgeo[c->screen].y);
XResizeWindow(dpy, c->win,
spgeo[c->screen].width,
spgeo[c->screen].height);
c->tmp_geo = c->geo;
if(c->flags & FreeFlag)
c->ogeo = c->geo;
c->flags |= (FSSFlag | MaxFlag);
client_raise(c);
client_focus(c);
}
else if(data_l[0] == _NET_WM_STATE_REMOVE && (c->flags & FSSFlag))
{
c->flags &= ~(FSSFlag | MaxFlag);
client_map(c);
XReparentWindow(dpy, c->win, c->frame, BORDH, TBARH);
client_moveresize(c, c->tmp_geo, False);
}
}
/* Manage _NET_WM_STATE_DEMANDS_ATTENTION */
else if(data_l[1] == net_atom[net_wm_state_demands_attention])
{
if(data_l[0] == _NET_WM_STATE_ADD)
client_focus(c);
if(data_l[0] == _NET_WM_STATE_REMOVE)
if(c == sel)
client_focus(NULL);
}
return;
}
/** Manage the client hints
*\param c Client pointer
*/
void
ewmh_manage_window_type(Client *c)
{
Atom *atom, rf;
int i, f;
ulong n, il;
uchar *data = NULL;
if(XGetWindowProperty(dpy, c->win, net_atom[net_wm_window_type], 0L, 0x7FFFFFFFL,
False, XA_ATOM, &rf, &f, &n, &il, &data) == Success && n)
{
atom = (Atom*)data;
for(i = 0; i < n; ++i)
{
/* Manage _NET_WM_WINDOW_TYPE_DOCK & _NET_WM_WINDOW_TYPE_SPLASH */
if(atom[i] == net_atom[net_wm_window_type_dock]
|| atom[i] == net_atom[net_wm_window_type_splash])
{
/* Unmap frame, decoration.. */
client_unmap(c);
/* Map only window */
XMapWindow(dpy, c->win);
/* Reparent it to ROOT win */
XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y);
XRaiseWindow(dpy, c->win);
/* This window will not be managed anymore,
* so let's detach it. */
client_detach(c);
}
/* MANAGE _NET_WM_WINDOW_TYPE_DIALOG */
else if(atom[i] == net_atom[net_wm_window_type_dialog])
{
c->flags |= FreeFlag;
c->flags &= ~(TileFlag | MaxFlag | LMaxFlag);
client_moveresize(sel, sel->ogeo, True);
client_focus(c);
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
}
}
XFree(data);
}
return;
}
-279
View File
@@ -1,279 +0,0 @@
/*
* frame.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Frame creation function, for make a
* client frame, and configure it
* \param c Client pointer
*/
void
frame_create(Client *c)
{
XSetWindowAttributes at;
int i;
at.background_pixel = conf.client.bordernormal;
at.background_pixmap = ParentRelative;
at.override_redirect = True;
at.bit_gravity = StaticGravity;
at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|ExposureMask|VisibilityChangeMask
|EnterWindowMask|LeaveWindowMask|FocusChangeMask
|KeyMask|ButtonMask|MouseMask;
/* Set property */
c->frame_geo.x = c->geo.x - BORDH;
c->frame_geo.y = c->geo.y - TBARH;
c->frame_geo.width = FRAMEW(c->geo.width);
c->frame_geo.height = FRAMEH(c->geo.height);
c->colors.fg = conf.titlebar.fg_normal;
c->colors.frame = conf.client.bordernormal;
c->colors.resizecorner = conf.client.resizecorner_normal;
/* Create frame window */
CWIN(c->frame, ROOT,
c->frame_geo.x,
c->frame_geo.y,
c->frame_geo.width,
c->frame_geo.height, 0,
CWOverrideRedirect | CWBackPixmap | CWEventMask,
c->colors.frame, &at);
/* Create titlebar window */
if(TBARH - BORDH)
{
c->titlebar = barwin_create(c->frame, 0, 0,
c->frame_geo.width ,
TBARH,
c->colors.frame,
c->colors.fg,
True, conf.titlebar.stipple.active, False);
/* Buttons */
if(BUTTONWH >= 1)
{
c->button = emalloc(conf.titlebar.nbutton, sizeof(Window));
for(i = 0; i < conf.titlebar.nbutton; ++i)
{
CWIN(c->button[i], c->titlebar->win,
(c->button_last_x = (BORDH + (BUTTONWH * i) + (4 * i))),
((BUTTONWH - 1) / 2), BUTTONWH, BUTTONWH,
1, CWEventMask|CWOverrideRedirect|CWBackPixmap,
c->colors.frame, &at);
XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg));
}
}
}
at.event_mask &= ~(EnterWindowMask | LeaveWindowMask); /* <- Delete useless mask */
/* Create resize area */
at.cursor = cursor[CurRightResize];
CWIN(c->resize[Right], c->frame,
c->frame_geo.width - RESHW,
c->frame_geo.height - RESHW,
RESHW, RESHW, 0,
CWEventMask | CWBackPixel | CWCursor,
c->colors.resizecorner, &at);
at.cursor = cursor[CurLeftResize];
CWIN(c->resize[Left], c->frame,
0, c->frame_geo.height - RESHW,
RESHW, RESHW, 0,
CWEventMask | CWBackPixel | CWCursor,
c->colors.resizecorner, &at);
/* Border (for shadow) */
if(conf.client.border_shadow)
{
CWIN(c->left, c->frame, 0, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, color_enlight(c->colors.frame), &at);
CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0, CWBackPixel, color_enlight(c->colors.frame), &at);
CWIN(c->bottom, c->frame, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH, 0, CWBackPixel, SHADC, &at);
CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, SHADC, &at);
}
/* Reparent window with the frame */
XReparentWindow(dpy, c->win, c->frame, BORDH, TBARH);
return;
}
/** Delete a frame
* \param c The client frame
*/
void
frame_delete(Client *c)
{
/* If there is, delete the titlebar */
if(TBARH - BORDH)
{
barwin_delete_subwin(c->titlebar);
barwin_delete(c->titlebar);
}
/* Delete the frame's sub win and the frame */
XDestroySubwindows(dpy, c->frame);
XDestroyWindow(dpy, c->frame);
return;
}
/** Move a frame
* \param c The client frame
* \param geo Coordinate info for move the frame
*/
void
frame_moveresize(Client *c, XRectangle geo)
{
CHECK(c);
c->frame_geo.x = (geo.x) ? geo.x - BORDH : c->frame_geo.x;
c->frame_geo.y = (geo.y) ? geo.y - TBARH : c->frame_geo.y;
c->frame_geo.width = (geo.width) ? FRAMEW(geo.width) : c->frame_geo.width;
c->frame_geo.height = (geo.height) ? FRAMEH(geo.height) : c->frame_geo.height;
/* Frame */
XMoveResizeWindow(dpy, c->frame,
c->frame_geo.x,
c->frame_geo.y,
c->frame_geo.width,
c->frame_geo.height);
/* Titlebar */
if(TBARH - BORDH)
barwin_resize(c->titlebar, c->frame_geo.width, TBARH);
/* Resize area */
XMoveWindow(dpy, c->resize[Right], c->frame_geo.width - RESHW, c->frame_geo.height - RESHW);
XMoveWindow(dpy, c->resize[Left], 0, c->frame_geo.height - RESHW);
/* Border */
if(conf.client.border_shadow)
{
XResizeWindow(dpy, c->left, SHADH, c->frame_geo.height - SHADH);
XResizeWindow(dpy, c->top, c->frame_geo.width, SHADH);
XMoveResizeWindow(dpy, c->bottom, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH);
XMoveResizeWindow(dpy, c->right, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height);
}
return;
}
/** Update the client frame; Set the new color
* and the title --> refresh
* \param c Client pointer
*/
void
frame_update(Client *c)
{
int i;
CHECK(c);
if(TBARH - BORDH)
{
c->titlebar->bg = c->colors.frame;
c->titlebar->fg = c->colors.fg;
barwin_refresh_color(c->titlebar);
/* Buttons */
if(conf.titlebar.nbutton && BUTTONWH >= 1)
{
if(conf.titlebar.stipple.active)
draw_rectangle(c->titlebar->dr, 0, 0, c->button_last_x + TBARH - (TBARH / 4),
TBARH + BORDH * 2, c->colors.frame);
for(i = 0; i < conf.titlebar.nbutton; ++i)
{
XSetWindowBackground(dpy, c->button[i], c->colors.frame);
XClearWindow(dpy, c->button[i]);
if((!conf.titlebar.button[i].flags)
|| ((conf.titlebar.button[i].flags & FreeFlag) && (c->flags & FreeFlag))
|| ((conf.titlebar.button[i].flags & MaxFlag) && (c->flags & MaxFlag))
|| ((conf.titlebar.button[i].flags & TileFlag) && (c->flags & TileFlag)))
{
XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg));
/* Button's lines */
if(conf.titlebar.button[i].nlines)
{
XSetForeground(dpy, gc, getcolor(c->colors.fg));
XDrawSegments(dpy, c->button[i], gc,
conf.titlebar.button[i].linecoord,
conf.titlebar.button[i].nlines);
}
}
else
XSetWindowBorder(dpy, c->button[i], c->colors.frame);
}
}
barwin_refresh(c->titlebar);
}
XSetWindowBackground(dpy, c->frame, c->colors.frame);
XSetWindowBackground(dpy, c->resize[Right], c->colors.resizecorner);
XSetWindowBackground(dpy, c->resize[Left], c->colors.resizecorner);
XClearWindow(dpy, c->frame);
XClearWindow(dpy, c->resize[Right]);
XClearWindow(dpy, c->resize[Left]);
if(conf.client.border_shadow)
{
XSetWindowBackground(dpy, c->left, color_enlight(c->colors.frame));
XSetWindowBackground(dpy, c->top, color_enlight(c->colors.frame));
XSetWindowBackground(dpy, c->right, SHADC);
XSetWindowBackground(dpy, c->bottom, SHADC);
XClearWindow(dpy, c->left);
XClearWindow(dpy, c->top);
XClearWindow(dpy, c->right);
XClearWindow(dpy, c->bottom);
}
if(TBARH - BORDH)
barwin_draw_text(c->titlebar,
(c->frame_geo.width / 2) - (textw(c->title) / 2),
((font->height - font->descent) + (TBARH - font->height) / 2),
c->title);
return;
}
-207
View File
@@ -1,207 +0,0 @@
/*
* getinfo.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/* Global variables for each XGetWindowProperty
* of each getinfo functions.
*/
Atom rt;
int rf;
ulong ir, il;
uchar *ret;
/** Get information about tag (current, list, names)
*/
void
getinfo_tag(void)
{
int tag = 0;
char *tag_name = NULL;
char *tag_list = NULL;
if(XGetWindowProperty(dpy, ROOT, ATOM("_NET_CURRENT_DESKTOP"), 0L, 4096,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
tag = (int)*ret + 1;
XFree(ret);
}
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_TAG"), 0L, 4096,
False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret)
{
tag_name = _strdup((char*)ret);
XFree(ret);
}
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_TAG_LIST"), 0L, 4096,
False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret)
{
tag_list = _strdup((char*)ret);
XFree(ret);
}
printf("Current tag: %d - %s\n", tag, tag_name);
printf("Tag list: %s\n", tag_list);
IFREE(tag_name);
IFREE(tag_list);
return;
}
/** Get information about screens
*/
void
getinfo_screen(void)
{
int screen = 1;
int screen_num = 1;
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_SCREEN"), 0L, 4096,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
screen = (int)*ret + 1;
XFree(ret);
}
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_SCREEN_COUNT"), 0L, 4096,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
screen_num = (int)*ret;
XFree(ret);
}
printf("Current screen: %d\nScreen number: %d\n", screen, screen_num);
return;
}
/** Get current layout name
*/
void
getinfo_layout(void)
{
char *layout = NULL;
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_CURRENT_LAYOUT"), 0L, 4096,
False, ATOM("UTF8_STRING"), &rt, &rf, &ir, &il, &ret) == Success && ret)
{
layout = _strdup((char*)ret);
XFree(ret);
}
printf("Current layout: %s\n", layout);
IFREE(layout);
return;
}
/** Get information about current mwfact
*/
void
getinfo_mwfact(void)
{
char *mwfact = NULL;
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_MWFACT"), 0L, 4096,
False, XA_STRING, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
mwfact = _strdup((char*)ret);
XFree(ret);
}
printf("Current mwfact: %s\n", mwfact);
IFREE(mwfact);
return;
}
/** Get information about current nmaster
*/
void
getinfo_nmaster(void)
{
int nmaster = 1;
if(XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_NMASTER"), 0L, 4096,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
nmaster = (int)*ret;
XFree(ret);
}
printf("Current nmaster: %d\n", nmaster);
return;
}
/** Get information about wmfs
*\param info Type of information in a string
*/
void
getinfo(char *info)
{
long data[5];
if(!check_wmfs_running())
return;
data[4] = True;
send_client_event(data, "_WMFS_UPDATE_HINTS");
if(!strcmp(info, "tag"))
getinfo_tag();
else if(!strcmp(info, "screen"))
getinfo_screen();
else if(!strcmp(info, "layout"))
getinfo_layout();
else if(!strcmp(info, "mwfact"))
getinfo_mwfact();
else if(!strcmp(info, "nmaster"))
getinfo_nmaster();
else if(!strcmp(info, "help"))
printf("Argument list for wmfs -g options:\n"
" tag Show current tag number and name, and tag list.\n"
" screen Show current screen and screens number.\n"
" layout Show current layout name.\n"
" mwfact Show mwfact of current tag.\n"
" nmaster Show nmaster of current tag.\n");
else
warnx("Unknow info argument '%s'\nTry 'wmfs -g help'", info);
return;
}
-305
View File
@@ -1,305 +0,0 @@
/*
* infobar.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Init the Infobar
*/
void
infobar_init(void)
{
int s, sc, i, j = 0;
s = screen_count();
if(!infobar)
infobar = emalloc(s, sizeof(InfoBar));
for(sc = 0; sc < s; ++sc)
{
j = 0;
infobar[sc].geo.height = INFOBARH;
switch(tags[sc][seltag[sc]].barpos)
{
case IB_Hide:
sgeo[sc].y = spgeo[sc].y + TBARH;
sgeo[sc].height += INFOBARH;
infobar[sc].geo.y = -(infobar[sc].geo.height) * 2;
break;
case IB_Bottom:
sgeo[sc].y = TBARH;
infobar[sc].geo.y = spgeo[sc].y + sgeo[sc].height + TBARH;
break;
default:
case IB_Top:
sgeo[sc].y = spgeo[sc].y + INFOBARH + TBARH;
infobar[sc].geo.y = spgeo[sc].y;
break;
}
/* Create infobar barwindow */
infobar[sc].bar = barwin_create(ROOT, sgeo[sc].x - BORDH, infobar[sc].geo.y,
sgeo[sc].width, infobar[sc].geo.height,
conf.colors.bar, conf.colors.text, False, False, conf.border.bar);
infobar[sc].tags_board = barwin_create(infobar[sc].bar->win,
((conf.layout_placement) ? textw(tags[sc][seltag[sc]].layout.symbol) + PAD * 1.5: 0), 0,
textw(tags[sc][0].name) + PAD, /* Base size, will change */
infobar[sc].geo.height,
conf.colors.bar, conf.colors.text, False, False, False);
/* Create tags window */
for(i = 1; i < conf.ntag[sc] + 1; ++i)
{
infobar[sc].tags[i] = barwin_create(infobar[sc].tags_board->win, j, 0,
textw(tags[sc][i].name) + PAD,
infobar[sc].geo.height,
conf.colors.bar, conf.colors.text, False, False, conf.border.tag);
j += textw(tags[sc][i].name) + PAD;
barwin_resize(infobar[sc].tags_board, j, infobar[sc].geo.height);
barwin_map_subwin(infobar[sc].tags[i]);
}
/* Create layout switch barwindow */
infobar[sc].layout_button = barwin_create(infobar[sc].bar->win,
((conf.layout_placement) ? 0 : (j + PAD / 2)), 0,
textw(tags[sc][seltag[sc]].layout.symbol) + PAD,
infobar[sc].geo.height,
conf.colors.layout_bg, conf.colors.layout_fg,
False, False, conf.border.layout);
/* Selbar */
if(conf.bars.selbar)
infobar[sc].selbar = barwin_create(infobar[sc].bar->win,
((conf.layout_placement)
? (j + PAD / 2)
: infobar[sc].layout_button->geo.x + infobar[sc].layout_button->geo.width + PAD / 2), 1,
(sel) ? textw(sel->title) + PAD : 1,
infobar[sc].geo.height - 2,
conf.colors.bar, conf.colors.text, False, False, False);
/* Map/Refresh all */
barwin_map(infobar[sc].bar);
barwin_map_subwin(infobar[sc].bar);
barwin_map(infobar[sc].tags_board);
barwin_map_subwin(infobar[sc].tags_board);
if(conf.border.layout)
barwin_map_subwin(infobar[sc].layout_button);
if(conf.bars.selbar)
barwin_map(infobar[sc].selbar);
barwin_refresh_color(infobar[sc].bar);
barwin_refresh(infobar[sc].bar);
/* Default statustext is set here */
for(i = 0; i < s; ++i)
infobar[i].statustext = _strdup(WMFS_VERSION);
infobar_draw(sc);
}
return;
}
/** Draw the Infobar
*\param sc Screen number
*/
void
infobar_draw(int sc)
{
infobar_draw_taglist(sc);
infobar_draw_layout(sc);
infobar_draw_selbar(sc);
barwin_refresh_color(infobar[sc].bar);
statustext_handle(sc, infobar[sc].statustext);
return;
}
/** Draw the layout button in the InfoBar
*\param sc Screen number
*/
void
infobar_draw_layout(int sc)
{
barwin_resize(infobar[sc].layout_button, textw(tags[sc][seltag[sc]].layout.symbol) + PAD, infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button);
if(tags[sc][seltag[sc]].layout.symbol)
barwin_draw_text(infobar[sc].layout_button, PAD / 2, FHINFOBAR, tags[sc][seltag[sc]].layout.symbol);
return;
}
/** Draw Selbar (selected client title bar in infobar
*\param sc Screen Number
*/
void
infobar_draw_selbar(int sc)
{
if(!conf.bars.selbar)
return;
barwin_move(infobar[sc].selbar,
((conf.layout_placement)
? (infobar[sc].tags_board->geo.x + infobar[sc].tags_board->geo.width + PAD / 2)
: (infobar[sc].layout_button->geo.x + infobar[sc].layout_button->geo.width + PAD / 2)), 1);
barwin_resize(infobar[sc].selbar, textw(sel ? sel->title : NULL) + PAD, infobar[sc].geo.height - 2);
barwin_refresh_color(infobar[sc].selbar);
barwin_draw_text(infobar[sc].selbar, PAD / 2, FHINFOBAR - 1, (sel) ? sel->title : NULL);
barwin_refresh(infobar[sc].selbar);
return;
}
/** Draw the taglist in the InfoBar
*\param sc Screen number
*/
void
infobar_draw_taglist(int sc)
{
int i;
Client *c;
if(conf.layout_placement)
barwin_move(infobar[sc].tags_board, textw(tags[sc][seltag[sc]].layout.symbol) + PAD * 1.5, 0);
for(i = 1; i < conf.ntag[sc] + 1; ++i)
{
infobar[sc].tags[i]->bg = ((i == seltag[sc]) ? conf.colors.tagselbg : conf.colors.bar);
infobar[sc].tags[i]->fg = ((i == seltag[sc]) ? conf.colors.tagselfg : conf.colors.text);
barwin_refresh_color(infobar[sc].tags[i]);
/* Colorize a tag if there are clients in this */
for(c = clients; c; c = c->next)
{
if(c->screen == sc)
{
infobar[sc].tags[c->tag]->bg = ((c->tag == seltag[sc]) ? conf.colors.tagselbg : conf.colors.tag_occupied_bg);
barwin_refresh_color(infobar[sc].tags[i]);
}
}
if(tags[sc][i].name)
barwin_draw_text(infobar[sc].tags[i], PAD / 2, FHINFOBAR, tags[sc][i].name);
}
return;
}
/** Destroy the InfoBar
*/
void
infobar_destroy(void)
{
int sc, i;
for(sc = 0; sc < screen_count(); ++sc)
{
barwin_delete(infobar[sc].layout_button);
barwin_delete_subwin(infobar[sc].layout_button);
for(i = 1; i < conf.ntag[sc] + 1; ++i)
{
barwin_delete_subwin(infobar[sc].tags[i]);
barwin_delete(infobar[sc].tags[i]);
}
barwin_delete_subwin(infobar[sc].tags_board);
barwin_delete(infobar[sc].tags_board);
barwin_delete_subwin(infobar[sc].bar);
barwin_delete(infobar[sc].bar);
}
return;
}
/* Set the infobar position
* \param pos Position of the bar
*/
void
infobar_set_position(int pos)
{
screen_get_sel();
switch(pos)
{
case IB_Hide:
sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
sgeo[selscreen].height = spgeo[selscreen].height - TBARH;
infobar[selscreen].geo.y = -(infobar[selscreen].geo.height) * 2;
break;
case IB_Bottom:
sgeo[selscreen].y = spgeo[selscreen].y + TBARH;
sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
infobar[selscreen].geo.y = spgeo[selscreen].y + sgeo[selscreen].height + TBARH;
break;
default:
case IB_Top:
sgeo[selscreen].y = spgeo[selscreen].y + INFOBARH + TBARH;
sgeo[selscreen].height = spgeo[selscreen].height - INFOBARH - TBARH;
infobar[selscreen].geo.y = spgeo[selscreen].y;
break;
}
tags[selscreen][seltag[selscreen]].barpos = pos;
barwin_move(infobar[selscreen].bar, sgeo[selscreen].x - BORDH, infobar[selscreen].geo.y);
infobar_draw(selscreen);
ewmh_set_workarea();
arrange(selscreen, True);
return;
}
/** Toggle the infobar position
* \param cmd uicb_t type unused
*/
void
uicb_infobar_togglepos(uicb_t cmd)
{
screen_get_sel();
infobar_set_position((tags[selscreen][seltag[selscreen]].barpos
= (tags[selscreen][seltag[selscreen]].barpos < 2)
? tags[selscreen][seltag[selscreen]].barpos + 1
: 0));
return;
}
-224
View File
@@ -1,224 +0,0 @@
/*
* wmfs.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
const func_name_list_t layout_list[] =
{
{"tile", tile },
{"tile_right", tile },
{"tile_left", tile_left },
{"tile_top", tile_top },
{"tile_bottom", tile_bottom },
{"tile_grid", grid },
{"grid", grid },
{"mirror_vertical", mirror_vertical },
{"tile_mirror_vertical", mirror_vertical },
{"mirror_horizontal", mirror_horizontal },
{"tile_mirror_horizontal", mirror_horizontal },
{"layer", layer },
{"max", maxlayout },
{"maxlayout", maxlayout },
{"freelayout", freelayout },
{"free", freelayout },
{ NULL, NULL }
};
/** Init WMFS
*/
void
init(void)
{
/* First init */
ewmh_init_hints();
init_conf();
init_gc();
init_font();
init_cursor();
init_key();
init_root();
screen_init_geo();
infobar_init();
init_status();
ewmh_update_current_tag_prop();
grabkeys();
return;
}
/** Init the font
*/
void
init_font(void)
{
font = XftFontOpenName(dpy, SCREEN, conf.font);
if(!font)
{
warnx("WMFS Error: Cannot initialize font");
font = XftFontOpenName(dpy, SCREEN, "sans-10");
}
return;
}
/** Init the graphic context
*/
void
init_gc(void)
{
XGCValues gcv;
/* Bits sequences */
const char pix_bits[] =
{
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55,
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55
};
gc = DefaultGC(dpy, SCREEN);
/* Stipple GC */
gcv.function = GXcopy;
gcv.fill_style = FillStippled;
gcv.stipple = XCreateBitmapFromData(dpy, ROOT, pix_bits, 10, 4);
gc_stipple = XCreateGC(dpy, ROOT, GCFunction | GCFillStyle | GCStipple, &gcv);
return;
}
/** Init WMFS cursor
*/
void
init_cursor(void)
{
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurRightResize] = XCreateFontCursor(dpy, XC_lr_angle);
cursor[CurLeftResize] = XCreateFontCursor(dpy, XC_ll_angle);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
return;
}
/** Init key modifier
*/
void
init_key(void)
{
int i, j;
XModifierKeymap *modmap = XGetModifierMapping(dpy);
for(i = 0; i < 8; i++)
for(j = 0; j < modmap->max_keypermod; ++j)
if(modmap->modifiermap[i * modmap->max_keypermod + j]
== XKeysymToKeycode(dpy, XK_Num_Lock))
numlockmask = (1 << i);
XFreeModifiermap(modmap);
return;
}
/** Init root Window
*/
void
init_root(void)
{
XSetWindowAttributes at;
at.event_mask = KeyMask | ButtonMask | MouseMask | PropertyChangeMask
| SubstructureRedirectMask | SubstructureNotifyMask | StructureNotifyMask;
at.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, ROOT, CWEventMask | CWCursor, &at);
if(conf.root.background_command)
spawn("%s", conf.root.background_command);
ewmh_init_hints();
ewmh_get_number_of_desktop();
ewmh_get_desktop_names();
return;
}
/** Init statustext shell script
*/
void
init_status(void)
{
int fd;
struct stat st;
char *home;
if(!conf.status_path)
{
if(!(home = getenv("HOME")))
{
warnx("HOME not set, can't launch status.sh");
estatus = False;
return;
}
conf.status_path = emalloc(strlen(home) + strlen(DEF_STATUS) + 2, sizeof(char));
sprintf(conf.status_path, "%s/"DEF_STATUS, home);
}
if(!(fd = open(conf.status_path, O_RDONLY))
|| !fopen(conf.status_path, "r"))
{
free(conf.status_path);
estatus = False;
return;
}
stat(conf.status_path, &st);
if(st.st_size && st.st_mode & S_IXUSR)
{
estatus = True;
spawn(conf.status_path);
}
else
warnx("status file specified in configuratin (status_path) or present in wmfs directory can't be executed, try 'chmod +x %s'.", conf.status_path);
close(fd);
return;
}
-335
View File
@@ -1,335 +0,0 @@
/*
* launcher.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* conforming to glib use _GNU_SOURCE for asprintf declaration */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "wmfs.h"
static char *complete_on_command(char*, size_t);
static char *complete_on_files(char*, size_t);
void
launcher_execute(Launcher launcher)
{
BarWindow *bw;
Bool found;
Bool lastwastab = False;
Bool my_guitar_gently_wheeps = True;
char tmp[32] = { 0 };
char buf[512] = { 0 };
char tmpbuf[512] = { 0 };
char *complete;
int pos = 0, x;
int tabhits = 0;
KeySym ks;
XEvent ev;
screen_get_sel();
x = (infobar[selscreen].layout_button->geo.x
+ textw(tags[selscreen][seltag[selscreen]].layout.symbol) + PAD);
XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime);
bw = barwin_create(infobar[selscreen].bar->win, x, 1,
infobar[selscreen].bar->geo.width - x - 1,
infobar[selscreen].bar->geo.height - 2,
infobar[selscreen].bar->bg,
infobar[selscreen].bar->fg,
False, False, conf.border.bar);
barwin_map(bw);
barwin_refresh_color(bw);
/* First draw of the cursor */
XSetForeground(dpy, gc, getcolor(infobar[selscreen].bar->fg));
XDrawLine(dpy, bw->dr, gc, textw(launcher.prompt) + textw(" "),
2, textw(launcher.prompt) + textw(" "), INFOBARH - 4);
barwin_refresh(bw);
barwin_draw_text(bw, 1, FHINFOBAR - 1, launcher.prompt);
while(my_guitar_gently_wheeps)
{
if(ev.type == KeyPress)
{
XLookupString(&ev.xkey, tmp, sizeof(tmp), &ks, 0);
/* Check Ctrl-c / Ctrl-d */
if(ev.xkey.state & ControlMask)
if(ks == XK_c || ks == XK_d)
ks = XK_Escape;
/* Check if there is a keypad */
if(IsKeypadKey(ks) && ks == XK_KP_Enter)
ks = XK_Return;
switch(ks)
{
case XK_Return:
spawn("%s %s", launcher.command, buf);
my_guitar_gently_wheeps = 0;
break;
case XK_Escape:
my_guitar_gently_wheeps = 0;
break;
case XK_Tab:
/*
* completion
* if there is not space in buffer we
* complete the command using complete_on_command.
* Else we try to complete on filename using
* complete_on_files.
*/
buf[pos] = '\0';
if (lastwastab)
tabhits++;
else
{
tabhits = 1;
strcpy(tmpbuf, buf);
}
if (pos)
{
if (strchr(tmpbuf, ' '))
complete = complete_on_files(tmpbuf, tabhits);
else
complete = complete_on_command(tmpbuf, tabhits);
if (complete)
{
strcpy(buf, tmpbuf);
strncat(buf, complete, sizeof(buf));
found = True;
free(complete);
}
}
lastwastab = True;
/* start a new round of tabbing */
if (!found)
tabhits = 0;
pos = strlen(buf);
break;
case XK_BackSpace:
lastwastab = False;
if(pos)
buf[--pos] = 0;
break;
default:
lastwastab = False;
strncat(buf, tmp, sizeof(buf));
++pos;
break;
}
barwin_refresh_color(bw);
/* Update cursor position */
XSetForeground(dpy, gc, getcolor(infobar[selscreen].bar->fg));
XDrawLine(dpy, bw->dr, gc,
1 + textw(launcher.prompt) + textw(" ") + textw(buf), 2,
1 + textw(launcher.prompt) + textw(" ") + textw(buf), INFOBARH - 4);
barwin_draw_text(bw, 1, FHINFOBAR - 1, launcher.prompt);
barwin_draw_text(bw, 1 + textw(launcher.prompt) + textw(" "), FHINFOBAR - 1, buf);
barwin_refresh(bw);
}
else
getevent(ev);
XNextEvent(dpy, &ev);
}
barwin_unmap(bw);
barwin_delete(bw);
infobar_draw(selscreen);
XUngrabKeyboard(dpy, CurrentTime);
return;
}
void
uicb_launcher(uicb_t cmd)
{
int i;
for(i = 0; i < conf.nlauncher; ++i)
if(!strcmp(cmd, conf.launcher[i].name))
launcher_execute(conf.launcher[i]);
return;
}
/*
* Just search command in PATH.
* Return the characters to complete the command.
*/
static char *
complete_on_command(char *start, size_t hits)
{
char *path;
char *dirname;
char *ret = NULL;
DIR *dir;
struct dirent *content;
size_t count = 0;
if (!getenv("PATH") || !start || hits <= 0)
return NULL;
path = _strdup(getenv("PATH"));
dirname = strtok(path, ":");
/* recursively open PATH */
while (dirname)
{
if ((dir = opendir(dirname)))
{
while ((content = readdir(dir)))
if (!strncmp(content->d_name, start, strlen(start)) && ++count == hits)
{
ret = _strdup(content->d_name + strlen(start));
break;
}
closedir(dir);
}
if (ret)
break;
dirname = strtok(NULL, ":");
}
free(path);
return ret;
}
/*
* Complete a filename or directory name.
* works like complete_on_command.
*/
static char *
complete_on_files(char *start, size_t hits)
{
char *ret = NULL;
char *p = NULL;
char *dirname = NULL;
char *path = NULL;
char *filepath = NULL;
DIR *dir = NULL;
struct dirent *content = NULL;
struct stat st;
size_t count = 0;
if (!start || hits <= 0 || !(p = strrchr(start, ' ')))
return NULL;
/*
* Search the directory to open and set
* the beginning of file to complete on pointer 'p'.
*/
if (*(++p) == '\0' || !strrchr(p, '/'))
path = _strdup(".");
else
{
/* remplace ~ by $HOME in dirname */
if (!strncmp(p, "~/", 2) && getenv("HOME"))
asprintf(&dirname, "%s%s", getenv("HOME"), p+1);
else
dirname = _strdup(p);
/* Set p to filename to be complete
* and path the directory containing the file
* /foooooo/baaaaaar/somethinglikethis<tab>
* <---- path - ---><------- p ------>
*/
p = strrchr(dirname, '/');
if (p != dirname)
{
*(p++) = '\0';
path = _strdup(dirname);
}
else
{
path = _strdup("/");
p++;
}
}
if ((dir = opendir(path)))
{
while ((content = readdir(dir)))
{
if (!strcmp(content->d_name, ".") || !strcmp(content->d_name, ".."))
continue;
if (!strncmp(content->d_name, p, strlen(p)) && ++count == hits)
{
/* If it's a directory append '/' to the completion */
asprintf(&filepath, "%s/%s", path, content->d_name);
if (filepath && stat(filepath, &st) != -1)
{
if (S_ISDIR(st.st_mode))
asprintf(&ret, "%s/", content->d_name + strlen(p));
else
ret = _strdup(content->d_name + strlen(p));
}
else
warn("%s", filepath);
IFREE(filepath);
break;
}
}
closedir(dir);
}
IFREE(dirname);
IFREE(path);
return ret;
}
-918
View File
@@ -1,918 +0,0 @@
/*
* layout.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Arrange All
*/
void
arrange(int screen, Bool update_layout)
{
Client *c;
if(screen < 0 || screen > screen_count())
screen = screen_get_sel();
for(c = clients; c; c = c->next)
if(c->screen == screen)
{
if(!ishide(c, screen))
client_unhide(c);
else
client_hide(c);
}
if(update_layout)
tags[screen][seltag[screen]].layout.func(screen);
infobar_draw(screen);
return;
}
/** The free layout function
*/
void
freelayout(int screen)
{
Client *c;
for(c = clients; c; c = c->next)
if(!ishide(c, selscreen)
&& c->screen == screen_get_sel()
&& !(c->flags & MaxFlag))
{
client_moveresize(c, c->free_geo, True);
c->flags &= ~(TileFlag | LMaxFlag);
}
ewmh_update_current_tag_prop();
return;
}
/** Layout switching function
* \param b Bool True : next False : previous
*/
void
layoutswitch(Bool b)
{
int i;
Client *c;
screen_get_sel();
if(tags[selscreen][seltag[selscreen]].layout.func == freelayout)
for(c = clients; c && (c->tag != seltag[selscreen] && c->screen != selscreen); c = c->next)
{
c->ogeo = c->geo;
c->free_geo = c->geo;
}
for(i = 0; i < conf.nlayout; ++i)
{
if(tags[selscreen][seltag[selscreen]].layout.func == conf.layout[i].func
&& tags[selscreen][seltag[selscreen]].layout.symbol == conf.layout[i].symbol)
{
if(b)
tags[selscreen][seltag[selscreen]].layout = conf.layout[(i + 1) % conf.nlayout];
else
tags[selscreen][seltag[selscreen]].layout = conf.layout[(i + conf.nlayout - 1) % conf.nlayout];
break;
}
}
ewmh_update_current_tag_prop();
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
infobar_draw(selscreen);
return;
}
/** Set the next layout
* \param cmd uicb_t type unused
*/
void
uicb_layout_next(uicb_t cmd)
{
layoutswitch(True);
return;
}
/** Set the previous layout
* \param cmd uicb_t type unused
*/
void
uicb_layout_prev(uicb_t cmd)
{
layoutswitch(False);
return;
}
/** Max layout function
*/
void
maxlayout(int screen)
{
Client *c;
int i;
for(i = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++i)
{
c->flags &= ~TileFlag;
c->flags |= LMaxFlag;
client_maximize(c);
}
ewmh_update_current_tag_prop();
return;
}
/** Sort all the client that can be
* tiled
* \param c Client pointer
* \return a client pointer
*/
Client*
tiled_client(int screen, Client *c)
{
for(;c && ((c->flags & MaxFlag)
|| (c->flags & FreeFlag)
|| (c->flags & FSSFlag)
|| (c->flags & AboveFlag)
|| c->screen != screen
|| ishide(c, screen)); c = c->next);
return c;
}
/** Set the mwfact
* \param cmd Mwfact (string)
*/
void
uicb_set_mwfact(uicb_t cmd)
{
double c;
screen_get_sel();
CHECK((sscanf(cmd, "%lf", &c)));
if(tags[selscreen][seltag[selscreen]].mwfact + c > 0.95
|| tags[selscreen][seltag[selscreen]].mwfact + c < 0.05)
return;
tags[selscreen][seltag[selscreen]].mwfact += c;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
ewmh_update_current_tag_prop();
return;
}
/** Set the nmaster
* \param cmd Nmaster (string)
*/
void
uicb_set_nmaster(uicb_t cmd)
{
int nc, n = atoi(cmd);
Client *c;
screen_get_sel();
for(nc = 0, c = tiled_client(selscreen, clients); c; c = tiled_client(selscreen, c->next), ++nc);
if(!nc || tags[selscreen][seltag[selscreen]].nmaster + n == 0
|| tags[selscreen][seltag[selscreen]].nmaster + n > nc)
return;
tags[selscreen][seltag[selscreen]].nmaster += n;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
ewmh_update_current_tag_prop();
return;
}
void
uicb_set_client_layer(uicb_t cmd)
{
int n = atoi(cmd);
screen_get_sel();
CHECK(sel);
if(sel->layer + n < 1
|| sel->layer + n > tags[selscreen][seltag[selscreen]].layers)
return;
sel->layer += n;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
return;
}
void
uicb_set_layer(uicb_t cmd)
{
int n = atoi(cmd);
screen_get_sel();
if(tags[selscreen][seltag[selscreen]].layers + n < 1)
return;
tags[selscreen][seltag[selscreen]].layers += n;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
return;
}
/** Grid layout function
*/
void
grid(int screen)
{
Client *c;
XRectangle sg = sgeo[screen];
XRectangle cgeo = {sg.x, sg.y, 0, 0};
unsigned int i, n, cols, rows, cpcols = 0;
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK(n);
for(rows = 0; rows <= n / 2; ++rows)
if(rows * rows >= n)
break;
cols = (rows && ((rows - 1) * rows) >= n)
? rows - 1
: rows;
for(i = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++i)
{
/* Set client property */
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= TileFlag;
++cpcols;
cgeo.width = (sg.width / cols) - (BORDH * 2);
cgeo.height = (sg.height / rows) - BORDH;
/* Last row's and last client remainder */
if(cpcols == rows || i + 1 == n)
cgeo.height = sg.y + sg.height - cgeo.y - BORDH;
/* Last column's client remainder */
if(i >= rows * (cols - 1))
cgeo.width = sg.width - (cgeo.x - (sg.x - (BORDH * 2)));
/* Resize */
client_moveresize(c, cgeo, tags[screen][seltag[screen]].resizehint);
/* Set all the other size with current client info */
cgeo.y = c->geo.y + c->geo.height + BORDH + TBARH;
if(cpcols + 1 > rows)
{
cpcols = 0;
cgeo.x = c->geo.x + c->geo.width + (BORDH * 2);
cgeo.y = sg.y;
}
}
ewmh_update_current_tag_prop();
return;
}
/** Multi tile function
* \param type Postion type { Top, Bottom, Left, Right }
*/
void
multi_tile(int screen, Position type)
{
Client *c;
XRectangle sg = sgeo[screen];
XRectangle mastergeo = {sg.x, sg.y, 0, 0};
XRectangle cgeo = {sg.x, sg.y, 0, 0};
uint i, n, tilesize, mwfact, nmaster = tags[screen][seltag[screen]].nmaster;
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK(n);
/* FIX NMASTER */
nmaster = (n < nmaster) ? n : nmaster;
/* SET MWFACT */
mwfact = (type == Top || type == Bottom)
? tags[screen][seltag[screen]].mwfact * sg.height
: tags[screen][seltag[screen]].mwfact * sg.width;
/* MASTER SIZE */
if(type == Top || type == Bottom)
{
if(type == Top)
mastergeo.y = (n <= nmaster) ? sg.y : sg.y + (sg.height - mwfact) - BORDH;
mastergeo.width = (sg.width / nmaster) - (BORDH * 4);
mastergeo.height = (n <= nmaster) ? sg.height - BORDH : mwfact;
}
else
{
if(type == Left)
mastergeo.x = (n <= nmaster) ? sg.x : (sg.x + sg.width) - mwfact - (BORDH * 2);
mastergeo.width = (n <= nmaster) ? sg.width - (BORDH * 2) : mwfact;
mastergeo.height = (sg.height / nmaster) - BORDH;
}
/* TILED SIZE */
if(n > nmaster)
{
if(type == Top || type == Bottom)
tilesize = sg.width / (n - nmaster) - (BORDH * 4);
else
tilesize = sg.height / (n - nmaster) - ((BORDH * 2) + TBARH);
}
for(i = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++i)
{
/* Set client property */
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= TileFlag;
/* MASTER */
if(i < nmaster)
{
cgeo.width = mastergeo.width;
cgeo.height = mastergeo.height;
if(type == Top || type == Bottom)
cgeo.y = mastergeo.y;
else
{
cgeo.x = mastergeo.x;
cgeo.height -= (TBARH + BORDH);
}
}
/* TILED */
else
{
if(i == nmaster)
{
switch(type)
{
case Top:
case Left:
cgeo.y = sg.y;
cgeo.x = sg.x;
break;
case Bottom:
cgeo.y += mastergeo.height + TBARH + BORDH;
cgeo.x = sg.x;
break;
default:
case Right:
cgeo.x += mastergeo.width + (BORDH * 2);
cgeo.y = sg.y;
break;
}
}
if(type == Top || type == Bottom)
{
cgeo.width = tilesize;
cgeo.height = sg.height - mastergeo.height - TBARH - (BORDH * 2);
}
else
{
cgeo.width = sg.width - mastergeo.width - (BORDH * 4);
cgeo.height = tilesize;
}
}
/* REMAINDER */
if(i + 1 == n || i + 1 == (n < nmaster ? n : nmaster))
{
if(type == Top || type == Bottom)
cgeo.width = sg.width - (cgeo.x - (sg.x - (BORDH * 2)));
else
cgeo.height = (sg.y + sg.height) - cgeo.y - BORDH;
}
/* Magic instant */
client_moveresize(c, cgeo, tags[screen][seltag[screen]].resizehint);
/* Set the position of the next client */
if(type == Top || type == Bottom)
cgeo.x = c->geo.x + c->geo.width + (BORDH * 2);
else
cgeo.y = c->geo.y + c->geo.height + BORDH + TBARH;
}
ewmh_update_current_tag_prop();
return;
}
/** Mirror layout function
* \param screen Screen to execute this function
* \param horizont To specify the mirror mode (vertical/horizontal)
*/
void
mirror(int screen, Bool horizontal)
{
Client *c;
XRectangle sg = sgeo[screen];
XRectangle mastergeo = {sg.x, sg.y, sg.width, sg.height};
XRectangle cgeo = {sg.x, sg.y , sg.width, sg.height};
XRectangle nextg[2] = { {0} };
uint i, n, tilesize, mwfact;
uint nmaster = tags[screen][seltag[screen]].nmaster;
int pa, imp;
Bool isp = 0;
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK(n);
/* Fix nmaster */
nmaster = (n < nmaster) ? n : nmaster;
imp = ((n - (nmaster - 1)) / 2);
pa = ((n - (nmaster - 1)) / 2) - (((n - (nmaster - 1)) % 2) ? 0 : 1);
/* Set mwfact */
if(tags[screen][seltag[screen]].mwfact < 0.55)
tags[screen][seltag[screen]].mwfact = 0.55;
mwfact = tags[screen][seltag[screen]].mwfact * ((horizontal) ? sg.height : sg.width);
/* Master size */
if(horizontal)
{
mastergeo.width = (sg.width / nmaster) - (BORDH * 2);
mastergeo.height -= BORDH;
}
else
{
mastergeo.width -= BORDH * 2;
mastergeo.height = (sg.height / nmaster) - (TBARH + (BORDH * 2));
}
if(n == nmaster + 1)
{
if(horizontal)
{
mastergeo.height = mwfact - ((BORDH * 2) + TBARH);
tilesize = (sg.height - mastergeo.height) - ((BORDH * 2) + TBARH);
}
else
{
mastergeo.width = mwfact - (BORDH * 3);
tilesize = (sg.width - mastergeo.width) - (BORDH * 4);
}
}
if(n > nmaster + 1)
{
if(horizontal)
{
mastergeo.y = (sg.y + (sg.height - mwfact)) + TBARH + BORDH;
mastergeo.height = (2 * mwfact - sg.height) - ((BORDH * 3) + (TBARH * 2));
tilesize = (mwfact - mastergeo.height) - ((BORDH * 3) + (TBARH * 2));
}
else
{
mastergeo.x = (sg.x + (sg.width - mwfact)) + BORDH;
mastergeo.width = ((2 * mwfact - sg.width) - (BORDH * 4));
tilesize = (mwfact - mastergeo.width) - (BORDH * 5);
}
}
for(i = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++i)
{
/* Set client property */
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= TileFlag;
if(i < nmaster)
{
cgeo = mastergeo;
/* Master remainder */
if(i + 1 == nmaster)
{
if(horizontal)
cgeo.width = (sg.x + sg.width) - (cgeo.x + (BORDH * 2));
else
cgeo.height = (sg.y + sg.height) - (cgeo.y + BORDH);
}
}
else
{
if(horizontal)
cgeo.height = tilesize;
else
cgeo.width = tilesize;
if((i + nmaster) % 2)
{
isp = 1;
if(horizontal)
{
cgeo.y = sg.y;
cgeo.width = (sg.width / pa) - (BORDH * 2);
}
else
{
cgeo.x = sg.x;
cgeo.height = (sg.height / pa) - (TBARH + (BORDH * 2));
}
}
else
{
isp = 0;
if(horizontal)
{
cgeo.y = (sg.y + mwfact) - BORDH;
cgeo.width = (sg.width / imp) - (BORDH * 2);
}
else
{
cgeo.x = (sg.x + mwfact) - BORDH;
cgeo.height = (sg.height / imp) - (TBARH + (BORDH * 2));
}
}
/* Remainder */
if(i + 1 == n || i + 1 == n - 1)
{
if(horizontal)
cgeo.width = (sg.x + sg.width) - (cgeo.x + (BORDH * 2));
else
cgeo.height = (sg.y + sg.height) - (cgeo.y + BORDH);
}
}
client_moveresize(c, cgeo, tags[screen][seltag[screen]].resizehint);
if(i >= nmaster)
nextg[!isp] = c->geo;
/* Next y/x position */
if(i >= nmaster - 1)
{
if(horizontal)
{
if(i == nmaster || i == nmaster - 1)
cgeo.x = sg.x;
else
cgeo.x = nextg[isp].x + nextg[isp].width + BORDH * 2;
}
else
{
if(i == nmaster || i == nmaster - 1)
cgeo.y = sg.y;
else
cgeo.y = nextg[isp].y + nextg[isp].height + BORDH + TBARH;
}
}
else if (i <= nmaster - 1)
{
if(horizontal)
mastergeo.x = c->geo.x + c->geo.width + BORDH * 2;
else
mastergeo.y = c->geo.y + c->geo.height + BORDH + TBARH;
}
}
ewmh_update_current_tag_prop();
return;
}
/** Layer layout function
*/
void
layer(int screen)
{
Client *c;
XRectangle geo = { 0 };
XRectangle sg = sgeo[screen];
int n, i, l = tags[screen][seltag[screen]].layers;
int *x = NULL;
int *nl = NULL;
int *ncl = NULL;
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
CHECK(n);
x = emalloc(l + 1, sizeof(int));
nl = emalloc(l + 1, sizeof(int));
ncl = emalloc(l + 1, sizeof(int));
for(i = 0; i < l + 1; ++i)
{
x[i] = sg.x;
nl[i] = 0;
ncl[i] = 0;
}
for(c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next))
{
for(; c->layer > l; --(c->layer));
++nl[c->layer];
}
for(i = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++i)
{
/* Set client property */
c->flags &= ~(MaxFlag | LMaxFlag);
c->flags |= TileFlag;
++ncl[c->layer];
geo.x = x[c->layer];
geo.height = (sg.height / l) - (BORDH + TBARH);
geo.width = (sg.width / ((nl[c->layer]) ? nl[c->layer] : 1)) - BORDH * 2;
geo.y = sg.y + ((geo.height + TBARH + BORDH) * c->layer) - (geo.height + TBARH + BORDH);
if(c->layer == l)
geo.height = (sg.y + sg.height) - geo.y - BORDH;
if(ncl[c->layer] == nl[c->layer])
geo.width = sg.width - (geo.x - (sg.x - (BORDH * 2)));
client_moveresize(c, geo, False);
x[c->layer] = geo.x + geo.width + BORDH * 2;
}
free(x);
free(nl);
free(ncl);
ewmh_update_current_tag_prop();
return;
}
/** Tile Right function
*/
void
tile(int screen)
{
multi_tile(screen, Right);
return;
}
/** Tile Left function
*/
void
tile_left(int screen)
{
multi_tile(screen, Left);
return;
}
/** Tile Top function
*/
void
tile_top(int screen)
{
multi_tile(screen, Top);
return;
}
/** Tile Bottom function
*/
void
tile_bottom(int screen)
{
multi_tile(screen, Bottom);
return;
}
/** Mirror tile vertical function
*/
void
mirror_vertical(int screen)
{
mirror(screen, False);
return;
}
/** Mirror tile horizontal function
*/
void
mirror_horizontal(int screen)
{
mirror(screen, True);
return;
}
/** Put the selected client to the master postion
* \param cmd uicb_t type unused
*/
void
uicb_tile_switch(uicb_t cmd)
{
layout_set_client_master (sel);
return;
}
/** Toggle the selected client to free
* \param cmd uicb_t type unused
*/
void
uicb_togglefree(uicb_t cmd)
{
if(!sel || sel->screen != screen_get_sel() || (sel->flags & FSSFlag))
return;
sel->flags ^= FreeFlag;
if((sel->flags & FreeFlag))
{
sel->flags &= ~(TileFlag | MaxFlag | LMaxFlag);
client_moveresize(sel, sel->free_geo, True);
client_raise(sel);
}
else
{
sel->free_geo = sel->geo;
sel->ogeo = sel->geo;
}
client_update_attributes(sel);
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
return;
}
/** Toggle the selected client to max
* \param cmd uicb_t type unused
*/
void
uicb_togglemax(uicb_t cmd)
{
if(!sel || ishide(sel, selscreen)
|| (sel->flags & HintFlag)|| (sel->flags & FSSFlag))
return;
if(!(sel->flags & MaxFlag))
{
sel->ogeo = sel->geo;
sel->free_geo = sel->geo;
sel->flags &= ~(TileFlag | FreeFlag);
client_maximize(sel);
client_raise(sel);
sel->flags |= MaxFlag;
}
else
{
sel->geo = sel->free_geo;
client_moveresize(sel, sel->geo, True);
sel->flags &= ~MaxFlag;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
}
return;
}
/** Toggle the resizehint
* \param cmd uicb_t type
*/
void
uicb_toggle_resizehint(uicb_t cmd)
{
screen_get_sel();
tags[selscreen][seltag[selscreen]].resizehint = !tags[selscreen][seltag[selscreen]].resizehint;
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
return;
}
/** Toggle abovefc option
*\param cmd uicb_t type
*/
void
uicb_toggle_abovefc(uicb_t cmd)
{
Client *c;
screen_get_sel();
if(!(tags[selscreen][seltag[selscreen]].abovefc = !tags[selscreen][seltag[selscreen]].abovefc))
{
for(c = clients; c; c = c->next)
if(c->flags & AboveFlag
&& c->screen == selscreen
&& c->tag == seltag[selscreen])
{
c->flags &= ~AboveFlag;
break;
}
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
}
client_focus(sel);
return;
}
/** Set the layout
* \param cmd uicb_t type
*/
void
uicb_set_layout(uicb_t cmd)
{
int i, j, n;
screen_get_sel();
/* Set layout_list lenght */
for(n = 0; layout_list[n].name != NULL && layout_list[n].func != NULL; ++n);
for(i = 0; i < n; ++i)
if(!strcmp(cmd, _strdup(layout_list[i].name)))
for(j = 0; j < LEN(conf.layout); ++j)
if(layout_list[i].func == conf.layout[j].func)
tags[selscreen][seltag[selscreen]].layout = conf.layout[j];
arrange(selscreen, True);
return;
}
/** Set the client as master
* \param c Client
*/
void
layout_set_client_master(Client *c)
{
screen_get_sel();
if(!c || (c->flags & HintFlag) || !(c->flags & TileFlag)
|| (c->flags & FSSFlag))
return;
if(c == tiled_client(selscreen, clients))
CHECK((c = tiled_client(selscreen, c->next)));
client_detach(c);
client_attach(c);
client_focus(c);
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
return;
}
-268
View File
@@ -1,268 +0,0 @@
/*
* menu.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
void
menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n)
{
/* Item */
menu->nitem = nitem;
menu->item = emalloc(sizeof(MenuItem), nitem);
menu->name = name;
/* Colors */
menu->colors.focus.bg = bg_f;
menu->colors.focus.fg = fg_f;
menu->colors.normal.bg = bg_n;
menu->colors.normal.fg = fg_n;
return;
}
void
menu_new_item(MenuItem *mi, char *name, void *func, char *cmd)
{
mi->name = name;
mi->func = func;
mi->cmd = cmd;
return;
}
void
menu_draw(Menu menu, int x, int y)
{
int i, width;
XEvent ev;
BarWindow *item[menu.nitem];
BarWindow *frame;
width = menu_get_longer_string(menu.item, menu.nitem);
/* Frame barwin */
frame = barwin_create(ROOT, x, y, width + SHADH, menu.nitem * (INFOBARH - SHADH) + SHADH * 2,
menu.colors.normal.bg, menu.colors.normal.fg, False, False, True);
barwin_map(frame);
barwin_map_subwin(frame);
barwin_refresh_color(frame);
for(i = 0; i < menu.nitem; ++i)
{
item[i] = barwin_create(frame->win,
SHADH,
(i * (INFOBARH - SHADH) + SHADH),
width - SHADH,
INFOBARH,
menu.colors.normal.bg,
menu.colors.normal.fg,
True, False, False);
barwin_map(item[i]);
barwin_refresh_color(item[i]);
menu_draw_item_name(&menu, i, item);
barwin_refresh(item[i]);
}
/* Select the first item */
menu_focus_item(&menu, 0, item);
XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime);
while(!menu_manage_event(&ev, &menu, item));
XUngrabKeyboard(dpy, CurrentTime);
for(i = 0; i < menu.nitem; ++i)
barwin_delete(item[i]);
barwin_delete(frame);
return;
}
Bool
menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[])
{
int i, c = 0;
KeySym ks;
Bool quit = False;
switch(ev->type)
{
/* Mouse events */
case ButtonPress:
/* Execute the function linked with the item */
for(i = 0; i < menu->nitem; ++i)
{
if(ev->xbutton.window == winitem[i]->win
&& (ev->xbutton.button == Button1 || ev->xbutton.button == Button2))
{
if(menu->item[i].func)
menu->item[i].func(menu->item[i].cmd);
quit = True;
}
else if(ev->xbutton.window != winitem[i]->win)
++c;
else if(ev->xbutton.button == Button4)
menu_focus_item(menu, menu->focus_item - 1, winitem);
else if(ev->xbutton.button == Button5)
menu_focus_item(menu, menu->focus_item + 1, winitem);
}
/* If the clicked window is not one of menu wins (items), quit. */
if(c == i)
quit = True;
break;
/* Keys */
case KeyPress:
XLookupString(&ev->xkey, NULL, 0, &ks, 0);
switch(ks)
{
case XK_Up:
menu_focus_item(menu, menu->focus_item - 1, winitem);
break;
case XK_Down:
menu_focus_item(menu, menu->focus_item + 1, winitem);
break;
case XK_Return:
if(menu->item[menu->focus_item].func)
menu->item[menu->focus_item].func(menu->item[menu->focus_item].cmd);
quit = True;
break;
case XK_Escape:
quit = True;
break;
}
break;
/* Focus (with mouse) management */
case EnterNotify:
/* For focus an item with the mouse */
for(i = 0; i < menu->nitem; ++i)
if(ev->xcrossing.window == winitem[i]->win)
menu_focus_item(menu, i, winitem);
break;
default:
getevent(*ev);
break;
}
XNextEvent(dpy, ev);
return quit;
}
void
menu_focus_item(Menu *menu, int item, BarWindow *winitem[])
{
int i;
menu->focus_item = item;
if(menu->focus_item > menu->nitem - 1)
menu->focus_item = 0;
else if(menu->focus_item < 0)
menu->focus_item = menu->nitem - 1;
for(i = 0; i < menu->nitem; ++i)
{
winitem[i]->fg = ((i == menu->focus_item) ? menu->colors.focus.fg : menu->colors.normal.fg);
winitem[i]->bg = ((i == menu->focus_item) ? menu->colors.focus.bg : menu->colors.normal.bg);
barwin_refresh_color(winitem[i]);
menu_draw_item_name(menu, i, winitem);
barwin_refresh(winitem[i]);
}
return;
}
void
menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[])
{
int width = menu_get_longer_string(menu->item, menu->nitem);
barwin_draw_text(winitem[item],
((width / 2) - (textw(menu->item[item].name) / 2)),
FHINFOBAR,
menu->item[item].name);
return;
}
int
menu_get_longer_string(MenuItem *mt, int nitem)
{
int i, l = 0;
for(i = 0; i < nitem; ++i)
if(textw(mt[i].name) > l)
l = textw(mt[i].name);
return l + PAD;
}
void
uicb_menu(uicb_t cmd)
{
int i, d, u, x, y;
Window w;
if(!strcmp(cmd, "menulayout"))
menu_draw(menulayout, menulayout.x, menulayout.y);
for(i = 0; i < conf.nmenu; ++i)
if(!strcmp(cmd, conf.menu[i].name))
{
if(conf.menu[i].place_at_mouse)
XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&u);
else
{
screen_get_sel();
x = conf.menu[i].x + spgeo[selscreen].x;
y = conf.menu[i].y + spgeo[selscreen].y;
}
menu_draw(conf.menu[i], x, y);
}
return;
}
-368
View File
@@ -1,368 +0,0 @@
/*
* mouse.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Draw the border when a client in dragging/resizing with mouse
*/
void
mouse_dragborder(XRectangle geo, GC g)
{
XDrawRectangle(dpy, ROOT, g,
geo.x - BORDH / 2,
geo.y - (TBARH - (BORDH / 2)),
geo.width + BORDH,
geo.height + TBARH);
return;
}
/** Move a client in tile grid with the mouse
*\param c Client double pointer
*/
void
mouse_move_tile_client(Client **c)
{
Client *sc;
Window w;
int d;
if(!((*c)->flags & TileFlag) && !((*c)->flags & LMaxFlag))
return;
XQueryPointer(dpy, ROOT, &w, &w, &d, &d, &d, &d, (uint*)&d);
if(((sc = client_gb_win(w)) || (sc = client_gb_frame(w)) || (sc = client_gb_titlebar(w)))
&& (*c)->win != sc->win && !((*c)->flags & HideFlag) && !(sc->flags & HideFlag))
{
client_swap(sc, *c);
client_focus(sc);
swap_ptr((void**)c, (void**)&sc);
}
return;
}
/** Move a client from one tag to another with dah mouse
*\param c client pointer
*/
void
mouse_move_tag_client(Client *c)
{
Window w;
int i, d, s;
if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
return;
s = c->screen;
XQueryPointer(dpy, infobar[selscreen].tags_board->win, &w, &w, &d, &d, &d, &d, (uint*)&d);
for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
if(infobar[selscreen].tags[i]->win == w
&& tags[selscreen][i].layout.func != freelayout)
{
c->screen = selscreen;
c->tag = i;
tags[c->screen][c->tag].request_update = True;
arrange(s, True);
if(s != c->screen)
arrange(c->screen, True);
}
return;
}
/** Move the client with the mouse
* \param c Client pointer
*/
void
mouse_move(Client *c)
{
int ocx, ocy, mx, my;
int dint;
uint duint;
Window dw;
XRectangle geo = c->geo;
XGCValues xgc;
GC gci;
XEvent ev;
if((c->flags & MaxFlag) || (c->flags & FSSFlag))
return;
ocx = c->geo.x;
ocy = c->geo.y;
if(XGrabPointer(dpy, ROOT, False, MouseMask, GrabModeAsync, GrabModeAsync,
None, cursor[CurMove], CurrentTime) != GrabSuccess)
return;
if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
XGrabServer(dpy);
/* Set the GC for the rectangle */
xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);
if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
mouse_dragborder(c->geo, gci);
XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint);
do
{
XMaskEvent(dpy, MouseMask | SubstructureRedirectMask, &ev);
screen_get_sel();
if(ev.type == MotionNotify)
{
mouse_move_tile_client(&c);
mouse_move_tag_client(c);
/* To move a client normally, in freelayout */
if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
{
mouse_dragborder(geo, gci);
geo.x = (ocx + (ev.xmotion.x - mx));
geo.y = (ocy + (ev.xmotion.y - my));
/*
* Need to draw 2 times the same rectangle because
* it is draw with the revert color; revert + revert = normal
*/
mouse_dragborder(geo, gci);
}
}
else if(ev.type == MapRequest
|| ev.type == ConfigureRequest)
getevent(ev);
}
while(ev.type != ButtonRelease);
/* One time again to delete all the trace on the window */
if(!(c->flags & TileFlag) && !(c->flags & LMaxFlag))
{
mouse_dragborder(geo, gci);
client_moveresize(c, geo, False);
frame_update(c);
XUngrabServer(dpy);
}
client_update_attributes(c);
XUngrabPointer(dpy, CurrentTime);
XFreeGC(dpy, gci);
return;
}
/** Resize a client with the mouse
* \param c Client pointer
*/
void
mouse_resize(Client *c)
{
XRectangle geo = c->geo, ogeo = c->geo;
Position pos = Right;
XEvent ev;
Window w;
int d, u, omx, omy;
XGCValues xgc;
GC gci;
float mwf = tags[selscreen][seltag[selscreen]].mwfact;
if((c->flags & MaxFlag)
|| (c->flags & LMaxFlag)
|| (c->flags & FSSFlag))
return;
XQueryPointer(dpy, ROOT, &w, &w, &omx, &omy, &d, &d, (uint *)&u);
if((omx - c->geo.x) < (c->geo.width / 2))
pos = Left;
if(XGrabPointer(dpy, ROOT, False, MouseMask, GrabModeAsync, GrabModeAsync, None,
cursor[((c->flags & TileFlag) ? CurResize : ((pos == Right) ? CurRightResize : CurLeftResize))],
CurrentTime) != GrabSuccess)
return;
if(!(c->flags & TileFlag))
XGrabServer(dpy);
/* Set the GC for the rectangle */
xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction | GCSubwindowMode | GCLineWidth, &xgc);
if(!(c->flags & TileFlag))
{
if(pos == Right)
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->geo.width + conf.client.borderheight, c->geo.height);
else
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, 0, c->geo.height);
mouse_dragborder(c->geo, gci);
}
do
{
XMaskEvent(dpy, MouseMask | SubstructureRedirectMask, &ev);
if(ev.type == MotionNotify)
{
/* To resize MWFACT in tile mode */
if((c->flags & TileFlag)
&& tags[selscreen][seltag[selscreen]].layout.func != grid)
{
if(tags[selscreen][seltag[selscreen]].layout.func == tile)
mwf += (ROUND(ev.xmotion.x_root) - omx) / (sgeo[c->screen].width);
else if(tags[selscreen][seltag[selscreen]].layout.func == tile_left)
mwf -= (ROUND(ev.xmotion.x_root) - omx) / (sgeo[c->screen].width);
else if(tags[selscreen][seltag[selscreen]].layout.func == tile_top)
mwf -= (ROUND(ev.xmotion.y_root) - omy) / (sgeo[c->screen].height);
else
mwf += (ROUND(ev.xmotion.y_root) - omy) / (sgeo[c->screen].height);
omx = ROUND(ev.xmotion.x_root);
omy = ROUND(ev.xmotion.y_root);
tags[selscreen][seltag[selscreen]].mwfact = (mwf < 0.05) ? 0.05 : ((mwf > 0.95) ? 0.95 : mwf);
}
/* Free mode */
else if(!(c->flags & TileFlag))
{
mouse_dragborder(geo, gci);
if(pos == Right)
{
geo.width = ((ev.xmotion.x - c->geo.x < c->minw) ? c->minw : ev.xmotion.x - c->geo.x);
geo.height = ((ev.xmotion.y - c->geo.y < c->minh) ? c->minh : ev.xmotion.y - c->geo.y);
}
else
{
geo.x = (geo.width != c->maxw) ? c->geo.x - (c->geo.x - ev.xmotion.x) : geo.x;
geo.width = ((c->geo.width + (c->geo.x - geo.x) < c->minw)
? c->minw && (geo.x = (c->geo.x + c->geo.width) - c->minw)
: c->geo.width + (c->geo.x - geo.x));
geo.height = ((ev.xmotion.y - c->geo.y <= c->minh) ? c->minh : ev.xmotion.y - c->geo.y);
}
client_geo_hints(&geo, c);
mouse_dragborder((ogeo = geo), gci);
XSync(dpy, False);
}
}
}
while(ev.type != ButtonRelease);
if(!(c->flags & TileFlag))
{
mouse_dragborder(ogeo, gci);
client_moveresize(c, geo, True);
frame_update(c);
XUngrabServer(dpy);
}
else
tags[selscreen][seltag[selscreen]].layout.func(c->screen);
client_update_attributes(c);
XUngrabPointer(dpy, CurrentTime);
XFreeGC(dpy, gci);
return;
}
/** Grab buttons
* \param c Client pointer
* \param focused For know if c is or not focused
*/
void
mouse_grabbuttons(Client *c, Bool focused)
{
int i;
uint but[] = {Button1, Button2, Button3, Button4, Button5};
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
if(focused)
for(i = 0; i < LEN(but); ++i)
{
XGrabButton(dpy, but[i], conf.client.mod, c->win, False,
ButtonMask, GrabModeAsync,GrabModeSync, None, None);
XGrabButton(dpy, but[i], conf.client.mod|LockMask, c->win, False,
ButtonMask, GrabModeAsync,GrabModeSync, None, None);
XGrabButton(dpy, but[i], conf.client.mod|numlockmask, c->win, False,
ButtonMask, GrabModeAsync,GrabModeSync, None, None);
XGrabButton(dpy, but[i], conf.client.mod|LockMask|numlockmask, c->win, False,
ButtonMask, GrabModeAsync,GrabModeSync, None, None);
}
else
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
ButtonMask, GrabModeAsync, GrabModeSync, None, None);
return;
}
/** Move the selected client
* \param cmd uicb_t type unused
*/
void
uicb_mouse_move(uicb_t cmd)
{
CHECK(sel);
mouse_move(sel);
return;
}
/** Reisze the selected client
* \param cmd uicb_t type unused
*/
void
uicb_mouse_resize(uicb_t cmd)
{
CHECK(sel);
mouse_resize(sel);
return;
}
-276
View File
@@ -1,276 +0,0 @@
/*
* screen.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Count the screens
*\return the number of screen
*/
int
screen_count(void)
{
int n = 0;
n = ScreenCount(dpy);
#ifdef HAVE_XINERAMA
if(XineramaIsActive(dpy))
XineramaQueryScreens(dpy, &n);
#endif /* HAVE_XINERAMA */
/* Set _WMFS_SCREEN_COUNT */
if(net_atom)
XChangeProperty(dpy, ROOT, net_atom[wmfs_screen_count], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&n, 1);
return n;
}
/** Get screen geometry by number
*\param s Screen number
*\return XRectangle struct
*/
XRectangle
screen_get_geo(int s)
{
int barpos = tags[selscreen][seltag[selscreen]].barpos;
XRectangle geo;
geo.x = BORDH;
if(barpos == IB_Hide || barpos == IB_Bottom)
geo.y = TBARH;
else
geo.y = INFOBARH + TBARH;
geo.height = MAXH - INFOBARH - TBARH;
geo.width = MAXW;
#ifdef HAVE_XINERAMA
if(XineramaIsActive(dpy))
{
XineramaScreenInfo *xsi;
int n = 0;
xsi = XineramaQueryScreens(dpy, &n);
geo.x = xsi[s].x_org + BORDH;
if(barpos == IB_Hide || barpos == IB_Bottom)
geo.y = TBARH;
else
geo.y = xsi[s].y_org + INFOBARH + TBARH;
geo.height = xsi[s].height - INFOBARH - TBARH;
geo.width = xsi[s].width;
XFree(xsi);
}
#endif /* HAVE_XINERAMA */
return geo;
}
/** Get the current screen number with
* coordinated
*\param geo Geometry for get the screen number
*\return The screen number
*/
int
screen_get_with_geo(int x, int y)
{
int i, r = 0;
for(i = 0; i < screen_count(); ++i)
if((x >= spgeo[i].x && x < spgeo[i].x + spgeo[i].width)
&& y >= spgeo[i].y && y < spgeo[i].y + spgeo[i].height)
r = i;
return r;
}
/** Set the selected screen
*\param screen Number of the wanted selected screen
*/
void
screen_set_sel(int screen)
{
if(screen < 0 || screen > screen_count() - 1)
screen = 0;
prevselscreen = selscreen;
client_focus(NULL);
XWarpPointer(dpy, None, ROOT, 0, 0, 0, 0,
sgeo[screen].x + sgeo[screen].width / 2,
sgeo[screen].y + sgeo[screen].height / 2);
selscreen = screen;
return;
}
/** Get and set the selected screen
*\return The number of the selected screen
*/
int
screen_get_sel(void)
{
int os = selscreen;
selscreen = 0;
#ifdef HAVE_XINERAMA
if(XineramaIsActive(dpy))
{
/* Unused variables (except x/y) */
Window w;
int d, x, y;
XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&d);
selscreen = screen_get_with_geo(x, y);
}
#endif /* HAVE_XINERAMA */
/* Set _WMFS_CURRENT_SCREEN */
XChangeProperty(dpy, ROOT, net_atom[wmfs_current_screen], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&selscreen, 1);
if(os != selscreen)
prevselscreen = os;
return selscreen;
}
/** Init screen geo
*/
void
screen_init_geo(void)
{
int i;
int s = screen_count();
sgeo = emalloc(s, sizeof(XRectangle));
spgeo = emalloc(s, sizeof(XRectangle));
for(i = 0; i < s; ++i)
sgeo[i] = screen_get_geo(i);
spgeo[0].x = 0;
spgeo[0].y = 0;
spgeo[0].width = MAXW;
spgeo[0].height = MAXH;
#ifdef HAVE_XINERAMA
XineramaScreenInfo *xsi;
int n;
if(XineramaIsActive(dpy))
{
xsi = XineramaQueryScreens(dpy, &n);
for(i = 0; i < n; ++i)
{
spgeo[i].x = xsi[i].x_org;
spgeo[i].y = xsi[i].y_org;
spgeo[i].width = xsi[i].width;
spgeo[i].height = xsi[i].height;
}
XFree(xsi);
}
#endif /* HAVE_XINERAMA */
#ifdef HAVE_XRANDR
/* Init xrandr stuff */
int d;
XRRSelectInput(dpy, ROOT, 1);
XRRQueryExtension(dpy, &xrandr_event, &d);
#endif /* HAVE_XRANDR */
ewmh_set_desktop_geometry();
ewmh_set_workarea();
return;
}
/** Uicb: screen select
* \param cmd Screen uicb_t type
*/
void
uicb_screen_select(uicb_t cmd)
{
screen_set_sel(atoi(cmd));
return;
}
/** Uicb: screen next
* \param cmd Screen uicb_t type
*/
void
uicb_screen_next(uicb_t cmd)
{
screen_get_sel();
selscreen = (selscreen + 1 > screen_count() - 1) ? 0 : selscreen + 1;
screen_set_sel(selscreen);
return;
}
/** Uicb: screen prev
* \param cmd Screen uicb_t type
*/
void
uicb_screen_prev(uicb_t cmd)
{
screen_get_sel();
selscreen = (selscreen - 1 < 0) ? screen_count() - 1 : selscreen - 1;
screen_set_sel(selscreen);
return;
}
/** Uicb: screen prev sel
* \param cmd uicb_t type unused
*/
void
uicb_screen_prev_sel(uicb_t cmd)
{
screen_get_sel();
screen_set_sel(prevselscreen);
return;
}
-207
View File
@@ -1,207 +0,0 @@
/*
* status.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Check rectangles blocks in str and return properties
* --> \b[x;y;width;height;#color]\
*\param r StatusRec pointer, rectangles properties
*\param str String
*\return n Length of r
*/
int
statustext_rectangle(StatusRec *r, char *str)
{
char as;
int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\b[%d;%d;%d;%d;#%x]%c", &r[n].x, &r[n].y, &r[n].w, &r[n].h, &r[n].color, &as) == 6
&& as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
else if(j != i)
str[j] = str[i];
for(k = j; k < i; str[k++] = 0);
return n;
}
/** Check text blocks in str and return properties
* --> \s[x;y;#color;text]\
*\param s StatusText pointer, text properties
*\param str String
*\return n Length of s
*/
int
statustext_text(StatusText *s, char *str)
{
char as;
int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\s[%d;%d;%7[^;];%512[^]]]%c", &s[n].x, &s[n].y, s[n].color, s[n].text, &as) == 5
&& as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
else if(j != i)
str[j] = str[i];
for(k = j; k < i; str[k++] = 0);
return n;
}
#ifdef HAVE_IMLIB
/** Check images blocks in str and return properties
* --> \i[x;y;w;h;name]\
*\param im ImageAttr pointer, image properties
*\param str String
*\return n Lenght of i
*/
int
statustext_image(ImageAttr *im, char *str)
{
char as;
int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^]]]%c", &im[n].x, &im[n].y, &im[n].w, &im[n].h, im[n].name, &as) == 6
&& as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
else if(j != i)
str[j] = str[i];
for(k = j; k < i; str[k++] = 0);
return n;
}
#endif /* HAVE_IMLIB */
/** Draw normal text and colored normal text
* --> \#color\ text in color
*\param sc Screen
*\param str String
*/
void
statustext_normal(int sc, char *str)
{
char strwc[MAXSTATUS] = { 0 };
char buf[MAXSTATUS] = { 0 };
char col[8] = { 0 };
int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j)
if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\')
{
++n;
i += 8;
--j;
}
else
strwc[j] = str[i];
/* Draw normal text without any blocks */
draw_text(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(strwc),
FHINFOBAR, infobar[sc].bar->fg, 0, strwc);
if(n)
{
strcpy(buf, strwc);
for(i = k = 0; i < strlen(str); ++i, ++k)
if(str[i] == '\\' && str[i + 1] == '#' && str[i + 8] == '\\')
{
/* Store current color in col[] */
for(j = 0, ++i; str[i] != '\\'; col[j++] = str[i++]);
/* Draw a rectangle with the bar color to draw the text properly */
draw_rectangle(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(&buf[k]),
0, INFOBARH - (sgeo[sc].width - SHADH) - textw(&buf[k]),
INFOBARH, conf.colors.bar);
/* Draw text with its color */
draw_text(infobar[sc].bar->dr, (sgeo[sc].width - SHADH) - textw(&buf[k]),
FHINFOBAR, col, 0, &buf[k]);
strcpy(buf, strwc);
++i;
}
}
return;
}
/** Handle statustext and draw all things in infobar of specified screen
*\param sc Screen number
*\param str String
*/
void
statustext_handle(int sc, char *str)
{
char *lastst;
int i, nr, ns, len;
StatusRec r[128];
StatusText s[128];
/* If the str == the current statustext, return (not needed) */
if(!str)
return;
barwin_refresh_color(infobar[sc].bar);
/* save last status text address (for free at the end) */
lastst = infobar[sc].statustext;
infobar[sc].statustext = _strdup(str);
len = ((strlen(str) > MAXSTATUS) ? MAXSTATUS : strlen(str));
/* Store rectangles, located text & images properties. */
nr = statustext_rectangle(r, str);
ns = statustext_text(s, str);
/* Draw normal text (and possibly colored with \#color\ blocks) */
statustext_normal(sc, str);
/* Draw rectangles with stored properties. */
for(i = 0; i < nr; ++i)
draw_rectangle(infobar[sc].bar->dr, r[i].x, r[i].y, r[i].w, r[i].h, r[i].color);
/* Draw located text with stored properties. */
for(i = 0; i < ns; ++i)
draw_text(infobar[sc].bar->dr, s[i].x, s[i].y, s[i].color, 0, s[i].text);
barwin_refresh(infobar[sc].bar);
free(lastst);
return;
}
-453
View File
@@ -1,453 +0,0 @@
/*
* structs.h
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRUCTS_H
#define STRUCTS_H
#include "wmfs.h"
#define NBUTTON 8
#define MAXTAG 36
#define NUM_OF_LAYOUT 10
/* Clients flags definition */
#define FreeFlag (1 << 1)
#define MaxFlag (1 << 2)
#define TileFlag (1 << 3)
#define HideFlag (1 << 4)
#define LMaxFlag (1 << 5)
#define UnmapFlag (1 << 6)
#define HintFlag (1 << 7)
#define FSSFlag (1 << 8)
#define AboveFlag (1 << 9)
/* XEMBED messages */
#define XEMBED_MAPPED (1 << 0)
#define XEMBED_EMBEDDED_NOTIFY 0
#define XEMBED_WINDOW_ACTIVATE 1
#define XEMBED_WINDOW_DEACTIVATE 2
#define XEMBED_REQUEST_FOCUS 3
#define XEMBED_FOCUS_IN 4
#define XEMBED_FOCUS_OUT 5
#define XEMBED_FOCUS_NEXT 6
#define XEMBED_FOCUS_PREV 7
/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
#define XEMBED_MODALITY_ON 10
#define XEMBED_MODALITY_OFF 11
#define XEMBED_REGISTER_ACCELERATOR 12
#define XEMBED_UNREGISTER_ACCELERATOR 13
#define XEMBED_ACTIVATE_ACCELERATOR 14
/* Details for XEMBED_FOCUS_IN: */
#define XEMBED_FOCUS_CURRENT 0
#define XEMBED_FOCUS_FIRST 1
#define XEMBED_FOCUS_LAST 2
/* Typedef */
typedef const char* uicb_t;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned short ushort;
typedef unsigned char uchar;
/* Enum */
enum { CurNormal, CurResize, CurRightResize, CurLeftResize, CurMove, CurLast };
/* Infobar position */
enum { IB_Hide = 0, IB_Bottom = 1, IB_Top = 2 };
typedef enum { Right, Left, Top, Bottom, Center, PositionLast } Position;
/* Ewmh hints list */
enum
{
net_supported,
net_wm_name,
net_client_list,
net_frame_extents,
net_number_of_desktops,
net_current_desktop,
net_desktop_names,
net_desktop_geometry,
net_workarea,
net_active_window,
net_close_window,
net_wm_icon_name,
net_wm_window_type,
net_wm_pid,
net_showing_desktop,
net_supporting_wm_check,
net_wm_window_type_normal,
net_wm_window_type_dock,
net_wm_window_type_splash,
net_wm_window_type_dialog,
net_wm_desktop,
net_wm_icon,
net_wm_state,
net_wm_state_fullscreen,
net_wm_state_demands_attention,
utf8_string,
/* WMFS HINTS */
wmfs_running,
wmfs_update_hints,
wmfs_update_status,
wmfs_current_tag,
wmfs_current_screen,
wmfs_current_layout,
wmfs_tag_list,
wmfs_mwfact,
wmfs_nmaster,
wmfs_set_screen,
wmfs_screen_count,
wmfs_function,
wmfs_cmd,
wmfs_statustext,
net_last
};
/*
* BarWindow Structure
* (titlebar, infobar..)
*/
typedef struct
{
Window win;
Drawable dr;
struct
{
/* Border Window */
Window left, right, top, bottom;
/* Border color */
uint dark, light;
} border;
uint bg;
char *fg;
uint stipple_color;
XRectangle geo;
Bool mapped, stipple, bord;
} BarWindow;
/* Client Structure. */
typedef struct Client Client;
struct Client
{
/* Client title */
char *title;
/* Tag num */
uint tag;
/* Screen */
int screen;
/* Layer */
int layer;
/* Window attribute */
XRectangle geo;
XRectangle tmp_geo;
XRectangle frame_geo;
/* Old window attribute */
XRectangle ogeo;
/* Free window attribute */
XRectangle free_geo;
/* For resizehint usage */
int basew, baseh, incw, inch;
int maxw, maxh, minw, minh;
int minax, maxax, minay, maxay;
/* Client composant {{{ */
Window win;
Window *button;
int button_last_x;
BarWindow *titlebar;
Window frame, resize[2];
/* Border */
Window right, left, top, bottom;
/* }}} */
struct
{
uint frame;
char *fg;
uint resizecorner;
} colors;
/* Client Information by flags */
uint flags;
/* Struct in chains */
Client *next;
Client *prev;
};
/* Keybind Structure */
typedef struct
{
uint mod;
KeySym keysym;
void (*func)(uicb_t);
uicb_t cmd;
} Key;
/* Mouse Binding Struct */
typedef struct
{
int tag;
int screen;
uint button;
void (*func)(uicb_t);
uicb_t cmd;
} MouseBinding;
/* InfoBar Struct */
typedef struct
{
BarWindow *bar, *selbar;
BarWindow *layout_button;
BarWindow *tags_board, *tags[MAXTAG];
XRectangle geo;
int position;
char *statustext;
} InfoBar;
/* Layout Structure */
typedef struct
{
char *symbol;
void (*func)(int screen);
} Layout;
/* Tag Structure */
typedef struct
{
char *name;
char **clients;
int nclients;
int layers;
float mwfact;
int nmaster;
Bool resizehint;
Bool request_update;
Bool abovefc;
int barpos;
Layout layout;
} Tag;
/* Menu Item Struct */
typedef struct
{
char *name;
void (*func)(uicb_t);
uicb_t cmd;
} MenuItem;
/* Menu Struct */
typedef struct
{
/* Name of the menu for call
* it in the conf (function = "menu"
* menu = "<name>").
*/
char *name;
/* Placement */
Bool place_at_mouse;
int x, y;
/* Color */
struct
{
struct { uint bg; char *fg; } focus;
struct { uint bg; char *fg; } normal;
} colors;
/* Number of item */
int nitem, focus_item;
/* Item */
MenuItem *item;
} Menu;
/* Launcher struct */
typedef struct
{
char *name;
char *prompt;
char *command;
} Launcher;
/* Button struct */
typedef struct
{
MouseBinding *mouse;
XSegment *linecoord;
int nlines;
int nmouse;
uint flags;
} Button;
/* Alias struct */
typedef struct
{
char *name;
char *content;
} Alias;
/* Configuration structure */
typedef struct
{
/* Configuration file path */
char confpath[512];
/* Misc option */
char *font;
Bool raisefocus;
Bool raiseswitch;
Bool focus_fmouse;
Bool ignore_next_client_rules;
uint pad;
int status_timing;
char *status_path;
struct
{
/*
* Only the colors will be use for text
* are 'char*' (for xprint -> XftColorAllocName)
*/
uint bar;
char *text;
char *tagselfg;
uint tagselbg;
uint tag_occupied_bg;
uint tagbord;
char *layout_fg;
uint layout_bg;
} colors;
struct
{
int height;
MouseBinding *mouse;
int nmouse;
Bool selbar;
} bars;
struct
{
char *background_command;
MouseBinding *mouse;
int nmouse;
} root;
struct
{
Bool set_new_win_master;
Bool place_at_mouse;
Bool border_shadow;
int borderheight;
uint bordernormal;
uint borderfocus;
uint resizecorner_normal;
uint resizecorner_focus;
uint mod;
MouseBinding *mouse;
int nmouse;
} client;
struct
{
int height;
char *fg_normal;
char *fg_focus;
struct
{
Bool active;
struct { uint normal, focus; } colors;
} stipple;
MouseBinding *mouse;
int nmouse;
Button *button;
int nbutton;
} titlebar;
struct
{
Bool bar;
Bool tag;
Bool layout;
} border;
Alias alias[256];
Layout layout[NUM_OF_LAYOUT];
Menu *menu;
Launcher *launcher;
int *ntag;
Bool tag_round;
Bool layout_system; /* Switch: False, Menu: True. */
Bool layout_placement; /* Right (normal): False, Left: True. */
/* Number of... */
int nkeybind;
int nlayout;
int nmenu;
int nlauncher;
} Conf;
typedef struct
{
uint x, y, w, h;
uint color;
} StatusRec;
typedef struct
{
uint x, y;
char color[8];
char text[512];
} StatusText;
typedef struct
{
uint x, y, w, h;
char name[512];
} ImageAttr;
/* Config.c struct */
typedef struct
{
char *name;
void *func;
} func_name_list_t;
typedef struct
{
char *name;
KeySym keysym;
} key_name_list_t;
typedef struct
{
char *name;
uint button;
} name_to_uint_t;
typedef struct
{
char *cmd;
char *uicb;
} vicmd_to_uicb;
#endif /* STRUCTS_H */
-225
View File
@@ -1,225 +0,0 @@
/*
* tag.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/* Set the tag
* \param tag The tag number
*/
void
tag_set(int tag)
{
Client *c;
screen_get_sel();
prevseltag[selscreen] = seltag[selscreen];
if(conf.tag_round)
{
if(tag <= 0)
seltag[selscreen] = conf.ntag[selscreen];
else if(tag > conf.ntag[selscreen])
seltag[selscreen] = 1;
else
seltag[selscreen] = tag;
}
else
{
if(!tag || tag == seltag[selscreen]
|| tag > conf.ntag[selscreen])
return;
seltag[selscreen] = tag;
}
ewmh_update_current_tag_prop();
/* Arrange infobar position */
if(tags[selscreen][prevseltag[selscreen]].barpos != tags[selscreen][seltag[selscreen]].barpos)
infobar_set_position(tags[selscreen][seltag[selscreen]].barpos);
arrange(selscreen, False);
if(tags[selscreen][tag].request_update)
{
tags[selscreen][seltag[selscreen]].layout.func(selscreen);
tags[selscreen][tag].request_update = False;
}
/* To focus the first client in the new tag */
for(c = clients; c; c = c->next)
if(c->tag == seltag[selscreen] && c->screen == selscreen)
break;
client_focus((c) ? c : NULL);
return;
}
/* Transfert a client to a tag
* \param c Client pointer
* \param tag Tag
*/
void
tag_transfert(Client *c, int tag)
{
screen_get_sel();
CHECK(c);
if(!tag)
tag = 1;
c->tag = tag;
c->screen = selscreen;
arrange(c->screen, True);
if(c == sel && c->tag != tag)
client_focus(NULL);
client_update_attributes(c);
tags[c->screen][tag].request_update = True;
return;
}
/** Uicb Set a tag
* \param cmd Tag number or '+' / '-', uicb_t type
*/
void
uicb_tag(uicb_t cmd)
{
int tmp = atoi(cmd);
if(cmd[0] == '+' || cmd[0] == '-')
tag_set(seltag[selscreen] + tmp);
else
tag_set(tmp);
return;
}
/** Set the next tag
* \param cmd uicb_t type unused
*/
void
uicb_tag_next(uicb_t cmd)
{
screen_get_sel();
tag_set(seltag[selscreen] + 1);
return;
}
/** Set the previous tag
* \param cmd uicb_t type unused
*/
void
uicb_tag_prev(uicb_t cmd)
{
screen_get_sel();
tag_set(seltag[selscreen] - 1);
return;
}
/** Transfert the selected client to
* the wanted tag
* \param cmd Wanted tag, uicb_t type
*/
void
uicb_tagtransfert(uicb_t cmd)
{
CHECK(sel);
tag_transfert(sel, atoi(cmd));
return;
}
/** Set the previous selected tag
* \param cmd uicb_t type unused
*/
void
uicb_tag_prev_sel(uicb_t cmd)
{
screen_get_sel();
tag_set(prevseltag[selscreen]);
return;
}
/** Transfert the selected client to the next tag
* \param cmd uicb_t type unused
*/
void
uicb_tagtransfert_next(uicb_t cmd)
{
CHECK(sel);
int tag = seltag[selscreen] + 1;
if(tag > conf.ntag[selscreen])
{
if(!conf.tag_round)
return;
tag = 1;
}
tag_transfert(sel, tag);
return;
}
/** Transfert the selected client to the prev tag
* \param cmd uicb_t type unused
*/
void
uicb_tagtransfert_prev(uicb_t cmd)
{
CHECK(sel);
int tag = seltag[selscreen] - 1;
if(tag <= 0)
{
if(!conf.tag_round)
return;
tag = conf.ntag[selscreen];
}
tag_transfert(sel, tag);
return;
}
-292
View File
@@ -1,292 +0,0 @@
/*
* util.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Calloc with an error message if there is a probleme
* \param element Element
* \param size Size
* \return void pointer
*/
void*
emalloc(uint element, uint size)
{
void *ret = calloc(element, size);
if(!ret)
warn("calloc()");
return ret;
}
/** Get a color with a string
* \param color Color string
* \return Color pixel
*/
long
getcolor(char *color)
{
XColor xcolor;
if(!XAllocNamedColor(dpy, DefaultColormap(dpy, SCREEN), color, &xcolor, &xcolor))
warnx("Error: cannot allocate color \"%s\".", color);
return xcolor.pixel;
}
/** Enlight an hexadecimal color
* \param col Color
* \return The clarified color
*/
ulong
color_enlight(ulong col)
{
if((col + 0x330000) < 0xffffff
&& (col + 0x003300) < 0xffffff
&& (col + 0x000033) < 0xffffff)
return col + 0x333333;
else
return col;
}
/** Set the window WM State
* \param win Window target
* \param state WM State
*/
void
setwinstate(Window win, long state)
{
long data[] = {state, None};
XChangeProperty(dpy, win, ATOM("WM_STATE"), ATOM("WM_STATE"), 32,
PropModeReplace, (uchar *)data, 2);
return;
}
/** My strdup. the strdup of string.h isn't ansi compatible..
* Thanks linkdd.
* \param str char pointer
*/
char*
_strdup(const char *str)
{
char *ret = emalloc(strlen(str) + 1, sizeof(char));
strcpy(ret, str);
return ret;
}
/* The following function are for configuration
usage. {{{
*/
void*
name_to_func(char *name, const func_name_list_t *l)
{
int i;
if(name)
for(i = 0; l[i].name ; ++i)
if(!strcmp(name, l[i].name))
return l[i].func;
return NULL;
}
ulong
char_to_modkey(char *name, key_name_list_t key_l[])
{
int i;
if(name)
for(i = 0; key_l[i].name; ++i)
if(!strcmp(name, key_l[i].name))
return key_l[i].keysym;
return NoSymbol;
}
uint
char_to_button(char *name, name_to_uint_t blist[])
{
int i;
if(name)
for(i = 0; blist[i].name; ++i)
if(!strcmp(name, blist[i].name))
return blist[i].button;
return 0;
}
Layout
layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t llist[])
{
int i;
for(i = 0; i < n; ++i)
if(lt[i].func == name_to_func(name, llist))
return lt[i];
return lt[0];
}
char*
alias_to_str(char *conf_choice)
{
int i;
char *tmpchar = NULL;
if(!conf_choice)
return 0;
if(conf.alias)
for(i = 0; conf.alias[i].name; i++)
if(!strcmp(conf_choice, conf.alias[i].name))
tmpchar = conf.alias[i].content;
if(tmpchar)
return _strdup(tmpchar);
else
return _strdup(conf_choice);
return NULL;
}
/* }}} */
/** Get the mouse pointer position.
*/
XRectangle
get_mouse_pos(void)
{
Window dum;
int d, u;
XRectangle ret;
XQueryPointer(dpy, ROOT, &dum, &dum, (int*)&ret.x, (int*)&ret.y, &d, &d, (uint *)&u);
return ret;
}
/** Execute a sh command
* \param cmd Command
*/
void
spawn(const char *format, ...)
{
char *sh = NULL;
char cmd[512];
va_list ap;
if(strlen(format) > 511)
{
warnx("spawn(): Error, command too long.");
return;
}
va_start(ap, format);
vsprintf(cmd, format, ap);
va_end(ap);
if(!strlen(cmd))
return;
if(!(sh = getenv("SHELL")))
sh = "/bin/sh";
if(fork() == 0)
{
if(fork() == 0)
{
if(dpy)
close(ConnectionNumber(dpy));
setsid();
execl(sh, sh, "-c", cmd, (char*)NULL);
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}
return;
}
/** Swap two pointer.
*\param x First pointer
*\param y Second pointer
*/
void
swap_ptr(void **x, void **y)
{
void *t = *x;
*x = *y;
*y = t;
return;
}
/** Execute a sh command
* \param cmd Command (uicb_t type)
*/
void
uicb_spawn(uicb_t cmd)
{
spawn("%s", cmd);
}
#ifdef HAVE_IMLIB
/** Check images blocks in str and return properties
* --> \i[x;y;w;h;name]\
*\param im ImageAttr pointer, image properties
*\param str String
*\return n Lenght of i
*/
int
parse_image_block(ImageAttr *im, char *str)
{
char as;
int n, i, j, k;
for(i = j = n = 0; i < strlen(str); ++i, ++j)
if(sscanf(&str[i], "\\i[%d;%d;%d;%d;%512[^]]]%c", &im[n].x, &im[n].y, &im[n].w, &im[n].h, im[n].name, &as) == 6
&& as == '\\')
for(++n, ++i, --j; str[i] != as || str[i - 1] != ']'; ++i);
else if(j != i)
str[j] = str[i];
for(k = j; k < i; str[k++] = 0);
return n;
}
#endif /* HAVE_IMLIB */
-143
View File
@@ -1,143 +0,0 @@
/*
* viwmfs.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
vicmd_to_uicb vicmd[] =
{
{"r", "reload"},
{"q", "quit"},
{"t", "tag"},
{"tn", "tag_next"},
{"tp", "tag_prev"},
{"l", "set_layout"},
{"layout", "set_layout"},
{"ln", "layout_next"},
{"lp", "layout_prev"},
{"s", "screen_select"},
{"screen", "screen_select"},
{"sn", "screen_next"},
{"sp", "screen_prev"},
{"cc", "client_kill"},
{"ct", "tag_transfert"},
{"ctn", "tag_transfert_next"},
{"ctp", "tag_transfert_prev"},
{"cn", "client_next"},
{"cp", "client_prev"},
{"csn", "client_swap_next"},
{"csp", "client_swap_prev"},
{"mwf", "set_mwfact"},
{"mwfact", "set_mwfact"},
{"nmaster", "set_nmaster"},
{"tm", "toggle_max"},
{"tf", "toggle_free"},
};
void
viwmfs_help(void)
{
int i;
char s[20];
printf("ViWMFS commands list:\n");
for(i = 0; i < LEN(vicmd); ++i)
{
memset(s, ' ', sizeof(s));
s[15 - strlen(vicmd[i].cmd)] = '\0';
printf(" :%s%s %s\n", vicmd[i].cmd, s, vicmd[i].uicb);
}
return;
}
void
viwmfs(int argc, char **argv)
{
int i;
char *cmd, str[256] = { 0 };
Bool e;
if(!argc)
return;
if(argc > 3)
{
for(i = 2; i < argc; ++i)
{
strcat(str, argv[i]);
if(*(str + strlen(str) - 1) != ':')
strcat(str, " ");
}
}
else
strcpy(str, argv[2]);
if(!strcmp(str, "help"))
{
viwmfs_help();
return;
}
if(*str == ':')
{
for(i = 0; i < strlen(str); str[i] = str[i + 1], ++i);
cmd = _strdup(str);
for(i = 0; cmd[i] && cmd[i] != ' '; ++i);
cmd[i] = '\0';
for(i = 0; i < LEN(vicmd); ++i)
if(!strncmp(cmd, vicmd[i].cmd, strlen(cmd)))
{
exec_uicb_function(vicmd[i].uicb, clean_value(str + strlen(cmd)));
e = True;
break;
}
/* For uicb function with normal name specified */
if(!e)
{
if(!strcmp(str, "h") || !strcmp(str, "help"))
viwmfs_help();
else
exec_uicb_function(cmd, str + strlen(cmd));
}
}
return;
}
-527
View File
@@ -1,527 +0,0 @@
/*
* wmfs.c
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
int
errorhandler(Display *d, XErrorEvent *event)
{
char mess[256];
Client *c;
/* Check if there is another WM running */
if(BadAccess == event->error_code
&& ROOT == event->resourceid)
errx(EXIT_FAILURE, "Another Window Manager is already running.");
/* Ignore focus change error for unmapped client */
/* Too lazy to add Xproto.h so:
* 42 = X_SetInputFocus
* 28 = X_GrabButton
*/
if((c = client_gb_win(event->resourceid)))
if(event->error_code == BadWindow
|| event->request_code == 42
|| event->request_code == 28)
return 0;
XGetErrorText(d, event->error_code, mess, 128);
warnx("%s(%d) opcodes %d/%d\n resource #%lx\n", mess,
event->error_code,
event->request_code,
event->minor_code,
event->resourceid);
return 1;
}
int
errorhandlerdummy(Display *d, XErrorEvent *event)
{
return 0;
}
/** Clean wmfs before the exit
*/
void
quit(void)
{
Client *c;
int i;
/* Set the silent error handler */
XSetErrorHandler(errorhandlerdummy);
/* Unmanage all clients */
for(c = clients; c; c = c->next)
{
client_unhide(c);
XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y);
}
IFREE(tags);
IFREE(seltag);
XftFontClose(dpy, font);
for(i = 0; i < CurLast; ++i)
XFreeCursor(dpy, cursor[i]);
XFreeGC(dpy, gc_stipple);
infobar_destroy();
IFREE(sgeo);
IFREE(spgeo);
IFREE(infobar);
IFREE(keys);
IFREE(func_list);
IFREE(net_atom);
/* Clean conf alloced thing */
IFREE(menulayout.item);
if(conf.menu)
{
for(i = 0; i < LEN(conf.menu); ++i)
IFREE(conf.menu[i].item);
IFREE(conf.menu);
}
IFREE(conf.launcher);
IFREE(conf.ntag);
IFREE(conf.titlebar.mouse);
for(i = 0; i < conf.titlebar.nbutton; ++i)
{
IFREE(conf.titlebar.button[i].mouse);
IFREE(conf.titlebar.button[i].linecoord);
}
IFREE(conf.bars.mouse);
IFREE(conf.titlebar.button);
IFREE(conf.client.mouse);
IFREE(conf.root.mouse);
XSync(dpy, False);
XCloseDisplay(dpy);
return;
}
void *
thread_process(void *arg)
{
XEvent ev;
/* X event loop */
if(!(int*)arg)
{
while(!exiting && !XNextEvent(dpy, &ev))
getevent(ev);
pthread_exit(0);
}
/* Status checking loop with timing */
else
{
while(!exiting)
{
spawn(conf.status_path);
sleep(conf.status_timing);
}
pthread_exit(0);
}
}
/** WMFS main loop.
*/
void
mainloop(void)
{
XEvent ev;
pthread_t evloop, evstatus;
void *ret;
if(!estatus)
while(!exiting && !XNextEvent(dpy, &ev))
getevent(ev);
else
{
pthread_create(&evloop, NULL, thread_process, "1");
pthread_create(&evstatus, NULL, thread_process, NULL);
(void)pthread_join(evloop, &ret);
(void)pthread_join(evstatus, &ret);
}
return;
}
/** Set the exiting variable to True
* for stop the main loop
* \param cmd unused uicb_t
*/
void
uicb_quit(uicb_t cmd)
{
exiting = True;
return;
}
/** Scan if there are windows on X
* for manage it
*/
void
scan(void)
{
uint i, n;
XWindowAttributes wa;
Window usl, usl2, *w = NULL;
Atom rt;
int s, rf, tag = -1, screen = -1, free = -1;
ulong ir, il;
uchar *ret;
Client *c;
s = screen_count();
if(XQueryTree(dpy, ROOT, &usl, &usl2, &w, &n))
for(i = n - 1; i != -1; --i)
if(XGetWindowAttributes(dpy, w[i], &wa)
&& !(wa.override_redirect || XGetTransientForHint(dpy, w[i], &usl))
&& wa.map_state == IsViewable)
{
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_TAG"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
tag = *ret;
XFree(ret);
}
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_SCREEN"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
screen = *ret;
XFree(ret);
}
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_ISFREE"), 0, 32,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
{
free = *ret;
XFree(ret);
}
c = client_manage(w[i], &wa, False);
if(tag != -1)
c->tag = tag;
if(screen != -1 && screen <= s - 1)
c->screen = screen;
if(free != -1)
c->flags |= (free) ? FreeFlag : 0;
client_update_attributes(c);
}
/* Set update layout request */
for(c = clients; c; c = c->next)
{
if(c->tag > conf.ntag[c->screen])
c->tag = conf.ntag[c->screen];
tags[c->screen][c->tag].request_update = True;
}
for(i = 0; i < s; ++i)
arrange(i, True);
XFree(w);
return;
}
/** Reload the WMFS with the new configuration
* file changement *TESTING*
*/
void
uicb_reload(uicb_t cmd)
{
quit();
for(; argv_global[0] && argv_global[0] == ' '; ++argv_global);
execlp(argv_global, argv_global, NULL);
return;
}
/** Check if wmfs is running (for functions that will be
execute when wmfs will be already running).
\return False if wmfs is not running
*/
Bool
check_wmfs_running(void)
{
Atom rt;
int rf;
ulong ir, il;
uchar *ret;
XGetWindowProperty(dpy, ROOT, ATOM("_WMFS_RUNNING"), 0L, 4096,
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret);
if(!ret)
{
XFree(ret);
warnx("Wmfs is not running. (_WMFS_RUNNING not present)");
return False;
}
XFree(ret);
return True;
}
/** Execute an uicb function
*\param func Function name
*\param cmd Function's command
*\return 0 if there is an error
*/
void
exec_uicb_function(char *func, char *cmd)
{
long data[5];
/* Check if wmfs is running (this function is executed when wmfs
is already running normally...) */
if(!check_wmfs_running())
return;
data[4] = True;
XChangeProperty(dpy, ROOT, ATOM("_WMFS_FUNCTION"), ATOM("UTF8_STRING"),
8, PropModeReplace, (uchar*)func, strlen(func));
if(cmd == NULL)
cmd = "";
XChangeProperty(dpy, ROOT, ATOM("_WMFS_CMD"), ATOM("UTF8_STRING"),
8, PropModeReplace, (uchar*)cmd, strlen(cmd));
send_client_event(data, "_WMFS_FUNCTION");
return;
}
/** Set statustext
*\param str Statustext string
*/
void
set_statustext(int s, char *str)
{
int i;
long data[5];
char atom_name[64];
data[4] = True;
if(!str)
return;
if(s == -1)
{
for(i = 0; i < screen_count(); ++i)
{
sprintf(atom_name, "_WMFS_STATUSTEXT_%d", i);
XChangeProperty(dpy, ROOT, ATOM(atom_name), ATOM("UTF8_STRING"),
8, PropModeReplace, (uchar*)str, strlen(str));
send_client_event(data, atom_name);
}
}
else
{
sprintf(atom_name, "_WMFS_STATUSTEXT_%d", s);
XChangeProperty(dpy, ROOT, ATOM(atom_name), ATOM("UTF8_STRING"),
8, PropModeReplace, (uchar*)str, strlen(str));
send_client_event(data, atom_name);
}
return;
}
/** Update status script by ewmh hint
*/
void
update_status(void)
{
long data[5];
if(!check_wmfs_running())
return;
data[4] = True;
send_client_event(data, "_WMFS_UPDATE_STATUS");
return;
}
/** Signal handle function
*/
void
signal_handle(int sig)
{
exiting = True;
quit();
exit(EXIT_SUCCESS);
return;
}
/** main function
* \param argc ?
* \param argv ?
* \return 0
*/
int
main(int argc, char **argv)
{
int i;
char *ol = "csgVS";
argv_global = _strdup(argv[0]);
sprintf(conf.confpath, "%s/"DEF_CONF, getenv("HOME"));
while((i = getopt(argc, argv, "hviSc:s:g:C:V:")) != -1)
{
/* For options who need WMFS running */
if(strchr(ol, i) && !(dpy = XOpenDisplay(NULL)))
errx(EXIT_FAILURE, "cannot open X server.");
switch(i)
{
case 'h':
default:
printf("usage: %s [-ihvS] [-C <file>] [-c <uicb function> <cmd> ] [-g <argument>] [-s <screen_num> <string>] [-V <viwmfs cmd]\n"
" -C <file> Load a configuration file\n"
" -c <uicb_function> <cmd> Execute an uicb function to control WMFS\n"
" -g <argument> Show information about wmfs status\n"
" -s <screen_num> <string> Set the bar(s) statustext\n"
" -V <viwmfs cmd> Manage WMFS with vi-like command\n"
" -S Update status script\n"
" -h Show this page\n"
" -i Show informations\n"
" -v Show WMFS version\n", argv[0]);
exit(EXIT_SUCCESS);
break;
case 'i':
printf("WMFS - Window Manager From Scratch By Martin Duquesnoy\n");
exit(EXIT_SUCCESS);
break;
case 'v':
printf("WMFS version : "WMFS_VERSION"\n"
" Compilation settings :\n"
" - Flags : "WMFS_COMPILE_FLAGS"\n"
" - Linked Libs : "WMFS_LINKED_LIBS"\n"
" - On "WMFS_COMPILE_MACHINE" by "WMFS_COMPILE_BY".\n");
exit(EXIT_SUCCESS);
break;
case 'S':
update_status();
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
case 'C':
strcpy(conf.confpath, optarg);
break;
case 'c':
exec_uicb_function(argv[2], ((argv[3]) ? argv[3] : NULL));
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
case 's':
if(argc > 3)
set_statustext(atoi(optarg), argv[3]);
else
set_statustext(-1, optarg);
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
case 'g':
getinfo(optarg);
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
case 'V':
viwmfs(argc, argv);
XCloseDisplay(dpy);
exit(EXIT_SUCCESS);
break;
}
}
/* Check if WMFS can open X server */
if(!(dpy = XOpenDisplay(NULL)))
errx(EXIT_FAILURE, "cannot open X server.");
/* Set signal handler */
(void)signal(SIGTERM, &signal_handle);
(void)signal(SIGINT, &signal_handle);
/* Check if an other WM is already running; set the error handler */
XSetErrorHandler(errorhandler);
/* Let's Go ! */
init();
scan();
mainloop();
quit();
return 0;
}
-416
View File
@@ -1,416 +0,0 @@
/*
* wmfs.h
* Copyright © 2008, 2009 Martin Duquesnoy <xorg62@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WMFS_H
#define WMFS_H
/* Lib headers */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <time.h>
#include <getopt.h>
#include <dirent.h>
#include <err.h>
#include <pthread.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/Xft/Xft.h>
/* Local headers */
#include "confparse/confparse.h"
#include "config.h"
#include "structs.h"
/* Optional dependencies */
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif /* HAVE_XINERAMA */
#ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif /* HAVE_XRANDR */
#ifdef HAVE_IMLIB
#include <Imlib2.h>
#endif /* HAVE_IMLIB */
/* MACRO */
#define ButtonMask (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
#define MouseMask (ButtonMask | PointerMotionMask)
#define KeyMask (KeyPressMask | KeyReleaseMask)
#define SCREEN DefaultScreen(dpy)
#define ROOT RootWindow(dpy, SCREEN)
#define MAXH DisplayHeight(dpy, DefaultScreen(dpy))
#define MAXW DisplayWidth(dpy, DefaultScreen(dpy))
#define INFOBARH ((conf.bars.height > 0) ? conf.bars.height : (font->height * 1.5))
#define FHINFOBAR ((font->height - font->descent) + (INFOBARH - font->height) / 2)
#define SHADH (1)
#define SHADC (0x000000) /* 'Cause i don't know how darken a color yet */
#define BORDH conf.client.borderheight
#define TBARH ((conf.titlebar.height < BORDH) ? BORDH : conf.titlebar.height)
#define RESHW (6 * BORDH)
#define BUTTONWH (TBARH / 2)
#define DEF_CONF ".config/wmfs/wmfsrc"
#define DEF_STATUS ".config/wmfs/status.sh"
#define PAD conf.pad
#define MAXSTATUS 4096
#define CWIN(win, parent, x, y, w, h, b, mask, col, at) \
do { \
win = XCreateWindow(dpy, (parent), (x), (y), (w), (h), (b), CopyFromParent, \
InputOutput, CopyFromParent, (mask), (at)); \
XSetWindowBackground(dpy, win, (col)); \
} while (/* CONSTCOND */ 0)
#define ATOM(a) XInternAtom(dpy, (a), False)
#define FRAMEW(w) ((w) + BORDH * 2)
#define FRAMEH(h) ((h) + (BORDH + TBARH))
#define ROUND(x) (float)((x > 0) ? x + (float)0.5 : x - (float)0.5)
#define CHECK(x) if(!(x)) return
#define IFREE(x) if(x) free(x)
#define LEN(x) (sizeof(x) / sizeof((x)[0]))
/* barwin.c */
BarWindow *barwin_create(Window parent,
int x, int y,
uint w, uint h,
uint bg, char*fg,
Bool entermask,
Bool stipple,
Bool border);
void barwin_draw_text(BarWindow *bw, int x, int y, char *text);
void barwin_delete(BarWindow *bw);
void barwin_delete_subwin(BarWindow *bw);
void barwin_map(BarWindow *bw);
void barwin_map_subwin(BarWindow *bw);
void barwin_unmap(BarWindow *bw);
void barwin_unmap_subwin(BarWindow *bw);
void barwin_move(BarWindow *bw, int x, int y);
void barwin_resize(BarWindow *bw, uint w, uint h);
void barwin_refresh_color(BarWindow *bw);
void barwin_refresh(BarWindow *bw);
/* draw.c */
void draw_text(Drawable d, int x, int y, char* fg, int pad, char *str);
void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
#ifdef HAVE_IMLIB
void draw_image(Drawable dr, int x, int y, int w, int h, char *name);
#endif /* HAVE_IMLIB */
ushort textw(char *text);
/* infobar.c */
void infobar_init(void);
void infobar_draw(int sc);
void infobar_draw_layout(int sc);
void infobar_draw_selbar(int sc);
void infobar_draw_taglist(int sc);
void infobar_destroy(void);
void infobar_set_position(int pos);
void uicb_infobar_togglepos(uicb_t);
/* client.c */
void client_attach(Client *c);
void client_configure(Client *c);
void client_detach(Client *c);
void client_above(Client *c);
void client_focus(Client *c);
Client* client_get_next(void);
Client* client_get_prev(void);
/* client_gb_*() {{{ */
Client* client_gb_win(Window w);
Client* client_gb_frame(Window w);
Client* client_gb_titlebar(Window w);
Client* client_gb_resize(Window w);
Client* client_gb_button(Window w, int *n);
/* }}} */
void client_get_name(Client *c);
void client_hide(Client *c);
void client_kill(Client *c);
Bool ishide(Client *c, int screen);
void client_map(Client *c);
Client* client_manage(Window w, XWindowAttributes *wa, Bool ar);
void client_geo_hints(XRectangle *geo, Client *c);
void client_moveresize(Client *c, XRectangle geo, Bool r);
void client_maximize(Client *c);
void client_size_hints(Client *c);
void client_swap(Client *c1, Client *c2);
void client_raise(Client *c);
void client_unhide(Client *c);
void client_unmanage(Client *c);
void client_unmap(Client *c);
void client_set_wanted_tag(Client *c);
void client_update_attributes(Client *c);
void uicb_client_raise(uicb_t);
void uicb_client_next(uicb_t);
void uicb_client_prev(uicb_t);
void uicb_client_swap_next(uicb_t);
void uicb_client_swap_prev(uicb_t);
void uicb_client_kill(uicb_t);
void uicb_client_screen_next(uicb_t);
void uicb_client_screen_prev(uicb_t);
void uicb_client_move(uicb_t cmd);
void uicb_client_resize(uicb_t cmd);
void uicb_ignore_next_client_rules(uicb_t cmd);
/* ewmh.c */
void ewmh_init_hints(void);
void ewmh_get_number_of_desktop(void);
void ewmh_update_current_tag_prop(void);
void ewmh_get_client_list(void);
void ewmh_get_desktop_names(void);
void ewmh_set_desktop_geometry(void);
void ewmh_set_workarea(void);
void ewmh_manage_net_wm_state(long data_l[], Client *c);
void ewmh_manage_window_type(Client *c);
/* frame.c */
void frame_create(Client *c);
void frame_delete(Client *c);
void frame_moveresize(Client *c, XRectangle geo);
void frame_update(Client *c);
/* config.c */
void init_conf(void);
/* event.c */
void buttonpress(XButtonEvent *ev);
void configureevent(XConfigureRequestEvent *ev);
void clientmessageevent(XClientMessageEvent *ev);
void destroynotify(XDestroyWindowEvent *ev);
void enternotify(XCrossingEvent *ev);
void expose(XExposeEvent *ev);
void focusin(XFocusChangeEvent *ev);
void grabkeys(void);
void keypress(XKeyPressedEvent *ev);
void mappingnotify(XMappingEvent *ev);
void maprequest(XMapRequestEvent *ev);
void propertynotify(XPropertyEvent *ev);
void unmapnotify(XUnmapEvent *ev);
void send_client_event(long data[5], char *atom_name);
void getevent(XEvent ev);
/* menu.c */
void menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n);
void menu_new_item(MenuItem *mi, char *name, void *func, char *cmd);
void menu_draw(Menu menu, int x, int y);
Bool menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[]);
void menu_focus_item(Menu *menu, int item, BarWindow *winitem[]);
void menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[]);
int menu_get_longer_string(MenuItem *mt, int nitem);
void uicb_menu(uicb_t cmd);
/* launcher.c */
void launcher_execute(Launcher launcher);
void uicb_launcher(uicb_t);
/* mouse.c */
void mouse_dragborder(XRectangle geo, GC g);
void mouse_move_tile_client(Client **c);
void mouse_move_tag_client(Client *c);
void mouse_move(Client *c);
void mouse_resize(Client *c);
void mouse_grabbuttons(Client *c, Bool focused);
void uicb_mouse_move(uicb_t);
void uicb_mouse_resize(uicb_t);
/* util.c */
ulong color_enlight(ulong col);
void *emalloc(uint element, uint size);
long getcolor(char *color);
void setwinstate(Window win, long state);
char* _strdup(char const *str);
/* Conf usage {{{ */
void* name_to_func(char *name, const func_name_list_t *l);
ulong char_to_modkey(char *name, key_name_list_t key_l[]);
uint char_to_button(char *name, name_to_uint_t blist[]);
Layout layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t llist[]);
char* alias_to_str(char *conf_choice);
/* }}} */
XRectangle get_mouse_pos(void);
char *char_to_str(const char c);
void spawn(const char *str, ...);
void swap_ptr(void **x, void **y);
void uicb_spawn(uicb_t);
#ifdef HAVE_IMLIB
int parse_image_block(ImageAttr *im, char *str);
#endif /* HAVE_IMLIB */
/* tag.c */
void tag_set(int tag);
void tag_transfert(Client *c, int tag);
void uicb_tag(uicb_t);
void uicb_tag_next(uicb_t);
void uicb_tag_prev(uicb_t);
void uicb_tagtransfert(uicb_t);
void uicb_tag_prev_sel(uicb_t);
void uicb_tagtransfert_next(uicb_t);
void uicb_tagtransfert_prev(uicb_t);
/* screen.c */
int screen_count(void);
XRectangle screen_get_geo(int s);
int screen_get_with_geo(int x, int y);
int screen_get_sel(void);
void screen_set_sel(int screen);
void screen_init_geo(void);
void uicb_screen_select(uicb_t);
void uicb_screen_next(uicb_t);
void uicb_screen_prev(uicb_t);
void uicb_screen_prev_sel(uicb_t);
/* status.c */
int statustext_rectangle(StatusRec *r, char *str);
int statustext_text(StatusText *s, char *str);
void statustext_normal(int sc, char *str);
void statustext_handle(int sc, char *str);
/* layout.c */
void arrange(int screen, Bool update_layout);
void freelayout(int screen);
void layoutswitch(Bool b);
void maxlayout(int screen);
Client *tiled_client(int screen, Client *c);
/* tile {{{ */
void grid(int screen);
void tile(int screen);
void tile_left(int screen);
void tile_top(int screen);
void tile_bottom(int screen);
void mirror_vertical(int screen);
void mirror_horizontal(int screen);
void layer(int screen);
/* }}} */
void uicb_togglemax(uicb_t);
void uicb_togglefree(uicb_t);
void uicb_layout_prev(uicb_t);
void uicb_layout_next(uicb_t);
void uicb_set_mwfact(uicb_t);
void uicb_set_nmaster(uicb_t);
void uicb_set_layout(uicb_t);
void uicb_toggle_resizehint(uicb_t);
void uicb_toggle_abovefc(uicb_t cmd);
void uicb_set_layer(uicb_t cmd);
void uicb_set_client_layer(uicb_t cmd);
void layout_set_client_master(Client *c);
/* init.c */
void init(void);
void init_root(void);
void init_font(void);
void init_gc(void);
void init_cursor(void);
void init_key(void);
void init_geometry(void);
void init_status(void);
/* getinfo.c */
void getinfo_tag(void);
void getinfo_screen(void);
void getinfo_layout(void);
void getinfo_mwfact(void);
void getinfo_nmaster(void);
void getinfo(char *info);
/* viwmfs.c */
void viwmfs(int argc, char **argv);
/* wmfs.c */
int errorhandler(Display *d, XErrorEvent *event);
int errorhandlerdummy(Display *d, XErrorEvent *event);
void quit(void);
void *thread_process(void *arg);
void mainloop(void);
void scan(void);
Bool check_wmfs_running(void);
void exec_uicb_function(char *func, char *cmd);
void set_statustext(int s, char *str);
void update_status(void);
void handle_signal(int signum);
void uicb_quit(uicb_t);
void uicb_reload(uicb_t);
/* Variables */
/* Principal */
Display *dpy;
GC gc, gc_stipple;
int selscreen;
int prevselscreen;
Conf conf;
Key *keys;
Bool exiting, estatus;
XRectangle *sgeo;
XRectangle *spgeo;
Cursor cursor[CurLast];
char *argv_global;
int xrandr_event;
uint timing;
/* Fonts */
XftFont *font;
/* Atoms list */
Atom *net_atom;
/* InfoBar/Tags */
InfoBar *infobar;
Tag **tags;
int *seltag;
int *prevseltag;
Menu menulayout;
/* Important Client */
Client *clients;
Client *sel;
/* Other */
func_name_list_t *func_list;
extern const func_name_list_t layout_list[];
uint numlockmask;
#endif /* WMFS_H */
+199
View File
@@ -0,0 +1,199 @@
/* options -----------------------------------------------------------*/
* { padding:0; margin:0; }
a { color: #ccc; text-decoration: none; }
a:hover { color: #aaa; }
pre { color: #ccc; }
/* body --------------------------------------------------------------*/
body {
font: 12px/18px sans-serif;
color: #aaa;
background-color: #0F0F0F;
}
/* container ---------------------------------------------------------*/
#container {
width: 100%;
height: 100%;
margin: 0px auto;
background-color: #A8A8A8;
overflow: hidden;
}
/* header ------------------------------------------------------------*/
#header {
position: fixed;
top: 0px;
z-index: 10;
width: 100%;
padding: 3px 5px 5px 2px;
background-color: #2B2B2B;
}
#header h1 {
font: 30px sans-serif;
text-align: right;
margin-right: 20px;
}
#header h1 span {
margin-right: 40px;
font-size: 13px;
}
#header h2 {
position: absolute;
font: 18px sans-serif;
left: 20px;
top: 10px;
}
/* links -------------------------------------------------------------*/
#links {
display: block;
margin: 60px auto 5px auto;
width: 100%;
}
.categorie {
padding: 0 10px 15px 25px;
margin: 0 auto 10px auto;
position: relative;
width: 90%;
background-color: #525252;
-webkit-box-shadow: 1px 1px 12px #000;
-moz-box-shadow: 1px 1px 12px #000;
box-shadow: 1px 1px 12px #000;
}
.categorie a { text-decoration: underline ; }
.categorie h2 { padding: 15px 0 5px 10px; }
/* iframe for irc ----------------------------------------------------*/
iframe {
opacity: 0.9;
-moz-opacity : 0.9;
-ms-filter: "alpha(opacity=90)";
margin: 15px auto 0 -10px;
-webkit-box-shadow: 1px 1px 12px #000;
-moz-box-shadow: 1px 1px 12px #000;
box-shadow: 1px 1px 12px #000;
}
/* footer ------------------------------------------------------------*/
#footer {
margin: 20px auto 0px auto;
display: block;
width: 100%;
padding: 0px 5px 0px 5px;
background-color: #2B2B2B;
font-size: 10px;
text-align: center;
-webkit-box-shadow: 1px 1px 12px #000;
-moz-box-shadow: 1px 1px 12px #000;
box-shadow: 1px 1px 12px #000;
}
/* cc BY-NC-SA License :: arpinux :: 2011 :: http://arpinux.org */
/* slideshow */
/*
Skin Name: Nivo Slider Default Theme
Skin URI: http://nivo.dev7studios.com
Skin Type: flexible
Description: The default skin for the Nivo Slider.
Version: 1.0
Author: Gilbert Pellegrom
Author URI: http://dev7studios.com
*/
.theme-default .nivoSlider {
position:relative;
background:#444 url(icons/loading.gif) no-repeat 50% 50%;
margin-bottom:20px;
-webkit-box-shadow: 1px 1px 12px #000;
-moz-box-shadow: 1px 1px 12px #000;
box-shadow: 1px 1px 12px #000;
}
.theme-default .nivoSlider img {
position:absolute;
top:0px;
left:0px;
display:none;
}
.theme-default .nivo-controlNav {
position:absolute;
left:5%;
bottom:-42px;
margin-left:-40px; /* Tweak this to center bullets */
}
.theme-default .nivo-directionNav a {
display:block;
width:30px;
height:30px;
background:url(icons/arrows.png) no-repeat;
text-indent:-9999px;
border:0;
}
.theme-default a.nivo-nextNav {
background-position:-30px 0;
right:15px;
}
.theme-default a.nivo-prevNav {
left:15px;
}
table {
border-collapse:separate;
border-spacing:0;
}
.theme-default #slider {
margin: 20px auto 20px auto;
width:800px; /* Make sure your images are the same size */
height:345px; /* Make sure your images are the same size */
}
.clear {
clear:both;
}
/*
* jQuery Nivo Slider v2.7.1
* http://nivo.dev7studios.com
*
* Copyright 2011, Gilbert Pellegrom
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* March 2010
*/
/* The Nivo Slider styles */
.nivoSlider {
position:relative;
}
.nivoSlider img {
position:absolute;
top:0px;
left:0px;
}
/* The slices and boxes in the Slider */
.nivo-slice {
display:block;
position:absolute;
z-index:5;
height:100%;
}
.nivo-box {
display:block;
position:absolute;
z-index:5;
}
/* Direction nav styles (e.g. Next & Prev) */
.nivo-directionNav a {
position:absolute;
top:45%;
z-index:9;
cursor:pointer;
}
.nivo-prevNav {
left:0px;
}
.nivo-nextNav {
right:0px;
}
-203
View File
@@ -1,203 +0,0 @@
.\" Title: wmfs
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
.\" Date: 04/22/2009
.\" Manual: manual of wmfs
.\" Source: wmfs 0.1rc4 (On The Run)
.\"
.TH "WMFS" "1" "04/22/2009" "wmfs 0\&.1rc4 (On The Run)" "manual of wmfs"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
wmfs \- Window Manager From Scratch
.SH "SYNOPSIS"
\fBwmfs\fR [\fB\-ihvS\fR] [\fB\-C <file>\fR] [\fB\-c <uicb_function> <cmd>\fR] [\fB\-g <argument>\fR] [\fB\-s <screen_num> <string>\fR] [\fB\-V <viwmfs cmd>\fR]
.sp
.SH "DESCRIPTION"
\fBWMFS\fR is a basic, lightweight and dynamic tiling windows manager for X\&.
.sp
.SH "OPTIONS"
.PP
\fB\-C <file>\fR
.RS 4
Load a configuration file\&.
.RE
.PP
\fB\-c <uicb_function> <cmd>\fR
.RS 4
Execute an uicb function to control WMFS\&.
.RE
.PP
\fB\-g <argument>\fR
.RS 4
Show information about wmfs status\&.
.RE
.PP
\fB\-s <screen_num> <string>\fR
.RS 4
Set the bar(s) statustext. If the screen number is not specified, the string will be show on all screens bars\&.
.RE
.PP
\fB\-V <viwmfs cmd>\fR
.RS 4
Manage WMFS with vi-like command\&.
.RE
.PP
\fB\-S\fR
.RS 4
Update status script\&.
.RE
.PP
\fB\-v\fR
.RS 4
Print version information to standard output, then exit\&.
.RE
.PP
\fB\-h\fR
.RS 4
Print help information, then exit\&.
.RE
.PP
\fB\-i\fR
.RS 4
Print WMFS informations
.RE
.SH "DEFAULT KEY BINDINGS"
.PP
\fBControl\-Alt + r\fR
.RS 4
Reload WMFS binary
.RE
.PP
\fBControl + Return\fR
.RS 4
Run a terminal (urxvt by default)
.RE
.PP
\fBAlt + q\fR
.RS 4
Quit the selected client
.RE
.PP
\fBControl\-Alt\-Shift + q\fR
.RS 4
Exit WMFS
.RE
.PP
\fBAlt + m \fR
.RS 4
Toggle maximize the selected client
.RE
.PP
\fBAlt + b \fR
.RS 4
Toggle the bar position between top, hide and bottom
.RE
.PP
\fBAlt + Tab\fR
.RS 4
Give the focus to the next client
.RE
.PP
\fBAlt\-Shift + Tab\fR
.RS 4
Give the focus to the previous client
.RE
.PP
\fBControl + Right\fR
.RS 4
Next tag
.RE
.PP
\fBControl + Left\fR
.RS 4
Previous tag
.RE
.PP
\fBAlt + Space\fR
.RS 4
Next layout
.RE
.PP
\fBAlt\-Shift + Space\fR
.RS 4
Previous layout
.RE
.PP
\fBAlt + l\fR
.RS 4
Increase the mwfact (+0\&.025)
.RE
.PP
\fBAlt + h\fR
.RS 4
Decrease the mwfact (\-0\&.025)
.RE
.PP
\fBAlt + d\fR
.RS 4
Increase the nmaster (+1)\fR
.RE
.PP
\fBAlt\-Shift + d\fR
.RS 4
Decrease the nmaster (-1)\fR
.RE
.PP
\fBAlt + t\fR
.RS 4
Swap the current client with the next\fR
.RE
.PP
\fBAlt\-Shift + t\fR
.RS 4
Swap the current client with the previous\fR
.RE
.PP
\fBAlt + p\fR
.RS 4
Make a launcher in the infobar to run an unix command\fR
.RE
.PP
\fBAlt + Escape\fR
.RS 4
Set WMFS in ViWMFS mode. (see wmfs -V)\fR
.RE
.PP
\fBAlt\-Shift + p\fR
.RS 4
Make a launcher in the infobar to run an ssh session\fR
.RE
.PP
\fBAlt + F[1\&.\&.9]\fR
.RS 4
Change tag view
.RE
.PP
\fBControl\-Shift +F[1\&.\&.9]\fR
.RS 4
Transfert the selected client to the wanted tag
.RE
.SH "CONFIGURATION"
WMFS is configured by \fI$HOME/\&.config/wmfs/wmfsrc\fR\&.
.sp
.SH "BUGS"
WMFS isn\'t stable for now\&. So it certainly contains some bugs\&.
.sp
.SH "AUTHORS"
Martin Duquesnoy <\fIxorg62@gmail\&.com\fR\&[1]>\&.
.sp
.SH "WWW"
Main site: \fIhttp://wmfs\&.info\fR Bug tracker: \fIhttp://bugs\&.wmfs\&.info\fR
.sp
.SH "COPYING"
WMFS is under the BSD license\&. See COPYING for more informations\&.
.sp
.SH "NOTES"
.IP " 1." 4
xorg62@gmail.com
.RS 4
\%mailto:xorg62@gmail.com
.RE
-6
View File
@@ -1,6 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Name=wmfs
Comment=Window manager from scratch
TryExec=wmfs
Exec=wmfs
-242
View File
@@ -1,242 +0,0 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = WMFS
PROJECT_NUMBER = devel
OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @SOURCE_DIR@/src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.h \
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor...
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references...
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool...
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = YES
TEMPLATE_RELATIONS = YeS
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine...
#---------------------------------------------------------------------------
SEARCHENGINE = NO
-263
View File
@@ -1,263 +0,0 @@
#
# This is the default wmfs config file, copy it to
# ~/.config/wmfs/wmfsrc and edit it.
#
[misc]
font = "dejavu-10"
raisefocus = false
focus_follow_mouse = true
status_timing = 1 #seconds
[/misc]
[bar]
bg = "#191919"
fg = "#D4D4D4"
border = true
selbar = false
[/bar]
[layouts]
fg = "#191919"
bg = "#7E89A2"
# Border around the layout button.
border = true
# Value menu or switch.
system = "menu"
# Value left or right.
placement = "right"
# Tiling layouts.
[layout] type = "tile_right" symbol = "RIGHT" [/layout]
[layout] type = "tile_left" symbol = "LEFT" [/layout]
[layout] type = "tile_top" symbol = "TOP" [/layout]
[layout] type = "tile_bottom" symbol = "BOTTOM" [/layout]
[layout] type = "tile_grid" symbol = "GRID" [/layout]
[layout] type = "mirror_vertical" symbol = "MIRROR_V" [/layout]
[layout] type = "mirror_horizontal" symbol = "MIRROR_H" [/layout]
# Other layouts.
[layout] type = "max" symbol = "MAX" [/layout]
[layout] type = "free" symbol = "FREE" [/layout]
[/layouts]
[tags]
tag_round = false
occupied_bg = "#003366"
sel_fg = "#191919"
sel_bg = "#7E89A2"
# Border around the tag buttons.
border = true
[tag]
name = "one"
screen = 0
mwfact = 0.65
nmaster = 1
layout = "tile_right"
resizehint = false
infobar_position = "top"
[/tag]
[tag] name = "two" clients = {"Browser"} [/tag]
[tag] name = "three" [/tag]
[tag] name = "four" [/tag]
[tag] name = "five" [/tag]
[tag] name = "six" [/tag]
[tag] name = "seven" [/tag]
[tag] name = "eight" [/tag]
[tag] name = "nine" [/tag]
[/tags]
[root]
# Command you can execute to set the background.
background_command = "xsetroot -solid black"
[mouse] button = "4" func = "tag_next" [/mouse]
[mouse] button = "5" func = "tag_prev" [/mouse]
[mouse] button = "3" func = "menu" cmd = "rootmenu" [/mouse]
[/root]
[client]
border_height = 3
border_shadow = true
border_normal = "#191919"
border_focus = "#003366"
resize_corner_normal = "#191919"
resize_corner_focus = "#003366"
modifier = "Alt"
[mouse] button = "1" func = "client_raise" [/mouse]
[mouse] button = "1" func = "mouse_move" [/mouse]
[mouse] button = "3" func = "client_raise" [/mouse]
[mouse] button = "3" func = "mouse_resize" [/mouse]
# Remove this section to delete the titlebar.
[titlebar]
stipple = false
height = 12
fg_normal = "#7E89A2"
fg_focus = "#9F9AB3"
[mouse] button = "1" func = "client_raise" [/mouse]
[mouse] button = "1" func = "mouse_move" [/mouse]
[mouse] button = "3" func = "client_raise" [/mouse]
[mouse] button = "3" func = "mouse_resize" [/mouse]
[button]
# Available "free", "max", "tile" flags of button.
flags = "free,max,tile"
[mouse] button = "1" func = "client_kill" [/mouse]
[mouse] button = "3" func = "menu" cmd = "clientmenu" [/mouse]
[line] coord = {1, 1, 4, 1} [/line]
[line] coord = {1, 1, 1, 4} [/line]
[line] coord = {1, 4, 4, 4} [/line]
[/button]
[/titlebar]
[/client]
[menu]
# Default menu, binded on the root window, button 3.
[set_menu]
name = "rootmenu"
# place_at_mouse = false
# x = 40 y = 50
fg_focus = "#191919" bg_focus = "#7E89A2"
fg_normal = "#9F9AB3" bg_normal = "#191919"
[item] name = "Terminal" func = "spawn" cmd = "@WMFS_TERM@" [/item]
[item] name = "Next tag" func = "tag_next" [/item]
[item] name = "Previous tag" func = "tag_prev" [/item]
[item] name = "Next layout" func = "layout_next" [/item]
[item] name = "Previous layout" func = "layout_prev" [/item]
[item] name = "Toggle infobar" func = "toggle_infobar_position" [/item]
[item] name = "Quit WMFS" func = "quit" [/item]
[/set_menu]
[set_menu]
name = "clientmenu"
fg_focus = "#D4D4D4" bg_focus = "#003366"
fg_normal = "#D4D4D4" bg_normal = "#191919"
[item] name = "Close" func = "client_kill" [/item]
[item] name = "Maximize" func = "toggle_max" [/item]
[item] name = "Free" func = "toggle_free" [/item]
[/set_menu]
[/menu]
[launcher]
[set_launcher]
name = "launcher_exec"
prompt = "Exec: "
command = "exec"
[/set_launcher]
#ViWMFS : manage wmfs with vi-based command.
[set_launcher]
name = "viwmfs"
prompt = "> "
command = "wmfs -V"
[/set_launcher]
[/launcher]
[keys]
# Reload the configuration of wmfs.
[key] mod = {"Alt", "Control"} key = "r" func = "reload" [/key]
# Open a terminal.
[key] mod = {"Control"} key = "Return" func = "spawn" cmd = "@WMFS_TERM@" [/key]
# Kill the selected client.
[key] mod = {"Alt"} key = "q" func = "client_kill" [/key]
# Quit wmfs.
[key] mod = {"Control", "Alt", "Shift"} key = "q" func = "quit" [/key]
# Swap current client with the next.
[key] mod = {"Alt"} key = "t" func = "client_swap_next" [/key]
# Swap current client with the previous.
[key] mod = {"Alt", "Shift"} key = "t" func = "client_swap_prev" [/key]
# Toggle maximum the selected client
[key] mod = {"Alt"} key = "m" func = "toggle_max" [/key]
# Toggle free the selected client.
[key] mod = {"Alt"} key = "f" func = "toggle_free" [/key]
# Toggle the position of the infobar.
[key] mod = {"Alt"} key = "b" func = "toggle_infobar_position" [/key]
# Toggle the resizehint of the current tag/screen
[key] mod = {"Shift", "Control"} key = "r" func = "toggle_resizehint" [/key]
# Select the next client.
[key] mod = {"Alt"} key = "Tab" func = "client_next" [/key]
# Select the previous client.
[key] mod = {"Alt","Shift"} key = "Tab" func = "client_prev" [/key]
# Select the next tag.
[key] mod = {"Control"} key = "Right" func = "tag_next" [/key]
# Select the previous tag.
[key] mod = {"Control"} key = "Left" func = "tag_prev" [/key]
# Set the next layout.
[key] mod = {"Alt"} key = "space" func = "layout_next" [/key]
# Set the previous layout.
[key] mod = {"Alt", "Shift"} key = "space" func = "layout_prev" [/key]
# Increase mwfact.
[key] mod = {"Alt"} key = "l" func = "set_mwfact" cmd = "+0.025" [/key]
# Decrease mwfact.
[key] mod = {"Alt"} key = "h" func = "set_mwfact" cmd = "-0.025" [/key]
# Increase nmaster.
[key] mod = {"Alt"} key = "d" func = "set_nmaster" cmd = "+1" [/key]
# Decease nmaster.
[key] mod = {"Alt", "Shift"} key = "d" func = "set_nmaster" cmd = "-1" [/key]
#Launcher.
[key] mod = {"Alt"} key = "p" func = "launcher" cmd = "launcher_exec" [/key]
#ViWMFS
[key] mod = {"Alt"} key = "Escape" func = "launcher" cmd = "viwmfs" [/key]
# Set the tag x.
[key] mod = {"Alt"} key = "F1" func = "tag" cmd = "1" [/key]
[key] mod = {"Alt"} key = "F2" func = "tag" cmd = "2" [/key]
[key] mod = {"Alt"} key = "F3" func = "tag" cmd = "3" [/key]
[key] mod = {"Alt"} key = "F4" func = "tag" cmd = "4" [/key]
[key] mod = {"Alt"} key = "F5" func = "tag" cmd = "5" [/key]
[key] mod = {"Alt"} key = "F6" func = "tag" cmd = "6" [/key]
[key] mod = {"Alt"} key = "F7" func = "tag" cmd = "7" [/key]
[key] mod = {"Alt"} key = "F8" func = "tag" cmd = "8" [/key]
[key] mod = {"Alt"} key = "F9" func = "tag" cmd = "9" [/key]
# Transfert selected client to x.
[key] mod = {"Alt", "Shift"} key = "F1" func = "tag_transfert" cmd ="1" [/key]
[key] mod = {"Alt", "Shift"} key = "F2" func = "tag_transfert" cmd ="2" [/key]
[key] mod = {"Alt", "Shift"} key = "F3" func = "tag_transfert" cmd ="3" [/key]
[key] mod = {"Alt", "Shift"} key = "F4" func = "tag_transfert" cmd ="4" [/key]
[key] mod = {"Alt", "Shift"} key = "F5" func = "tag_transfert" cmd ="5" [/key]
[key] mod = {"Alt", "Shift"} key = "F6" func = "tag_transfert" cmd ="6" [/key]
[key] mod = {"Alt", "Shift"} key = "F7" func = "tag_transfert" cmd ="7" [/key]
[key] mod = {"Alt", "Shift"} key = "F8" func = "tag_transfert" cmd ="8" [/key]
[key] mod = {"Alt", "Shift"} key = "F9" func = "tag_transfert" cmd ="9" [/key]
[/keys]