2001-05-31 02:42:58 -04:00
|
|
|
/* Metacity X window decorations */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "frame.h"
|
|
|
|
#include "errors.h"
|
2001-06-03 03:41:36 -04:00
|
|
|
#include "uislave.h"
|
2001-06-03 14:33:59 -04:00
|
|
|
#include "colors.h"
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
struct _MetaFrameActionGrab
|
|
|
|
{
|
|
|
|
MetaFrameAction action;
|
|
|
|
/* initial mouse position for drags */
|
|
|
|
int start_root_x, start_root_y;
|
|
|
|
/* initial window size or initial window position for drags */
|
|
|
|
int start_window_x, start_window_y;
|
|
|
|
/* button doing the dragging */
|
|
|
|
int start_button;
|
|
|
|
};
|
|
|
|
|
2001-06-06 22:42:24 -04:00
|
|
|
/* This lacks ButtonReleaseMask to avoid the auto-grab
|
|
|
|
* since it breaks our popup menu
|
|
|
|
*/
|
|
|
|
#define EVENT_MASK (StructureNotifyMask | SubstructureNotifyMask | \
|
|
|
|
ExposureMask | \
|
|
|
|
ButtonPressMask | ButtonReleaseMask | \
|
|
|
|
PointerMotionMask | PointerMotionHintMask | \
|
|
|
|
EnterWindowMask | LeaveWindowMask)
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
static void clear_tip (MetaFrame *frame);
|
|
|
|
|
2001-05-31 23:00:01 -04:00
|
|
|
static void
|
|
|
|
meta_frame_init_info (MetaFrame *frame,
|
|
|
|
MetaFrameInfo *info)
|
|
|
|
{
|
2001-06-03 17:39:57 -04:00
|
|
|
info->flags =
|
2001-06-04 02:17:52 -04:00
|
|
|
META_FRAME_ALLOWS_MENU | META_FRAME_ALLOWS_DELETE |
|
2001-06-03 17:39:57 -04:00
|
|
|
META_FRAME_ALLOWS_RESIZE;
|
2001-06-04 00:58:22 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
if (frame->window->type == META_WINDOW_NORMAL)
|
|
|
|
info->flags |= (META_FRAME_ALLOWS_ICONIFY | META_FRAME_ALLOWS_MAXIMIZE);
|
|
|
|
|
2001-06-04 00:58:22 -04:00
|
|
|
if (frame->window->has_focus)
|
|
|
|
info->flags |= META_FRAME_HAS_FOCUS;
|
2001-06-07 22:17:48 -04:00
|
|
|
|
|
|
|
if (frame->window->shaded)
|
|
|
|
info->flags |= META_FRAME_SHADED;
|
2001-06-09 23:17:15 -04:00
|
|
|
|
|
|
|
if (frame->window->on_all_workspaces)
|
|
|
|
info->flags |= META_FRAME_STUCK;
|
2001-06-03 17:39:57 -04:00
|
|
|
|
|
|
|
info->drawable = None;
|
|
|
|
info->xoffset = 0;
|
|
|
|
info->yoffset = 0;
|
2001-05-31 23:00:01 -04:00
|
|
|
info->display = frame->window->display->xdisplay;
|
|
|
|
info->screen = frame->window->screen->xscreen;
|
|
|
|
info->visual = frame->window->xvisual;
|
|
|
|
info->depth = frame->window->depth;
|
|
|
|
info->title = frame->window->title;
|
|
|
|
info->width = frame->rect.width;
|
|
|
|
info->height = frame->rect.height;
|
2001-06-03 14:33:59 -04:00
|
|
|
info->colors = &(frame->window->screen->colors);
|
2001-06-06 00:47:37 -04:00
|
|
|
info->current_control = frame->current_control;
|
|
|
|
if (frame->grab)
|
|
|
|
info->current_control_state = META_STATE_ACTIVE;
|
|
|
|
else
|
|
|
|
info->current_control_state = META_STATE_PRELIGHT;
|
2001-05-31 23:00:01 -04:00
|
|
|
}
|
|
|
|
|
2001-06-10 23:24:20 -04:00
|
|
|
static void
|
|
|
|
pango_hack_start (MetaDisplay *display)
|
2001-05-31 02:42:58 -04:00
|
|
|
{
|
2001-06-10 23:24:20 -04:00
|
|
|
if (display->server_grab_count > 0)
|
2001-05-31 02:42:58 -04:00
|
|
|
{
|
2001-06-10 23:24:20 -04:00
|
|
|
meta_verbose ("Pango workaround, ungrabbing server\n");
|
|
|
|
XUngrabServer (display->xdisplay);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
2001-06-10 23:24:20 -04:00
|
|
|
}
|
2001-06-09 17:58:30 -04:00
|
|
|
|
2001-06-10 23:24:20 -04:00
|
|
|
static void
|
|
|
|
pango_hack_end (MetaDisplay *display)
|
|
|
|
{
|
|
|
|
if (display->server_grab_count > 0)
|
|
|
|
{
|
|
|
|
meta_verbose ("Pango workaround, regrabbing server\n");
|
|
|
|
XGrabServer (display->xdisplay);
|
|
|
|
}
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
void
|
2001-06-02 21:33:27 -04:00
|
|
|
meta_frame_calc_geometry (MetaFrame *frame,
|
|
|
|
int child_width, int child_height,
|
|
|
|
MetaFrameGeometry *geomp)
|
|
|
|
{
|
|
|
|
MetaFrameInfo info;
|
|
|
|
MetaFrameGeometry geom;
|
|
|
|
MetaWindow *window;
|
|
|
|
|
|
|
|
/* Remember this is called from the constructor
|
2001-06-09 17:58:30 -04:00
|
|
|
* pre-X-window-creation.
|
2001-06-02 21:33:27 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
window = frame->window;
|
2001-06-07 22:17:48 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
/* frame->rect isn't useful yet */
|
2001-06-07 22:17:48 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
|
|
|
|
/* these were from frame->rect so fix them up */
|
|
|
|
info.width = child_width;
|
2001-06-07 22:17:48 -04:00
|
|
|
if (window->shaded)
|
2001-06-09 17:58:30 -04:00
|
|
|
info.height = 0;
|
2001-06-07 22:17:48 -04:00
|
|
|
else
|
2001-06-09 17:58:30 -04:00
|
|
|
info.height = child_height;
|
2001-06-02 21:33:27 -04:00
|
|
|
|
|
|
|
if (!frame->theme_acquired)
|
|
|
|
frame->theme_data = window->screen->engine->acquire_frame (&info);
|
|
|
|
|
|
|
|
geom.left_width = 0;
|
|
|
|
geom.right_width = 0;
|
|
|
|
geom.top_height = 0;
|
|
|
|
geom.bottom_height = 0;
|
2001-06-03 14:33:59 -04:00
|
|
|
geom.background_pixel =
|
|
|
|
meta_screen_get_x_pixel (frame->window->screen,
|
|
|
|
&frame->window->screen->colors.bg[META_STATE_NORMAL]);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
|
|
|
geom.shape_mask = None;
|
|
|
|
|
2001-06-10 23:24:20 -04:00
|
|
|
pango_hack_start (frame->window->display);
|
2001-06-02 21:33:27 -04:00
|
|
|
window->screen->engine->fill_frame_geometry (&info, &geom,
|
|
|
|
frame->theme_data);
|
2001-06-10 23:24:20 -04:00
|
|
|
pango_hack_end (frame->window->display);
|
2001-06-03 17:39:57 -04:00
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
*geomp = geom;
|
|
|
|
}
|
|
|
|
|
2001-06-03 17:39:57 -04:00
|
|
|
static void
|
|
|
|
set_background_none (MetaFrame *frame)
|
|
|
|
{
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
|
|
|
|
attrs.background_pixmap = None;
|
|
|
|
XChangeWindowAttributes (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
CWBackPixmap,
|
|
|
|
&attrs);
|
2001-06-04 00:58:22 -04:00
|
|
|
|
2001-06-07 22:17:48 -04:00
|
|
|
#if 0
|
2001-06-04 00:58:22 -04:00
|
|
|
meta_debug_spew ("Frame size %d,%d %dx%d window size %d,%d %dx%d window pos %d,%d\n",
|
|
|
|
frame->rect.x,
|
|
|
|
frame->rect.y,
|
|
|
|
frame->rect.width,
|
|
|
|
frame->rect.height,
|
|
|
|
frame->window->rect.x,
|
|
|
|
frame->window->rect.y,
|
|
|
|
frame->window->rect.width,
|
|
|
|
frame->window->rect.height,
|
|
|
|
frame->child_x,
|
|
|
|
frame->child_y);
|
2001-06-07 22:17:48 -04:00
|
|
|
#endif
|
2001-06-03 17:39:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_background_color (MetaFrame *frame)
|
|
|
|
{
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
|
|
|
|
attrs.background_pixel = None;
|
|
|
|
XChangeWindowAttributes (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
CWBackPixel,
|
|
|
|
&attrs);
|
|
|
|
}
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
void
|
|
|
|
meta_window_ensure_frame (MetaWindow *window)
|
|
|
|
{
|
|
|
|
MetaFrame *frame;
|
|
|
|
XSetWindowAttributes attrs;
|
2001-06-10 23:24:20 -04:00
|
|
|
|
|
|
|
g_return_if_fail (window->display->server_grab_count > 0);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
|
|
|
if (window->frame)
|
|
|
|
return;
|
|
|
|
|
|
|
|
frame = g_new (MetaFrame, 1);
|
|
|
|
|
|
|
|
frame->window = window;
|
|
|
|
frame->xwindow = None;
|
|
|
|
frame->theme_acquired = FALSE;
|
2001-06-06 00:47:37 -04:00
|
|
|
frame->grab = NULL;
|
|
|
|
frame->current_control = META_FRAME_CONTROL_NONE;
|
|
|
|
frame->tooltip_timeout = 0;
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
frame->rect = window->rect;
|
|
|
|
frame->child_x = 0;
|
|
|
|
frame->child_y = 0;
|
|
|
|
frame->bottom_height = 0;
|
|
|
|
frame->right_width = 0;
|
|
|
|
frame->bg_pixel = 0;
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
frame->mapped = FALSE;
|
|
|
|
|
2001-06-06 22:42:24 -04:00
|
|
|
attrs.event_mask = EVENT_MASK;
|
2001-05-31 02:42:58 -04:00
|
|
|
|
|
|
|
frame->xwindow = XCreateWindow (window->display->xdisplay,
|
|
|
|
window->screen->xroot,
|
|
|
|
frame->rect.x,
|
|
|
|
frame->rect.y,
|
|
|
|
frame->rect.width,
|
|
|
|
frame->rect.height,
|
|
|
|
0,
|
|
|
|
window->depth,
|
|
|
|
InputOutput,
|
|
|
|
window->xvisual,
|
2001-06-09 17:58:30 -04:00
|
|
|
CWEventMask,
|
2001-05-31 02:42:58 -04:00
|
|
|
&attrs);
|
2001-06-02 00:14:18 -04:00
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
meta_verbose ("Frame for %s is 0x%lx\n", frame->window->desc, frame->xwindow);
|
2001-06-02 00:14:18 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
meta_display_register_x_window (window->display, &frame->xwindow, window);
|
|
|
|
|
|
|
|
/* Reparent the client window; it may be destroyed,
|
|
|
|
* thus the error trap. We'll get a destroy notify later
|
|
|
|
* and free everything. Comment in FVWM source code says
|
2001-06-10 23:24:20 -04:00
|
|
|
* we need a server grab or the child can get its MapNotify
|
2001-05-31 02:42:58 -04:00
|
|
|
* before we've finished reparenting and getting the decoration
|
2001-06-10 23:24:20 -04:00
|
|
|
* window onscreen, so ensure_frame must be called with
|
|
|
|
* a grab.
|
2001-05-31 02:42:58 -04:00
|
|
|
*/
|
|
|
|
meta_error_trap_push (window->display);
|
2001-06-04 02:17:52 -04:00
|
|
|
window->mapped = FALSE; /* the reparent will unmap the window,
|
|
|
|
* we don't want to take that as a withdraw
|
|
|
|
*/
|
2001-06-10 23:24:20 -04:00
|
|
|
window->unmaps_pending += 1;
|
2001-05-31 02:42:58 -04:00
|
|
|
XReparentWindow (window->display->xdisplay,
|
|
|
|
window->xwindow,
|
|
|
|
frame->xwindow,
|
2001-06-09 17:58:30 -04:00
|
|
|
0, 0);
|
2001-05-31 02:42:58 -04:00
|
|
|
meta_error_trap_pop (window->display);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
/* stick frame to the window */
|
2001-06-04 02:17:52 -04:00
|
|
|
window->frame = frame;
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_destroy_frame (MetaWindow *window)
|
|
|
|
{
|
|
|
|
MetaFrame *frame;
|
2001-05-31 23:00:01 -04:00
|
|
|
MetaFrameInfo info;
|
2001-05-31 02:42:58 -04:00
|
|
|
|
|
|
|
if (window->frame == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
frame = window->frame;
|
2001-05-31 23:00:01 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
if (frame->tooltip_timeout)
|
|
|
|
clear_tip (frame);
|
|
|
|
|
2001-05-31 23:00:01 -04:00
|
|
|
if (frame->theme_data)
|
|
|
|
{
|
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
window->screen->engine->release_frame (&info, frame->theme_data);
|
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
|
|
|
|
/* Unparent the client window; it may be destroyed,
|
|
|
|
* thus the error trap.
|
|
|
|
*/
|
|
|
|
meta_error_trap_push (window->display);
|
2001-06-04 02:17:52 -04:00
|
|
|
window->mapped = FALSE; /* Keep track of unmapping it, so we
|
|
|
|
* can identify a withdraw initiated
|
|
|
|
* by the client.
|
|
|
|
*/
|
2001-06-10 23:24:20 -04:00
|
|
|
window->unmaps_pending += 1;
|
2001-05-31 02:42:58 -04:00
|
|
|
XReparentWindow (window->display->xdisplay,
|
|
|
|
window->xwindow,
|
|
|
|
window->screen->xroot,
|
|
|
|
/* FIXME where to put it back depends on the gravity */
|
|
|
|
window->frame->rect.x,
|
|
|
|
window->frame->rect.y);
|
|
|
|
meta_error_trap_pop (window->display);
|
|
|
|
|
|
|
|
meta_display_unregister_x_window (window->display,
|
|
|
|
frame->xwindow);
|
|
|
|
|
|
|
|
window->frame = NULL;
|
|
|
|
|
|
|
|
/* should we push an error trap? */
|
|
|
|
XDestroyWindow (window->display->xdisplay, frame->xwindow);
|
|
|
|
|
|
|
|
g_free (frame);
|
2001-06-04 02:17:52 -04:00
|
|
|
|
|
|
|
/* Put our state back where it should be */
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_window_queue_calc_showing (window);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
void
|
2001-06-09 23:17:15 -04:00
|
|
|
meta_frame_sync_to_window (MetaFrame *frame,
|
|
|
|
gboolean need_move,
|
|
|
|
gboolean need_resize)
|
2001-06-02 21:33:27 -04:00
|
|
|
{
|
2001-06-10 23:24:20 -04:00
|
|
|
meta_verbose ("Syncing frame geometry %d,%d %dx%d (SE: %d,%d) pixel %ld\n",
|
2001-06-09 17:58:30 -04:00
|
|
|
frame->rect.x, frame->rect.y,
|
|
|
|
frame->rect.width, frame->rect.height,
|
2001-06-10 23:24:20 -04:00
|
|
|
frame->rect.x + frame->rect.width,
|
|
|
|
frame->rect.y + frame->rect.height,
|
2001-06-09 17:58:30 -04:00
|
|
|
frame->bg_pixel);
|
2001-06-09 23:17:15 -04:00
|
|
|
|
|
|
|
/* set bg to none to avoid flicker */
|
2001-06-03 17:39:57 -04:00
|
|
|
set_background_none (frame);
|
2001-06-09 23:17:15 -04:00
|
|
|
|
|
|
|
if (need_move && need_resize)
|
|
|
|
XMoveResizeWindow (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
frame->rect.x,
|
|
|
|
frame->rect.y,
|
|
|
|
frame->rect.width,
|
|
|
|
frame->rect.height);
|
|
|
|
else if (need_move)
|
|
|
|
XMoveWindow (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
frame->rect.x,
|
|
|
|
frame->rect.y);
|
|
|
|
else if (need_resize)
|
|
|
|
XResizeWindow (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
frame->rect.width,
|
|
|
|
frame->rect.height);
|
|
|
|
|
|
|
|
/* also syncs bg_pixel */
|
2001-06-03 17:39:57 -04:00
|
|
|
set_background_color (frame);
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_frame_queue_draw (frame);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
|
|
|
|
2001-06-03 17:39:57 -04:00
|
|
|
static void
|
|
|
|
meta_frame_draw_now (MetaFrame *frame,
|
|
|
|
int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
MetaFrameInfo info;
|
|
|
|
Pixmap p;
|
|
|
|
XGCValues vals;
|
|
|
|
|
|
|
|
if (frame->xwindow == None)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
|
|
|
|
if (width < 0)
|
|
|
|
width = frame->rect.width;
|
|
|
|
|
|
|
|
if (height < 0)
|
|
|
|
height = frame->rect.height;
|
|
|
|
|
|
|
|
if (width == 0 || height == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
p = XCreatePixmap (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
width, height,
|
|
|
|
frame->window->screen->visual_info.depth);
|
|
|
|
|
|
|
|
vals.foreground = frame->bg_pixel;
|
|
|
|
XChangeGC (frame->window->display->xdisplay,
|
|
|
|
frame->window->screen->scratch_gc,
|
|
|
|
GCForeground,
|
|
|
|
&vals);
|
|
|
|
|
|
|
|
XFillRectangle (frame->window->display->xdisplay,
|
|
|
|
p,
|
|
|
|
frame->window->screen->scratch_gc,
|
|
|
|
0, 0,
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
info.drawable = p;
|
|
|
|
info.xoffset = - x;
|
|
|
|
info.yoffset = - y;
|
2001-06-10 23:24:20 -04:00
|
|
|
pango_hack_start (frame->window->display);
|
2001-06-03 17:39:57 -04:00
|
|
|
frame->window->screen->engine->expose_frame (&info,
|
|
|
|
0, 0, width, height,
|
|
|
|
frame->theme_data);
|
2001-06-10 23:24:20 -04:00
|
|
|
pango_hack_end (frame->window->display);
|
|
|
|
|
2001-06-03 17:39:57 -04:00
|
|
|
|
|
|
|
XCopyArea (frame->window->display->xdisplay,
|
|
|
|
p, frame->xwindow,
|
|
|
|
frame->window->screen->scratch_gc,
|
|
|
|
0, 0,
|
|
|
|
width, height,
|
|
|
|
x, y);
|
|
|
|
|
|
|
|
XFreePixmap (frame->window->display->xdisplay,
|
|
|
|
p);
|
|
|
|
}
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
void
|
|
|
|
meta_frame_queue_draw (MetaFrame *frame)
|
|
|
|
{
|
2001-06-03 17:39:57 -04:00
|
|
|
/* FIXME, actually queue */
|
|
|
|
meta_frame_draw_now (frame, 0, 0, -1, -1);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
|
|
|
|
2001-06-02 00:14:18 -04:00
|
|
|
static void
|
|
|
|
frame_query_root_pointer (MetaFrame *frame,
|
|
|
|
int *x, int *y)
|
|
|
|
{
|
|
|
|
Window root_return, child_return;
|
|
|
|
int root_x_return, root_y_return;
|
|
|
|
int win_x_return, win_y_return;
|
|
|
|
unsigned int mask_return;
|
|
|
|
|
|
|
|
XQueryPointer (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
&root_return,
|
|
|
|
&child_return,
|
|
|
|
&root_x_return,
|
|
|
|
&root_y_return,
|
|
|
|
&win_x_return,
|
|
|
|
&win_y_return,
|
|
|
|
&mask_return);
|
|
|
|
|
|
|
|
if (x)
|
|
|
|
*x = root_x_return;
|
|
|
|
if (y)
|
|
|
|
*y = root_y_return;
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
static void
|
|
|
|
show_tip_now (MetaFrame *frame)
|
|
|
|
{
|
|
|
|
const char *tiptext;
|
|
|
|
|
|
|
|
tiptext = NULL;
|
|
|
|
switch (frame->current_control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_TITLE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
|
|
|
tiptext = _("Close Window");
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
|
|
|
tiptext = _("Menu");
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_ICONIFY:
|
|
|
|
tiptext = _("Minimize Window");
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
|
|
|
tiptext = _("Maximize Window");
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_S:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SW:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_N:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NW:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_W:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_E:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_NONE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tiptext)
|
|
|
|
{
|
|
|
|
int x, y, width, height;
|
|
|
|
MetaFrameInfo info;
|
|
|
|
|
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
frame->window->screen->engine->get_control_rect (&info,
|
|
|
|
frame->current_control,
|
|
|
|
&x, &y, &width, &height,
|
|
|
|
frame->theme_data);
|
|
|
|
|
|
|
|
/* Display tip a couple pixels below control */
|
|
|
|
meta_screen_show_tip (frame->window->screen,
|
|
|
|
frame->rect.x + x,
|
|
|
|
frame->rect.y + y + height + 2,
|
|
|
|
tiptext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
tip_timeout_func (gpointer data)
|
|
|
|
{
|
|
|
|
MetaFrame *frame;
|
|
|
|
|
|
|
|
frame = data;
|
|
|
|
|
|
|
|
show_tip_now (frame);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TIP_DELAY 250
|
|
|
|
static void
|
|
|
|
queue_tip (MetaFrame *frame)
|
|
|
|
{
|
|
|
|
if (frame->tooltip_timeout)
|
|
|
|
g_source_remove (frame->tooltip_timeout);
|
|
|
|
|
|
|
|
frame->tooltip_timeout = g_timeout_add (250,
|
|
|
|
tip_timeout_func,
|
|
|
|
frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clear_tip (MetaFrame *frame)
|
|
|
|
{
|
|
|
|
if (frame->tooltip_timeout)
|
|
|
|
{
|
|
|
|
g_source_remove (frame->tooltip_timeout);
|
|
|
|
frame->tooltip_timeout = 0;
|
|
|
|
}
|
|
|
|
meta_screen_hide_tip (frame->window->screen);
|
|
|
|
}
|
|
|
|
|
2001-06-02 00:14:18 -04:00
|
|
|
static MetaFrameControl
|
|
|
|
frame_get_control (MetaFrame *frame,
|
|
|
|
int x, int y)
|
2001-05-31 02:42:58 -04:00
|
|
|
{
|
2001-06-02 00:14:18 -04:00
|
|
|
MetaFrameInfo info;
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
if (x < 0 || y < 0 ||
|
|
|
|
x > frame->rect.width || y > frame->rect.height)
|
|
|
|
return META_FRAME_CONTROL_NONE;
|
|
|
|
|
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
|
2001-06-02 00:14:18 -04:00
|
|
|
return frame->window->screen->engine->get_control (&info,
|
|
|
|
x, y,
|
|
|
|
frame->theme_data);
|
2001-05-31 02:42:58 -04:00
|
|
|
}
|
|
|
|
|
2001-06-02 21:33:27 -04:00
|
|
|
static void
|
2001-06-06 00:47:37 -04:00
|
|
|
update_move (MetaFrame *frame,
|
|
|
|
int x,
|
|
|
|
int y)
|
2001-06-02 21:33:27 -04:00
|
|
|
{
|
2001-06-04 00:58:22 -04:00
|
|
|
int dx, dy;
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
dx = x - frame->grab->start_root_x;
|
|
|
|
dy = y - frame->grab->start_root_y;
|
2001-06-10 23:24:20 -04:00
|
|
|
|
|
|
|
frame->window->user_has_moved = TRUE;
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_window_move (frame->window,
|
|
|
|
frame->grab->start_window_x + dx,
|
|
|
|
frame->grab->start_window_y + dy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_resize_se (MetaFrame *frame,
|
|
|
|
int x, int y)
|
|
|
|
{
|
|
|
|
int dx, dy;
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
dx = x - frame->grab->start_root_x;
|
|
|
|
dy = y - frame->grab->start_root_y;
|
2001-06-10 23:24:20 -04:00
|
|
|
|
|
|
|
frame->window->user_has_resized = TRUE;
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_window_resize (frame->window,
|
|
|
|
frame->grab->start_window_x + dx,
|
|
|
|
frame->grab->start_window_y + dy);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-06 00:47:37 -04:00
|
|
|
update_current_control (MetaFrame *frame,
|
|
|
|
int x_root, int y_root)
|
|
|
|
{
|
|
|
|
MetaFrameControl old;
|
|
|
|
|
|
|
|
if (frame->grab)
|
|
|
|
return;
|
|
|
|
|
|
|
|
old = frame->current_control;
|
|
|
|
|
|
|
|
frame->current_control = frame_get_control (frame,
|
|
|
|
x_root - frame->rect.x,
|
|
|
|
y_root - frame->rect.y);
|
|
|
|
|
|
|
|
if (old != frame->current_control)
|
|
|
|
{
|
|
|
|
meta_frame_queue_draw (frame);
|
|
|
|
|
|
|
|
if (frame->current_control == META_FRAME_CONTROL_NONE)
|
|
|
|
clear_tip (frame);
|
|
|
|
else
|
|
|
|
queue_tip (frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
grab_action (MetaFrame *frame,
|
|
|
|
MetaFrameAction action,
|
|
|
|
Time time)
|
|
|
|
{
|
|
|
|
meta_verbose ("Grabbing action %d\n", action);
|
|
|
|
|
|
|
|
frame->grab = g_new0 (MetaFrameActionGrab, 1);
|
|
|
|
|
|
|
|
if (XGrabPointer (frame->window->display->xdisplay,
|
|
|
|
frame->xwindow,
|
|
|
|
False,
|
|
|
|
ButtonPressMask | ButtonReleaseMask |
|
|
|
|
PointerMotionMask | PointerMotionHintMask,
|
|
|
|
GrabModeAsync, GrabModeAsync,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
time) != GrabSuccess)
|
|
|
|
meta_warning ("Grab for frame action failed\n");
|
|
|
|
|
|
|
|
frame->grab->action = action;
|
|
|
|
|
|
|
|
/* display ACTIVE state */
|
|
|
|
meta_frame_queue_draw (frame);
|
|
|
|
|
|
|
|
clear_tip (frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ungrab_action (MetaFrame *frame,
|
|
|
|
Time time)
|
2001-06-02 21:33:27 -04:00
|
|
|
{
|
|
|
|
int x, y;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
meta_verbose ("Ungrabbing action %d\n", frame->grab->action);
|
2001-06-04 00:58:22 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
XUngrabPointer (frame->window->display->xdisplay,
|
|
|
|
time);
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
g_free (frame->grab);
|
|
|
|
frame->grab = NULL;
|
2001-06-02 21:33:27 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
frame_query_root_pointer (frame, &x, &y);
|
|
|
|
update_current_control (frame, x, y);
|
|
|
|
|
|
|
|
/* undisplay ACTIVE state */
|
|
|
|
meta_frame_queue_draw (frame);
|
|
|
|
|
|
|
|
queue_tip (frame);
|
2001-06-02 21:33:27 -04:00
|
|
|
}
|
|
|
|
|
2001-06-09 02:08:44 -04:00
|
|
|
static void
|
|
|
|
get_menu_items (MetaFrame *frame,
|
|
|
|
MetaFrameInfo *info,
|
|
|
|
MetaMessageWindowMenuOps *ops,
|
|
|
|
MetaMessageWindowMenuOps *insensitive)
|
|
|
|
{
|
|
|
|
*ops = 0;
|
|
|
|
*insensitive = 0;
|
|
|
|
|
|
|
|
if (info->flags & META_FRAME_CONTROL_MAXIMIZE)
|
|
|
|
{
|
|
|
|
if (frame->window->maximized)
|
|
|
|
*ops |= META_MESSAGE_MENU_UNMAXIMIZE;
|
|
|
|
else
|
|
|
|
*ops |= META_MESSAGE_MENU_MAXIMIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frame->window->shaded)
|
|
|
|
*ops |= META_MESSAGE_MENU_UNSHADE;
|
|
|
|
else
|
|
|
|
*ops |= META_MESSAGE_MENU_SHADE;
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
if (frame->window->on_all_workspaces)
|
|
|
|
*ops |= META_MESSAGE_MENU_UNSTICK;
|
|
|
|
else
|
|
|
|
*ops |= META_MESSAGE_MENU_STICK;
|
|
|
|
|
2001-06-09 02:08:44 -04:00
|
|
|
*ops |= (META_MESSAGE_MENU_DELETE | META_MESSAGE_MENU_WORKSPACES | META_MESSAGE_MENU_MINIMIZE);
|
|
|
|
|
2001-06-09 17:58:30 -04:00
|
|
|
if (!(info->flags & META_FRAME_CONTROL_ICONIFY))
|
2001-06-09 02:08:44 -04:00
|
|
|
*insensitive |= META_MESSAGE_MENU_MINIMIZE;
|
|
|
|
|
|
|
|
if (!(info->flags & META_FRAME_CONTROL_DELETE))
|
|
|
|
*insensitive |= META_MESSAGE_MENU_DELETE;
|
|
|
|
}
|
|
|
|
|
2001-05-31 02:42:58 -04:00
|
|
|
gboolean
|
|
|
|
meta_frame_event (MetaFrame *frame,
|
|
|
|
XEvent *event)
|
2001-06-02 00:14:18 -04:00
|
|
|
{
|
2001-05-31 02:42:58 -04:00
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
break;
|
|
|
|
case KeyRelease:
|
|
|
|
break;
|
|
|
|
case ButtonPress:
|
2001-06-06 00:47:37 -04:00
|
|
|
/* you can use button 2 to move a window without raising it */
|
|
|
|
if (event->xbutton.button == 1)
|
|
|
|
meta_window_raise (frame->window);
|
|
|
|
|
|
|
|
update_current_control (frame,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root);
|
|
|
|
|
|
|
|
if (frame->grab == NULL)
|
2001-06-02 00:14:18 -04:00
|
|
|
{
|
|
|
|
MetaFrameControl control;
|
2001-06-06 00:47:37 -04:00
|
|
|
control = frame->current_control;
|
2001-06-02 00:14:18 -04:00
|
|
|
|
2001-06-07 22:17:48 -04:00
|
|
|
if (control == META_FRAME_CONTROL_TITLE &&
|
|
|
|
event->xbutton.button == 1 &&
|
|
|
|
meta_display_is_double_click (frame->window->display))
|
|
|
|
{
|
|
|
|
meta_verbose ("Double click on title\n");
|
|
|
|
|
|
|
|
/* FIXME this catches double click that starts elsewhere
|
|
|
|
* with the second click on title, maybe no one will
|
|
|
|
* ever notice
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (frame->window->shaded)
|
|
|
|
meta_window_unshade (frame->window);
|
|
|
|
else
|
|
|
|
meta_window_shade (frame->window);
|
|
|
|
}
|
|
|
|
else if (((control == META_FRAME_CONTROL_TITLE ||
|
|
|
|
control == META_FRAME_CONTROL_NONE) &&
|
|
|
|
event->xbutton.button == 1) ||
|
|
|
|
event->xbutton.button == 2)
|
2001-06-02 00:14:18 -04:00
|
|
|
{
|
|
|
|
meta_verbose ("Begin move on %s\n",
|
|
|
|
frame->window->desc);
|
2001-06-06 00:47:37 -04:00
|
|
|
grab_action (frame, META_FRAME_ACTION_MOVING,
|
|
|
|
event->xbutton.time);
|
|
|
|
frame->grab->start_root_x = event->xbutton.x_root;
|
|
|
|
frame->grab->start_root_y = event->xbutton.y_root;
|
|
|
|
/* pos of client in root coords */
|
|
|
|
frame->grab->start_window_x =
|
|
|
|
frame->rect.x + frame->window->rect.x;
|
|
|
|
frame->grab->start_window_y =
|
|
|
|
frame->rect.y + frame->window->rect.y;
|
|
|
|
frame->grab->start_button = event->xbutton.button;
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
|
|
|
else if (control == META_FRAME_CONTROL_DELETE &&
|
|
|
|
event->xbutton.button == 1)
|
|
|
|
{
|
|
|
|
meta_verbose ("Close control clicked on %s\n",
|
|
|
|
frame->window->desc);
|
2001-06-06 00:47:37 -04:00
|
|
|
grab_action (frame, META_FRAME_ACTION_DELETING,
|
|
|
|
event->xbutton.time);
|
|
|
|
frame->grab->start_button = event->xbutton.button;
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
2001-06-07 01:18:10 -04:00
|
|
|
else if (control == META_FRAME_CONTROL_MAXIMIZE &&
|
|
|
|
event->xbutton.button == 1)
|
|
|
|
{
|
|
|
|
meta_verbose ("Maximize control clicked on %s\n",
|
|
|
|
frame->window->desc);
|
|
|
|
grab_action (frame, META_FRAME_ACTION_TOGGLING_MAXIMIZE,
|
|
|
|
event->xbutton.time);
|
|
|
|
frame->grab->start_button = event->xbutton.button;
|
|
|
|
}
|
2001-06-02 00:14:18 -04:00
|
|
|
else if (control == META_FRAME_CONTROL_RESIZE_SE &&
|
|
|
|
event->xbutton.button == 1)
|
|
|
|
{
|
|
|
|
meta_verbose ("Resize control clicked on %s\n",
|
|
|
|
frame->window->desc);
|
2001-06-06 00:47:37 -04:00
|
|
|
grab_action (frame, META_FRAME_ACTION_RESIZING_SE,
|
|
|
|
event->xbutton.time);
|
|
|
|
frame->grab->start_root_x = event->xbutton.x_root;
|
|
|
|
frame->grab->start_root_y = event->xbutton.y_root;
|
|
|
|
frame->grab->start_window_x = frame->window->rect.width;
|
|
|
|
frame->grab->start_window_y = frame->window->rect.height;
|
|
|
|
frame->grab->start_button = event->xbutton.button;
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
2001-06-06 22:42:24 -04:00
|
|
|
else if (control == META_FRAME_CONTROL_MENU &&
|
|
|
|
event->xbutton.button == 1)
|
|
|
|
{
|
|
|
|
int x, y, width, height;
|
|
|
|
MetaFrameInfo info;
|
2001-06-09 02:08:44 -04:00
|
|
|
MetaMessageWindowMenuOps ops;
|
|
|
|
MetaMessageWindowMenuOps insensitive;
|
|
|
|
|
2001-06-06 22:42:24 -04:00
|
|
|
meta_verbose ("Menu control clicked on %s\n",
|
|
|
|
frame->window->desc);
|
|
|
|
|
|
|
|
meta_frame_init_info (frame, &info);
|
|
|
|
frame->window->screen->engine->get_control_rect (&info,
|
|
|
|
META_FRAME_CONTROL_MENU,
|
|
|
|
&x, &y, &width, &height,
|
|
|
|
frame->theme_data);
|
|
|
|
|
|
|
|
/* Let the menu get a grab. The user could release button
|
|
|
|
* before the menu gets the grab, in which case the
|
|
|
|
* menu gets somewhat confused, but it's not that
|
|
|
|
* disastrous.
|
|
|
|
*/
|
|
|
|
XUngrabPointer (frame->window->display->xdisplay,
|
|
|
|
event->xbutton.time);
|
2001-06-09 02:08:44 -04:00
|
|
|
|
|
|
|
get_menu_items (frame, &info, &ops, &insensitive);
|
2001-06-06 22:42:24 -04:00
|
|
|
|
|
|
|
meta_ui_slave_show_window_menu (frame->window->screen->uislave,
|
|
|
|
frame->window,
|
|
|
|
frame->rect.x + x,
|
|
|
|
frame->rect.y + y + height,
|
|
|
|
event->xbutton.button,
|
2001-06-09 02:08:44 -04:00
|
|
|
ops, insensitive,
|
2001-06-06 22:42:24 -04:00
|
|
|
event->xbutton.time);
|
|
|
|
}
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case ButtonRelease:
|
2001-06-06 00:47:37 -04:00
|
|
|
if (frame->grab)
|
|
|
|
meta_debug_spew ("Here! grab %p action %d buttons %d %d\n",
|
|
|
|
frame->grab, frame->grab->action, frame->grab->start_button, event->xbutton.button);
|
|
|
|
if (frame->grab &&
|
|
|
|
event->xbutton.button == frame->grab->start_button)
|
2001-06-02 00:14:18 -04:00
|
|
|
{
|
2001-06-06 00:47:37 -04:00
|
|
|
switch (frame->grab->action)
|
2001-06-02 21:33:27 -04:00
|
|
|
{
|
|
|
|
case META_FRAME_ACTION_MOVING:
|
2001-06-06 00:47:37 -04:00
|
|
|
update_move (frame, event->xbutton.x_root, event->xbutton.y_root);
|
|
|
|
ungrab_action (frame, event->xbutton.time);
|
|
|
|
update_current_control (frame,
|
|
|
|
event->xbutton.x_root, event->xbutton.y_root);
|
2001-06-02 21:33:27 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_ACTION_RESIZING_SE:
|
2001-06-06 00:47:37 -04:00
|
|
|
update_resize_se (frame, event->xbutton.x_root, event->xbutton.y_root);
|
|
|
|
ungrab_action (frame, event->xbutton.time);
|
|
|
|
update_current_control (frame,
|
|
|
|
event->xbutton.x_root, event->xbutton.y_root);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_ACTION_DELETING:
|
|
|
|
/* Must ungrab before getting "real" control position */
|
|
|
|
ungrab_action (frame, event->xbutton.time);
|
|
|
|
update_current_control (frame,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root);
|
|
|
|
/* delete if we're still over the button */
|
|
|
|
if (frame->current_control == META_FRAME_CONTROL_DELETE)
|
|
|
|
meta_window_delete (frame->window, event->xbutton.time);
|
2001-06-02 21:33:27 -04:00
|
|
|
break;
|
2001-06-07 01:18:10 -04:00
|
|
|
case META_FRAME_ACTION_TOGGLING_MAXIMIZE:
|
|
|
|
/* Must ungrab before getting "real" control position */
|
|
|
|
ungrab_action (frame, event->xbutton.time);
|
|
|
|
update_current_control (frame,
|
|
|
|
event->xbutton.x_root,
|
|
|
|
event->xbutton.y_root);
|
|
|
|
/* delete if we're still over the button */
|
|
|
|
if (frame->current_control == META_FRAME_CONTROL_MAXIMIZE)
|
|
|
|
{
|
|
|
|
if (frame->window->maximized)
|
|
|
|
meta_window_unmaximize (frame->window);
|
|
|
|
else
|
|
|
|
meta_window_maximize (frame->window);
|
|
|
|
}
|
|
|
|
break;
|
2001-06-02 21:33:27 -04:00
|
|
|
default:
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_warning ("Unhandled action in button release\n");
|
2001-06-02 21:33:27 -04:00
|
|
|
break;
|
|
|
|
}
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case MotionNotify:
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
frame_query_root_pointer (frame, &x, &y);
|
|
|
|
if (frame->grab)
|
|
|
|
{
|
|
|
|
switch (frame->grab->action)
|
|
|
|
{
|
|
|
|
case META_FRAME_ACTION_MOVING:
|
|
|
|
update_move (frame, x, y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_ACTION_RESIZING_SE:
|
|
|
|
update_resize_se (frame, x, y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_ACTION_NONE:
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
update_current_control (frame, x, y);
|
|
|
|
}
|
2001-06-02 00:14:18 -04:00
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case EnterNotify:
|
2001-06-04 00:58:22 -04:00
|
|
|
/* We handle it here if a decorated window
|
|
|
|
* is involved, otherwise we handle it in display.c
|
|
|
|
*/
|
|
|
|
/* do this even if window->has_focus to avoid races */
|
|
|
|
meta_window_focus (frame->window,
|
|
|
|
event->xcrossing.time);
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case LeaveNotify:
|
2001-06-06 00:47:37 -04:00
|
|
|
update_current_control (frame, -1, -1);
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case FocusIn:
|
|
|
|
break;
|
|
|
|
case FocusOut:
|
|
|
|
break;
|
|
|
|
case KeymapNotify:
|
|
|
|
break;
|
|
|
|
case Expose:
|
2001-06-03 17:39:57 -04:00
|
|
|
meta_frame_draw_now (frame,
|
|
|
|
event->xexpose.x,
|
|
|
|
event->xexpose.y,
|
|
|
|
event->xexpose.width,
|
|
|
|
event->xexpose.height);
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case GraphicsExpose:
|
|
|
|
break;
|
|
|
|
case NoExpose:
|
|
|
|
break;
|
|
|
|
case VisibilityNotify:
|
|
|
|
break;
|
|
|
|
case CreateNotify:
|
|
|
|
break;
|
|
|
|
case DestroyNotify:
|
2001-06-02 21:33:27 -04:00
|
|
|
{
|
|
|
|
MetaDisplay *display;
|
|
|
|
|
|
|
|
meta_warning ("Unexpected destruction of frame 0x%lx, not sure if this should silently fail or be considered a bug\n", frame->xwindow);
|
|
|
|
display = frame->window->display;
|
|
|
|
meta_error_trap_push (display);
|
|
|
|
meta_window_destroy_frame (frame->window);
|
|
|
|
meta_error_trap_pop (display);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case UnmapNotify:
|
2001-06-06 00:47:37 -04:00
|
|
|
if (frame->grab)
|
|
|
|
ungrab_action (frame, CurrentTime);
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case MapNotify:
|
2001-06-06 00:47:37 -04:00
|
|
|
if (frame->grab)
|
|
|
|
ungrab_action (frame, CurrentTime);
|
2001-05-31 02:42:58 -04:00
|
|
|
break;
|
|
|
|
case MapRequest:
|
|
|
|
break;
|
|
|
|
case ReparentNotify:
|
|
|
|
break;
|
|
|
|
case ConfigureNotify:
|
|
|
|
break;
|
|
|
|
case ConfigureRequest:
|
|
|
|
break;
|
|
|
|
case GravityNotify:
|
|
|
|
break;
|
|
|
|
case ResizeRequest:
|
|
|
|
break;
|
|
|
|
case CirculateNotify:
|
|
|
|
break;
|
|
|
|
case CirculateRequest:
|
|
|
|
break;
|
|
|
|
case PropertyNotify:
|
|
|
|
break;
|
|
|
|
case SelectionClear:
|
|
|
|
break;
|
|
|
|
case SelectionRequest:
|
|
|
|
break;
|
|
|
|
case SelectionNotify:
|
|
|
|
break;
|
|
|
|
case ColormapNotify:
|
|
|
|
break;
|
|
|
|
case ClientMessage:
|
|
|
|
break;
|
|
|
|
case MappingNotify:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|