unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* problem with fullscreen
@ 2009-06-08 19:08 joakim
  2009-06-09  6:13 ` Jan D.
  0 siblings, 1 reply; 4+ messages in thread
From: joakim @ 2009-06-08 19:08 UTC (permalink / raw)
  To: Emacs Development

I have a mode which toggles full-screen and other things.
(find it attached)

It has worked well, but suddenly it has stopped working when I did an
emacs update. The problem is that the following code doesnt enter
fullscreen:

(set-frame-parameter nil 'fullscreen 'fullboth)

However, the fragment does work in an emacs -Q session.
So, it would appear some of my other emacs init code disables fullscreen
somehow. Any hints on where I should look?

-- 
Joakim Verona




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fullscreen
  2009-06-08 19:08 problem with fullscreen joakim
@ 2009-06-09  6:13 ` Jan D.
  2009-06-09  8:42   ` joakim
  0 siblings, 1 reply; 4+ messages in thread
From: Jan D. @ 2009-06-09  6:13 UTC (permalink / raw)
  To: joakim; +Cc: Emacs Development

On 2009-06-08 21:08, joakim@verona.se wrote:
> I have a mode which toggles full-screen and other things.
> (find it attached)

Not really...

>
> It has worked well, but suddenly it has stopped working when I did an
> emacs update. The problem is that the following code doesnt enter
> fullscreen:
>
> (set-frame-parameter nil 'fullscreen 'fullboth)
>
> However, the fragment does work in an emacs -Q session.
> So, it would appear some of my other emacs init code disables fullscreen
> somehow. Any hints on where I should look?
>

I guess you have to do a binary search in your startup-script until you 
find it.  Or do the lisp-thing above in the debugger and see if some 
hook of yours is called that changes things.

	Jan D.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fullscreen
  2009-06-09  6:13 ` Jan D.
@ 2009-06-09  8:42   ` joakim
  2009-06-10  6:21     ` Jan D.
  0 siblings, 1 reply; 4+ messages in thread
From: joakim @ 2009-06-09  8:42 UTC (permalink / raw)
  To: Jan D.; +Cc: Emacs Development

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

"Jan D." <jan.h.d@swipnet.se> writes:

> On 2009-06-08 21:08, joakim@verona.se wrote:
>> I have a mode which toggles full-screen and other things.
>> (find it attached)
>
> Not really...

Now then :)
>
>>
>> It has worked well, but suddenly it has stopped working when I did an
>> emacs update. The problem is that the following code doesnt enter
>> fullscreen:
>>
>> (set-frame-parameter nil 'fullscreen 'fullboth)
>>
>> However, the fragment does work in an emacs -Q session.
>> So, it would appear some of my other emacs init code disables fullscreen
>> somehow. Any hints on where I should look?
>>
>
> I guess you have to do a binary search in your startup-script until
> you find it.  Or do the lisp-thing above in the debugger and see if
> some hook of yours is called that changes things.

I made the mode work again with a feeble workaround in the function
zen-windowed-mode. I havent had enough experience with the workaround to
see if it always works yet.


