Re: [Sawfish] Re: Patches for styletab and compton

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

I now know what the problem is. If you load a theme.jl you can use in
theme.jl (make-image "Default/left-frame-maximize-button-f.png").

But if the theme is loaded and you run make-image in theme.jl you need the complete path:
(make-image "/usr/share/sawfish/themes/StyleTab/Default/left-frame-maximize-button-f.png")

01-styletab-start.patch 
Changes:
* gaol-add "find-frame-style" in sawfish/wm/frames.jl
* improve start/restart time from Styletab theme


On Thu, 18 Sep 2014 16:53:10 +0200
wrote Christopher Roy Bratusek <nano@xxxxxxxxxxx>:

>that's not the case for me (starts blazing fast), but I'll do some more 
>tests.
>
>On 17.09.2014 23:41, fuchur wrote:
>> Hi,
>>
>> On Wed, 17 Sep 2014 23:00:16 +0200
>> wrote Christopher Roy Bratusek <nano@xxxxxxxxxxx>:
>>
>>> try latest git head, it does not fail anymore for me and loads almost
>>> instantly.
>>>
>>> Regards,
>>> Chris
>>>
>>> On 17.09.2014 18:46, fuchur wrote:
>>>> Hi,
>>>>
>>>> On Tue, 16 Sep 2014 17:59:06 +0200
>>>> wrote fuchur <flohtransporter@xxxxxxxxx>:
>>>>
>>>>> Hi,
>>>>>
>>>>> On Mon, 15 Sep 2014 17:28:52 +0200
>>>>> wrote Christopher Roy Bratusek <nano@xxxxxxxxxxx>:
>>>>>
>>>>>> works fine.
>>>>>
>>>>> No. I can reproduces this. I have a copy from StyleTab in
>>>>> ~/,sawfish/themes/My-StyleTab. If i start sawfish with StyleTab and
>>>>> then load My-StyleTab and restart sawfish i got "Lisp backtraces".
>>>>> I try to fix this (if i found what is wrong).
>>>>>
>>>>
>>>> I now know what the problem is. If you run make-image after the theme
>>>> file is loaded sawfish crash. Put this in theme.jl from Styletab after
>>>> the other defcustom:
>>>>
>>>>
>>>> (defvar make-image-start nil)
>>>> (setq make-image-start (make-image "Default/left-frame-maximize-button-f.png"))
>>>>
>>>> (defvar make-image-load nil)
>>>> (define (make-image-l)
>>>>     (setq make-image-load (make-image "Default/left-frame-maximize-button-f.png")))
>>>> (make-image-load)
>>>>
>>>>
>>>> (defcustom styletab-c:make-image nil "Crash sawfish."
>>>>     :group (appearance StyleTab:group)
>>>>     :type boolean
>>>>     :after-set (lambda () (crash-make-image)))
>>>>
>>>> (defvar crash-image nil)
>>>> (define (crash-make-image)
>>>>     (setq crash-image (make-image "Default/left-frame-maximize-button-f.png")))
>>>>
>>>>
>>>>
>>>>
>>>> Now restart sawfish. Open sawfish-client:
>>>>
>>>> client > make-image-start
>>>> #<image 20x32>
>>>> client > make-image-load
>>>> #<image 20x32>
>>>> client > crash-image
>>>> ()
>>>>
>>>> If you now enable or disable the checkbox "Crash sawfish." you got
>>>> "Lisp backtraces".
>>>>
>>>> I can't fix this. Can you fix this?
>>>>
>>>>
>>>
>>
>> Bevor your changes restart time 4 - 5 seconds now 11 -12 seconds.
>> The problem is that we can't run make-image in theme.jl after
>> initialization. If we can't fix this the start/restart time is always
>> over 10 seconds (on my system). And also without a fix for make-image
>> we can't use my two patches from this thread, with this patches it can
>> happens that you can't start sawfish any more.
>>
>>
>


-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad sawfish.orgi/lisp/sawfish/wm/frames.jl sawfish/lisp/sawfish/wm/frames.jl
--- sawfish.orgi/lisp/sawfish/wm/frames.jl
+++ sawfish/lisp/sawfish/wm/frames.jl
@@ -1065,7 +1065,8 @@
 	    frame-part-get frame-part-put frame-part-window frame-part-x-window
 	    frame-part-position frame-part-dimensions frame-part-state
 	    map-frame-parts refresh-frame-part refresh-window rebuild-frame-part
