comparison src/xterm.c @ 73867:fe2f6663aa15

(do_ewmh_fullscreen, XTfullscreen_hook): New functions. (x_check_fullscreen): Call do_ewmh_fullscreen. (x_initialize): Set fullscreen_hook to XTfullscreen_hook.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 10 Nov 2006 08:00:47 +0000
parents 52c60387f8d4
children 4f75dfc2cb0d
comparison
equal deleted inserted replaced
73866:e240939ffc28 73867:fe2f6663aa15
8294 x_check_expected_move (f, modified_left, modified_top); 8294 x_check_expected_move (f, modified_left, modified_top);
8295 8295
8296 UNBLOCK_INPUT; 8296 UNBLOCK_INPUT;
8297 } 8297 }
8298 8298
8299 /* Do fullscreen as specified in extended window manager hints */
8300 static int
8301 do_ewmh_fullscreen (f)
8302 struct frame *f;
8303 {
8304 int have_net_atom = FRAME_X_DISPLAY_INFO (f)->have_net_atoms;
8305
8306 if (!have_net_atom)
8307 {
8308 int num;
8309 Atom *atoms = XListProperties (FRAME_X_DISPLAY (f),
8310 FRAME_X_DISPLAY_INFO (f)->root_window,
8311 &num);
8312 if (atoms && num > 0)
8313 {
8314 char **names = (char **) xmalloc (num * sizeof(*names));
8315 if (XGetAtomNames (FRAME_X_DISPLAY (f), atoms, num, names))
8316 {
8317 int i;
8318 for (i = 0; i < num; ++i)
8319 {
8320 if (!have_net_atom)
8321 have_net_atom = strncmp (names[i], "_NET_", 5) == 0;
8322 XFree (names[i]);
8323 }
8324 }
8325 xfree (names);
8326 }
8327 if (atoms)
8328 XFree (atoms);
8329
8330 FRAME_X_DISPLAY_INFO (f)->have_net_atoms = have_net_atom;
8331 }
8332
8333 if (have_net_atom)
8334 {
8335 Lisp_Object frame;
8336 XSETFRAME (frame, f);
8337 const char *atom = "_NET_WM_STATE";
8338 const char *fs = "_NET_WM_STATE_FULLSCREEN";
8339 const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
8340 const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
8341 const char *what = NULL;
8342
8343 /* If there are _NET_ atoms we assume we have extended window manager
8344 hints. */
8345 switch (f->want_fullscreen)
8346 {
8347 case FULLSCREEN_BOTH:
8348 what = fs;
8349 break;
8350 case FULLSCREEN_WIDTH:
8351 what = fw;
8352 break;
8353 case FULLSCREEN_HEIGHT:
8354 what = fh;
8355 break;
8356 }
8357
8358 Fx_send_client_event (frame, make_number (0), frame,
8359 make_unibyte_string (atom, strlen (atom)),
8360 make_number (32),
8361 Fcons (make_number (0), /* Remove */
8362 Fcons
8363 (make_unibyte_string (fs,
8364 strlen (fs)),
8365 Qnil)));
8366 Fx_send_client_event (frame, make_number (0), frame,
8367 make_unibyte_string (atom, strlen (atom)),
8368 make_number (32),
8369 Fcons (make_number (0), /* Remove */
8370 Fcons
8371 (make_unibyte_string (fh,
8372 strlen (fh)),
8373 Qnil)));
8374 Fx_send_client_event (frame, make_number (0), frame,
8375 make_unibyte_string (atom, strlen (atom)),
8376 make_number (32),
8377 Fcons (make_number (0), /* Remove */
8378 Fcons
8379 (make_unibyte_string (fw,
8380 strlen (fw)),
8381 Qnil)));
8382 f->want_fullscreen = FULLSCREEN_NONE;
8383 if (what != NULL)
8384 Fx_send_client_event (frame, make_number (0), frame,
8385 make_unibyte_string (atom, strlen (atom)),
8386 make_number (32),
8387 Fcons (make_number (1), /* Add */
8388 Fcons
8389 (make_unibyte_string (what,
8390 strlen (what)),
8391 Qnil)));
8392 }
8393
8394 return have_net_atom;
8395 }
8396
8397 static void
8398 XTfullscreen_hook (f)
8399 FRAME_PTR f;
8400 {
8401 if (f->async_visible)
8402 {
8403 BLOCK_INPUT;
8404 do_ewmh_fullscreen (f);
8405 x_sync (f);
8406 UNBLOCK_INPUT;
8407 }
8408 }
8409
8410
8299 /* Check if we need to resize the frame due to a fullscreen request. 8411 /* Check if we need to resize the frame due to a fullscreen request.
8300 If so needed, resize the frame. */ 8412 If so needed, resize the frame. */
8301 static void 8413 static void
8302 x_check_fullscreen (f) 8414 x_check_fullscreen (f)
8303 struct frame *f; 8415 struct frame *f;
8304 { 8416 {
8305 if (f->want_fullscreen & FULLSCREEN_BOTH) 8417 if (f->want_fullscreen & FULLSCREEN_BOTH)
8306 { 8418 {
8307 int width, height, ign; 8419 int width, height, ign;
8420
8421 if (do_ewmh_fullscreen (f))
8422 return;
8308 8423
8309 x_real_positions (f, &f->left_pos, &f->top_pos); 8424 x_real_positions (f, &f->left_pos, &f->top_pos);
8310 8425
8311 x_fullscreen_adjust (f, &width, &height, &ign, &ign); 8426 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
8312 8427
10933 frame_raise_lower_hook = XTframe_raise_lower; 11048 frame_raise_lower_hook = XTframe_raise_lower;
10934 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 11049 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
10935 condemn_scroll_bars_hook = XTcondemn_scroll_bars; 11050 condemn_scroll_bars_hook = XTcondemn_scroll_bars;
10936 redeem_scroll_bar_hook = XTredeem_scroll_bar; 11051 redeem_scroll_bar_hook = XTredeem_scroll_bar;
10937 judge_scroll_bars_hook = XTjudge_scroll_bars; 11052 judge_scroll_bars_hook = XTjudge_scroll_bars;
11053 fullscreen_hook = XTfullscreen_hook;
10938 11054
10939 scroll_region_ok = 1; /* we'll scroll partial frames */ 11055 scroll_region_ok = 1; /* we'll scroll partial frames */
10940 char_ins_del_ok = 1; 11056 char_ins_del_ok = 1;
10941 line_ins_del_ok = 1; /* we'll just blt 'em */ 11057 line_ins_del_ok = 1; /* we'll just blt 'em */
10942 fast_clear_end_of_line = 1; /* X does this well */ 11058 fast_clear_end_of_line = 1; /* X does this well */