[-- Attachment #2: zen-mode.el --]
[-- Type: text/plain, Size: 4395 bytes --]

;;; zen-mode.el --- remove/restore Emacs frame distractions quickly

;;; Copyright (C) 2008 Joakim Verona

;;Author: Joakim Verona, joakim@verona.se
;;License: GPL V3 or later

;;; Commentary:
;; 
;;zen-mode is Emacs in fullscreen without toolbar and menubar
;;the function toggles between previous state of features and zen
;;
;;
;;I bind zen-mode to f11 like this:
;;;(global-set-key [f11] 'zen-mode)
;;
;;TODO:
;;
;;- Zen-master mode, like writeroom mode. (c-u m-x zen-mode), which
;; isn't customizable, it just turns all distractions off
;;
;;- There shouldnt just be a toogle, but a way to enter a specific
;; state, like scroll-bar-mode, probably with a numeric argument
;;
;;- Optionaly advice some modes like ERC so as not to interrupt while
;;  in Zen, also dont Gnus while in Zen. You are supposed to concentrate :)
;;
;;- Currently zen isnt entered properly the 1st time, you have to try twice.

;;Note:
;; There are some problems in the Compiz WM, (and maybe other WM:s) regarding fullscreen:
;; When selecting another workspace temporarily and going back, Emacs
;; does not cover the wm panels as it should.  This can be resolved with alt-tab a bit,
;; but its annoying.  In Metacity it works well.
;;
;;

;;; History:
;; 
;; 2008.08.17 -- v0.1
;; 2009  -- v.02pre

;;; Code:

(provide 'zen-mode)

(defvar zen-mode-is-active-p nil "If zen mode is currently active
or not.")
(defvar zen-mode-previous-state nil "The state of features to be
disabled in zen-mode, before entering zen-mode.")

(defgroup zen-mode nil "zen-mode"); :group 'some-apropriate-root-group)

(defcustom zen-mode-what-is-not-zen '()
  "These Emacs features are not considered Zen.
They will be disabled when entering Zen.  They will be restored
to their previous settings when leaving Zen."
  :group 'zen-mode
  :type
  '(set :tag "zen"
    (const scroll-bar-mode)
    (const menu-bar-mode)
    (const tool-bar-mode)
    (const windowed-mode) ;windowed is the inverse of fullscreen, for didactic reasons
  )
  )


(defun zen-mode-get-feature-state (feature)
  "An uniform get/set facility for each feature zen handles.
FEATURE is a symbol from 'zen-mode-what-is-not-zen'."
  (cond
   ((eq feature 'scroll-bar-mode)
    scroll-bar-mode)
   ((eq feature 'menu-bar-mode)
    menu-bar-mode)
   ((eq feature 'tool-bar-mode)
    tool-bar-mode)
   ((eq feature 'windowed-mode)
    (if (frame-parameter nil 'fullscreen) nil t))
 )
  )

(defun zen-mode-set-feature-state (feature state)
  "Set zen FEATURE to STATE."
  (let*
      ((modeflag (if state t -1)))
    (cond
     ((eq feature 'scroll-bar-mode)
      (scroll-bar-mode modeflag))
     ((eq feature 'menu-bar-mode)
      (menu-bar-mode modeflag))
     ((eq feature 'tool-bar-mode)
      (tool-bar-mode modeflag))
     ((eq feature 'windowed-mode)
      (zen-windowed-mode state))
    ))
)

(defun zen-windowed-mode (state)
  (cond
   ;;fullscreen seems to be quirky in some emacsen, this is a feeble workaround
   (state (set-frame-parameter nil 'fullscreen 'fullboth-bug)
          (set-frame-parameter nil 'fullscreen 'nil))
    (t
            (set-frame-parameter nil 'fullscreen 'fullboth))))


(defun zen-mode-store-state ()
  "Store the state of all features zen is interested in."
  (setq zen-mode-previous-state nil)
  (let
      ((f zen-mode-what-is-not-zen))
    (while f
      (setq zen-mode-previous-state
            (append zen-mode-previous-state
                    (list (list (car f)
                                (zen-mode-get-feature-state (car f))) )))
      (setq f (cdr f))))
  zen-mode-previous-state)

(defun zen-mode-disable-nonzen-features ()
  "Disable all non-zen features."
  (let
      ((f zen-mode-what-is-not-zen))
    (while f
      (zen-mode-set-feature-state (car f) nil)
      (setq f (cdr f)))))

(defun zen-mode-restore-state ()
  "Restore the feature state as before entering zen."
  (let
      ((f zen-mode-previous-state))
    (while f
      (zen-mode-set-feature-state (caar  f) (cadar f))
      (setq f (cdr f))))
  )


(defun zen-mode ()
  "Toggle Zen mode."
  (interactive)
    (if zen-mode-is-active-p
        (progn;deactivate zen
          (setq zen-mode-is-active-p nil)
          (zen-mode-store-state)
          (zen-mode-disable-nonzen-features)
          )
      (progn;activate zen
        (setq zen-mode-is-active-p t)
        (zen-mode-restore-state))))

(provide 'zen-mode)

;;; zen-mode.el ends here

[-- Attachment #3: Type: text/plain, Size: 31 bytes --]




> 	Jan D.
-- 
Joakim Verona

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problem with fullscreen
  2009-06-09  8:42   ` joakim
@ 2009-06-10  6:21     ` Jan D.
  0 siblings, 0 replies; 4+ messages in thread
From: Jan D. @ 2009-06-10  6:21 UTC (permalink / raw)
  To: joakim; +Cc: Emacs Development

On 2009-06-09 10:42, joakim@verona.se wrote:
> "Jan D."<jan.h.d@swipnet.se>  writes:
>
>> On 2009-06-08 21:08, joakim@verona.se wrote:
>>> I have a mode which toggles full-screen and other things.
>>> (find it attached)
>> Not really...
>
> Now then :)

Can you do
% xprop > out

and then click in the Emacs window before you run your function?  Post 
the contents of out here. Also before running the function, do
(frame-parameter nil 'fullscreen)
and note what you get.  What window manager are you running?

Thanks,

	Jan D.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-10  6:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 19:08 problem with fullscreen joakim
2009-06-09  6:13 ` Jan D.
2009-06-09  8:42   ` joakim
2009-06-10  6:21     ` Jan D.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).