-	    reload-frame-style update-title-x-offsets update-title-y-offsets)
+	    reload-frame-style update-title-x-offsets update-title-y-offsets
+        find-frame-style)
 
   (add-hook 'add-window-hook reframe-window t)
   (add-hook 'shape-notify-hook reframe-window t)
diff -urNad sawfish.orgi/themes/StyleTab/theme.jl sawfish/themes/StyleTab/theme.jl
--- sawfish.orgi/themes/StyleTab/theme.jl
+++ sawfish/themes/StyleTab/theme.jl
@@ -788,17 +788,20 @@
 (define (get-recolor-bright bright color)
   (brighten-color color bright))
 
+(define start-lock 't)
 (define (do-recolor img color)
   (if (and (eq styletab-c:styles 'Flat)
            (not flat-buttons))
       (make-sized-image 1 1 color)
     (if (not (eq styletab-c:styles 'Flat))
-        (let ((recolorer
-               (make-image-recolorer color
-                                     #:zero-channel blue-channel
-                                     #:index-channel green-channel)))
-          (recolorer img)
-          img)
+        (if start-lock
+            img
+          (let ((recolorer
+                 (make-image-recolorer color
+                                       #:zero-channel blue-channel
+                                       #:index-channel green-channel)))
+            (recolorer img)
+            img))
       img)))
 
 (define (do-make-get-image img)
@@ -808,7 +811,7 @@
     (or
      (table-ref styletab-c-frame-cache img)
      (let ((image
-            (make-image img)))
+            (make-image (concat (find-frame-style theme-name) "/" img))))
        (table-set styletab-c-frame-cache img image)
        image))))
 
@@ -2598,7 +2601,6 @@
 (define frame nil)
 (define button-alist nil)
 (define current-title styletab-c:titlebar-place)
-(define recolor-lock t)
 (define current-type nil)
 
 ;; botton list table
@@ -2877,39 +2879,33 @@
 ;; reframe-with-style, resize bottons
 ;; reset icon cache
 (define (clear-icon-cache-reframe)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not start-lock)
     (recolor-all-buttons)
     (setq styletab-c-icon-cache (make-weak-table eq-hash eq))
     (make-buttons)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (color-changed)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not start-lock)
     (recolor-all)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (bright-changed)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not start-lock)
     (recolor-tab)
     (recolor-all-buttons)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
 (define (botton-color-changed botton)
-  (when recolor-lock
-    (setq recolor-lock nil)
+  (when (not start-lock)
     (botton)
-    (reframe-with-style)
-    (setq recolor-lock t)))
+    (reframe-with-style)))
 
-(define (reload-frame-style-reframe)
-  (reload-frame-style theme-name)
-  (reframe-with-style))
+(define (build-style)
+  (when (not start-lock)
+    (recolor-all)
+    (make-buttons)
+    (reframe-with-style)))
 
 (define (frame-style-name w)
   (when (eq (window-get w 'current-frame-style) theme-name)
@@ -2942,10 +2938,6 @@
           ((shaped-transient)
            (make-frame w 'shaped-transient-frame current-title)))))
 
-;; initialize theme
-(require 'rep.io.timers)
-(make-timer (lambda () t) (quotient 1000 1000) (mod 1000 1000))
-
 (add-frame-style theme-name get-frame)
 
 (call-after-state-changed '(tab-theme-name) frame-style-name)
@@ -2954,7 +2946,7 @@
 (call-after-state-changed '(maximized sticky fixed-position fixed-size stacking) reframe-one)
 (add-hook 'remove-from-workspace-hook reframe-one)
 
-(custom-set-property 'styletab-c:styles ':after-set reload-frame-style-reframe)
+(custom-set-property 'styletab-c:styles ':after-set build-style)
 (custom-set-property 'styletab-c:title-dimension ':after-set clear-icon-cache-reframe)
 (custom-set-property 'styletab-c:custom-button-width ':after-set clear-icon-cache-reframe)
 (custom-set-property 'styletab-c:button-width ':after-set clear-icon-cache-reframe)
@@ -2969,5 +2961,12 @@
 (custom-set-property 'styletab-c:right-top-buttons ':after-set make-buttons-reframe-with-style)
 (custom-set-property 'styletab-c:right-bottom-buttons ':after-set make-buttons-reframe-with-style)
 
-(color-changed)
-(make-buttons)
+(define (timer-theme-load)
+  (require 'rep.io.timers)
+  (setq start-lock
+        (make-timer (lambda ()
+                      (setq start-lock nil)
+                      (build-style))
+                    (quotient 10 1000) (mod 10 1000))))
+
+(timer-theme-load)

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/