Commit 23bc3eec authored by Philippe Brochard's avatar Philippe Brochard
Browse files

Use x-drawable-width/height of *root* instead of xlib:screen-width/height to get the screen size

parent a5198305
......@@ -27,8 +27,8 @@
(symbol-macrolet ((sw (xlib:screen-width *screen*))
(sh (xlib:screen-height *screen*))
(symbol-macrolet ((sw (screen-width))
(sh (screen-height))
(cs *corner-size*))
(defun in-corner (corner x y)
"Return t if (x, y) is in corner.
......@@ -44,8 +44,8 @@ Corner is one of :bottom-right :bottom-left :top-right :top-left"
(<= ymin y ymax)))))
(symbol-macrolet ((sw (xlib:screen-width *screen*))
(sh (xlib:screen-height *screen*))
(symbol-macrolet ((sw (screen-width))
(sh (screen-height))
(cs *corner-size*))
(defun find-corner (x y)
(cond ((and (< cs x (- sw cs)) (< cs y (- sh cs))) nil)
......
......@@ -141,8 +141,8 @@
*expose-child-list* (expose-associate-keys)
*expose-selected-child* nil
*query-string* "")
(xlib:warp-pointer *root* (truncate (/ (xlib:screen-width *screen*) 2))
(truncate (/ (xlib:screen-height *screen*) 2)))
(xlib:warp-pointer *root* (truncate (/ (screen-width) 2))
(truncate (/ (screen-height) 2)))
(add-hook *query-key-press-hook* 'expose-query-key-press-hook)
(add-hook *query-button-press-hook* 'expose-query-button-press-hook))
......
......@@ -71,13 +71,13 @@
(child-fullname (expose-child-child ex-child)))
(incf posx (1+ (length (child-fullname (expose-child-child ex-child))))))
(when (> (* posx (xlib:max-char-width *fastswitch-font*))
(xlib:drawable-width *fastswitch-window*))
(x-drawable-width *fastswitch-window*))
(if *fastswitch-adjust-window-p*
(setf posx 1
posy (1+ posy))
(return)))))))
(adjust-window ()
(setf (xlib:drawable-height *fastswitch-window*) (* (xlib:font-ascent *fastswitch-font*) 3))
(setf (x-drawable-height *fastswitch-window*) (* (xlib:font-ascent *fastswitch-font*) 3))
(let ((posx 1))
(dolist (ex-child *fastswitch-match-child*)
(when (or *fastswitch-show-frame-p* (not (frame-p (expose-child-child ex-child))))
......@@ -85,9 +85,9 @@
(incf posx)
(incf posx (1+ (length (child-fullname (expose-child-child ex-child)))))
(when (> (* posx (xlib:max-char-width *fastswitch-font*))
(xlib:drawable-width *fastswitch-window*))
(x-drawable-width *fastswitch-window*))
(setf posx 1)
(incf (xlib:drawable-height *fastswitch-window*) (xlib:font-ascent *fastswitch-font*))))))))
(incf (x-drawable-height *fastswitch-window*) (xlib:font-ascent *fastswitch-font*))))))))
(when *fastswitch-adjust-window-p*
(adjust-window))
(clear-pixmap-buffer *fastswitch-window* *fastswitch-gc*)
......@@ -106,7 +106,7 @@
(setf *fastswitch-font* (xlib:open-font *display* *fastswitch-font-string*)
*fastswitch-string* ""
*fastswitch-match-child* (string-match *fastswitch-string* *expose-child-list* #'expose-child-key))
(let* ((width (- (xlib:screen-width *screen*) 2))
(let* ((width (- (screen-width) 2))
(height (* (xlib:font-ascent *fastswitch-font*) 3)))
(with-placement (*fastswitch-mode-placement* x y width height)
(setf *fastswitch-window* (xlib:create-window :parent *root*
......
......@@ -317,10 +317,10 @@ Or ((1_word color) (2_word color) 3_word (4_word color)...)"
(ilh (+ (xlib:max-char-ascent font) (xlib:max-char-descent font) 1))
(width (or width
(min (* (+ (loop for l in info-list maximize (compute-size l)) 2) ilw)
(xlib:screen-width *screen*))))
(screen-width))))
(height (or height
(min (round (+ (* (length info-list) ilh) (/ ilh 2)))
(xlib:screen-height *screen*)))))
(screen-height)))))
(with-placement (*info-mode-placement* x y width height)
(let* ((window (xlib:create-window :parent *root*
:x x :y y
......
;; --------------------------------------------------------------------------
;;; --------------------------------------------------------------------------
;;; CLFSWM - FullScreen Window Manager
;;;
;;; --------------------------------------------------------------------------
......@@ -762,7 +762,7 @@
(unless (get-root-list)
(let ((frame (create-frame)))
(add-frame frame *root-frame*)
(define-as-root frame 0 0 (xlib:screen-width *screen*) (xlib:screen-height *screen*))
(define-as-root frame 0 0 (screen-width) (screen-height))
(add-frame (create-frame) frame))))
......@@ -850,9 +850,9 @@ XINERAMA version 1.1 opcode: 150
(defun place-frames-from-xinerama-infos ()
"Place frames according to xdpyinfo/xinerama informations"
(let ((sizes (get-connected-heads-size))
(width (xlib:screen-width *screen*))
(height (xlib:screen-height *screen*)))
(let ((sizes (get-connected-heads-size t)) ;;; PHIL: remove here
(width (screen-width))
(height (screen-height)))
(labels ((update-root-geometry ()
(loop for size in sizes
for root in (get-root-list)
......@@ -1020,8 +1020,8 @@ XINERAMA version 1.1 opcode: 150
(funcall it child parent)
(no-layout child parent))
(values (- (child-border-size child)) (- (child-border-size child))
(xlib:screen-width *screen*)
(xlib:screen-height *screen*)))
(screen-width)
(screen-height)))
(values (x-drawable-x child) (x-drawable-y child)
(x-drawable-width child) (x-drawable-height child)))))
......@@ -1625,8 +1625,8 @@ managed."
(defun store-root-background ()
(with-all-mapped-windows *screen* #'hide-window)
(setf *background-image* (xlib:create-pixmap :width (xlib:screen-width *screen*)
:height (xlib:screen-height *screen*)
(setf *background-image* (xlib:create-pixmap :width (screen-width)
:height (screen-height)
:depth (xlib:screen-root-depth *screen*)
:drawable *root*)
*background-gc* (xlib:create-gcontext :drawable *background-image*
......@@ -1635,7 +1635,7 @@ managed."
:font *default-font*
:line-style :solid))
(xlib:copy-area *root* *background-gc*
0 0 (xlib:screen-width *screen*) (xlib:screen-height *screen*)
0 0 (screen-width) (screen-height)
*background-image* 0 0)
(with-all-mapped-windows *screen* #'unhide-window))
......
......@@ -61,8 +61,8 @@
;;; Absolute placement
;;;
(defun root-screen-coord (border-size)
(values (- (xlib:screen-width *screen*) (* 2 border-size))
(- (xlib:screen-height *screen*) (* 2 border-size))))
(values (- (screen-width) (* 2 border-size))
(- (screen-height) (* 2 border-size))))
(defmacro with-root-screen-coord ((border-size w h) &body body)
`(multiple-value-bind (,w ,h)
......
......@@ -150,7 +150,7 @@
(defun query-enter-function ()
(setf *query-font* (xlib:open-font *display* *query-font-string*))
(let ((width (- (xlib:screen-width *screen*) 2))
(let ((width (- (screen-width) 2))
(height (* 3 (+ (xlib:max-char-ascent *query-font*) (xlib:max-char-descent *query-font*)))))
(with-placement (*query-mode-placement* x y width height)
(setf *query-window* (xlib:create-window :parent *root*
......
......@@ -493,7 +493,7 @@ Write (defparameter *contrib-dir* \"/usr/local/lib/clfswm/\") in ~A.~%"
(font (xlib:open-font *display* *identify-font-string*))
(window (xlib:create-window :parent *root*
:x 0 :y 0
:width (- (xlib:screen-width *screen*) (* *border-size* 2))
:width (- (screen-width) (* *border-size* 2))
:height (* 5 (+ (xlib:max-char-ascent font) (xlib:max-char-descent font)))
:background (get-color *identify-background*)
:border-width *border-size*
......@@ -577,7 +577,7 @@ Write (defparameter *contrib-dir* \"/usr/local/lib/clfswm/\") in ~A.~%"
(let ((ret (info-mode (expand-newline (append (ensure-list (format nil "> ~A" form))
(ensure-list printed-result)
(ensure-list result)))
:width (- (xlib:screen-width *screen*) 2))))
:width (- (screen-width) 2))))
(when (or (search "defparameter" form :test #'string-equal)
(search "defvar" form :test #'string-equal))
(let ((elem (split-string form)))
......@@ -1662,7 +1662,7 @@ For window: set current child to window or its parent according to window-parent
(reset-if-moved x y)
(setf minx x)
(add-in-history x y)
(setf lx (middle minx (or maxx (xlib:screen-width *screen*))))
(setf lx (middle minx (or maxx (screen-width))))
(xlib:warp-pointer *root* lx y)))
(defun speed-mouse-up ()
"Speed move mouse to up"
......@@ -1678,7 +1678,7 @@ For window: set current child to window or its parent according to window-parent
(reset-if-moved x y)
(setf miny y)
(add-in-history x y)
(setf ly (middle miny (or maxy (xlib:screen-height *screen*))))
(setf ly (middle miny (or maxy (screen-height))))
(xlib:warp-pointer *root* x ly)))
(defun speed-mouse-undo ()
"Undo last speed mouse move"
......
......@@ -124,8 +124,8 @@
(define-handler main-mode :enter-notify (window root-x root-y)
(unless (and (> root-x (- (xlib:screen-width *screen*) 3))
(> root-y (- (xlib:screen-height *screen*) 3)))
(unless (and (> root-x (- (screen-width) 3))
(> root-y (- (screen-height) 3)))
(manage-focus window root-x root-y)))
......@@ -198,8 +198,8 @@
*root* (xlib:screen-root *screen*)
*no-focus-window* (xlib:create-window :parent *root* :x 0 :y 0 :width 1 :height 1)
*default-font* (xlib:open-font *display* *default-font-string*)
*pixmap-buffer* (xlib:create-pixmap :width (xlib:screen-width *screen*)
:height (xlib:screen-height *screen*)
*pixmap-buffer* (xlib:create-pixmap :width (screen-width)
:height (screen-height)
:depth (xlib:screen-root-depth *screen*)
:drawable *root*)
*in-second-mode* nil
......
......@@ -49,8 +49,8 @@
;; (xlib:change-property *root* :_NET_NUMBER_OF_DESKTOPS
;; (list (length *workspace-list*)) :cardinal 32)
;; (xlib:change-property *root* :_NET_DESKTOP_GEOMETRY
;; (list (xlib:screen-width *screen*)
;; (xlib:screen-height *screen*))
;; (list (screen-width)
;; (screen-height))
;; :cardinal 32)
;; (xlib:change-property *root* :_NET_DESKTOP_VIEWPORT
;; (list 0 0) :cardinal 32)
......
......@@ -103,6 +103,14 @@ Features: ~A"
;; `(progn
;; ,@body))
(defun screen-width ()
;;(xlib:screen-width *screen*))
(x-drawable-width *root*))
(defun screen-height ()
;;(xlib:screen-height *screen*))
(x-drawable-height *root*))
(defmacro with-x-pointer (&body body)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment