summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2006-11-10 08:01:33 +0000
committerJan Djärv <jan.h.d@swipnet.se>2006-11-10 08:01:33 +0000
commitb8e7655fa8121b5ee6d6314d66b3998412791d10 (patch)
tree4708d9875916206f067a71161043b964462920f4 /src
parentb74772d489b4408b690942a3cf721538e6891398 (diff)
downloademacs-b8e7655fa8121b5ee6d6314d66b3998412791d10.tar.gz
(do_ewmh_fullscreen, XTfullscreen_hook): New functions.
(x_check_fullscreen): Call do_ewmh_fullscreen. (x_initialize): Set fullscreen_hook to XTfullscreen_hook.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/xterm.c116
2 files changed, 131 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d5c02729b54..c21a76b7c87 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
+2006-11-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
+
+ * xterm.h (struct x_display_info): Fix indentation.
+
+ * xterm.c (do_ewmh_fullscreen, XTfullscreen_hook): New functions.
+ (x_check_fullscreen): Call do_ewmh_fullscreen.
+ (x_initialize): Set fullscreen_hook to XTfullscreen_hook.
+
+ * frame.c (x_set_fullscreen): Call fullscreen_hook if set.
+
+ * term.c: Define fullscreen_hook.
+ (syms_of_term): Initialize fullscreen_hook to NULL.
+
+ * termhooks.h: Add fullscreen_hook.
+
2006-11-08 Juanma Barranquero <lekktu@gmail.com>
* bytecode.c (Fbyte_code):
diff --git a/src/xterm.c b/src/xterm.c
index 564da0d876c..7d86168f01f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8296,6 +8296,118 @@ x_set_offset (f, xoff, yoff, change_gravity)
UNBLOCK_INPUT;
}
+/* Do fullscreen as specified in extended window manager hints */
+static int
+do_ewmh_fullscreen (f)
+ struct frame *f;
+{
+ int have_net_atom = FRAME_X_DISPLAY_INFO (f)->have_net_atoms;
+
+ if (!have_net_atom)
+ {
+ int num;
+ Atom *atoms = XListProperties (FRAME_X_DISPLAY (f),
+ FRAME_X_DISPLAY_INFO (f)->root_window,
+ &num);
+ if (atoms && num > 0)
+ {
+ char **names = (char **) xmalloc (num * sizeof(*names));
+ if (XGetAtomNames (FRAME_X_DISPLAY (f), atoms, num, names))
+ {
+ int i;
+ for (i = 0; i < num; ++i)
+ {
+ if (!have_net_atom)
+ have_net_atom = strncmp (names[i], "_NET_", 5) == 0;
+ XFree (names[i]);
+ }
+ }
+ xfree (names);
+ }
+ if (atoms)
+ XFree (atoms);
+
+ FRAME_X_DISPLAY_INFO (f)->have_net_atoms = have_net_atom;
+ }
+
+ if (have_net_atom)
+ {
+ Lisp_Object frame;
+ XSETFRAME (frame, f);
+ const char *atom = "_NET_WM_STATE";
+ const char *fs = "_NET_WM_STATE_FULLSCREEN";
+ const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
+ const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
+ const char *what = NULL;
+
+ /* If there are _NET_ atoms we assume we have extended window manager
+ hints. */
+ switch (f->want_fullscreen)
+ {
+ case FULLSCREEN_BOTH:
+ what = fs;
+ break;
+ case FULLSCREEN_WIDTH:
+ what = fw;
+ break;
+ case FULLSCREEN_HEIGHT:
+ what = fh;
+ break;
+ }
+
+ Fx_send_client_event (frame, make_number (0), frame,
+ make_unibyte_string (atom, strlen (atom)),
+ make_number (32),
+ Fcons (make_number (0), /* Remove */
+ Fcons
+ (make_unibyte_string (fs,
+ strlen (fs)),
+ Qnil)));
+ Fx_send_client_event (frame, make_number (0), frame,
+ make_unibyte_string (atom, strlen (atom)),
+ make_number (32),
+ Fcons (make_number (0), /* Remove */
+ Fcons
+ (make_unibyte_string (fh,
+ strlen (fh)),
+ Qnil)));
+ Fx_send_client_event (frame, make_number (0), frame,
+ make_unibyte_string (atom, strlen (atom)),
+ make_number (32),
+ Fcons (make_number (0), /* Remove */
+ Fcons
+ (make_unibyte_string (fw,
+ strlen (fw)),
+ Qnil)));
+ f->want_fullscreen = FULLSCREEN_NONE;
+ if (what != NULL)
+ Fx_send_client_event (frame, make_number (0), frame,
+ make_unibyte_string (atom, strlen (atom)),
+ make_number (32),
+ Fcons (make_number (1), /* Add */
+ Fcons
+ (make_unibyte_string (what,
+ strlen (what)),
+ Qnil)));
+ }
+
+ return have_net_atom;
+}
+
+static void
+XTfullscreen_hook (f)
+ FRAME_PTR f;
+{
+ if (f->async_visible)
+ {
+ BLOCK_INPUT;
+ do_ewmh_fullscreen (f);
+ x_sync (f);
+ UNBLOCK_INPUT;
+ }
+}
+
+
/* Check if we need to resize the frame due to a fullscreen request.
If so needed, resize the frame. */
static void
@@ -8306,6 +8418,9 @@ x_check_fullscreen (f)
{
int width, height, ign;
+ if (do_ewmh_fullscreen (f))
+ return;
+
x_real_positions (f, &f->left_pos, &f->top_pos);
x_fullscreen_adjust (f, &width, &height, &ign, &ign);
@@ -10935,6 +11050,7 @@ x_initialize ()
condemn_scroll_bars_hook = XTcondemn_scroll_bars;
redeem_scroll_bar_hook = XTredeem_scroll_bar;
judge_scroll_bars_hook = XTjudge_scroll_bars;
+ fullscreen_hook = XTfullscreen_hook;
scroll_region_ok = 1; /* we'll scroll partial frames */
char_ins_del_ok = 1;