mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
changed all tabs to spaces. Removed and replaced with meta_core_get(). New
2007-06-06 Thomas Thurman <thomas@thurman.org.uk> * frames.c, core.[ch]: changed all tabs to spaces. * core.[ch] (meta_core_get_client_size, meta_core_window_has_frame, meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow, meta_core_get_frame_flags, meta_core_get_frame_type, meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position, meta_core_get_size, meta_core_get_frame_workspace, meta_core_get_frame_extents, meta_core_get_screen_size): Removed and replaced with meta_core_get(). * core.[ch] (meta_core_get): New function. * core.h (MetaCoreGetType): New enum. * frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry, meta_frames_get_geometry, meta_frames_apply_shapes, meta_frame_titlebar_event, meta_frames_button_press_event, populate_cache, clip_to_screen, meta_frames_paint_to_drawable, meta_frames_set_window_background, get_control): Replace use of removed functions in ui.c with meta_core_get(). All this should make things a little faster. Closes #377495. svn path=/trunk/; revision=3233
This commit is contained in:
parent
98791271e1
commit
ff33209e1f
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
|||||||
|
2007-06-06 Thomas Thurman <thomas@thurman.org.uk>
|
||||||
|
|
||||||
|
* frames.c, core.[ch]: changed all tabs to spaces.
|
||||||
|
* core.[ch] (meta_core_get_client_size, meta_core_window_has_frame,
|
||||||
|
meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow,
|
||||||
|
meta_core_get_frame_flags, meta_core_get_frame_type,
|
||||||
|
meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position,
|
||||||
|
meta_core_get_size, meta_core_get_frame_workspace,
|
||||||
|
meta_core_get_frame_extents, meta_core_get_screen_size): Removed
|
||||||
|
and replaced with meta_core_get().
|
||||||
|
* core.[ch] (meta_core_get): New function.
|
||||||
|
* core.h (MetaCoreGetType): New enum.
|
||||||
|
* frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry,
|
||||||
|
meta_frames_get_geometry, meta_frames_apply_shapes,
|
||||||
|
meta_frame_titlebar_event, meta_frames_button_press_event,
|
||||||
|
populate_cache, clip_to_screen, meta_frames_paint_to_drawable,
|
||||||
|
meta_frames_set_window_background, get_control): Replace use of
|
||||||
|
removed functions in ui.c with meta_core_get().
|
||||||
|
|
||||||
|
All this should make things a little faster. Closes #377495.
|
||||||
|
|
||||||
2007-06-04 Thomas Thurman <thomas@thurman.org.uk>
|
2007-06-04 Thomas Thurman <thomas@thurman.org.uk>
|
||||||
|
|
||||||
* NEWS: Added translators' names from 2.19.8 (sorry, folks:
|
* NEWS: Added translators' names from 2.19.8 (sorry, folks:
|
||||||
|
297
src/core.c
297
src/core.c
@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
static MetaWindow *
|
static MetaWindow *
|
||||||
get_window (Display *xdisplay,
|
get_window (Display *xdisplay,
|
||||||
Window frame_xwindow)
|
Window frame_xwindow)
|
||||||
{
|
{
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
@ -60,125 +60,156 @@ get_window (Display *xdisplay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_core_get_client_size (Display *xdisplay,
|
meta_core_get (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window xwindow,
|
||||||
int *width,
|
...)
|
||||||
int *height)
|
|
||||||
{
|
{
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
va_list args;
|
||||||
|
MetaCoreGetType request;
|
||||||
|
|
||||||
if (width)
|
MetaDisplay *display = meta_display_for_x_display (xdisplay);
|
||||||
*width = window->rect.width;
|
MetaWindow *window = meta_display_lookup_x_window (display, xwindow);
|
||||||
if (height)
|
|
||||||
*height = window->rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
va_start (args, xwindow);
|
||||||
meta_core_window_has_frame (Display *xdisplay,
|
|
||||||
Window frame_xwindow)
|
|
||||||
{
|
|
||||||
MetaDisplay *display;
|
|
||||||
MetaWindow *window;
|
|
||||||
|
|
||||||
display = meta_display_for_x_display (xdisplay);
|
request = va_arg (args, MetaCoreGetType);
|
||||||
window = meta_display_lookup_x_window (display, frame_xwindow);
|
|
||||||
|
|
||||||
return window != NULL && window->frame != NULL;
|
/* Now, we special-case the first request slightly. Mostly, requests
|
||||||
}
|
* for information on windows which have no frame are errors.
|
||||||
|
* But sometimes we may want to know *whether* a window has a frame.
|
||||||
|
* In this case, pass the key META_CORE_WINDOW_HAS_FRAME
|
||||||
|
* as the *first* request, with a pointer to a boolean; if the window
|
||||||
|
* has no frame, this will be set to False and meta_core_get will
|
||||||
|
* exit immediately (so the values of any other requests will be
|
||||||
|
* undefined). Otherwise it will be set to True and meta_core_get will
|
||||||
|
* continue happily on its way.
|
||||||
|
*/
|
||||||
|
|
||||||
gboolean
|
if (request != META_CORE_WINDOW_HAS_FRAME &&
|
||||||
meta_core_titlebar_is_onscreen (Display *xdisplay,
|
(window == NULL || window->frame == NULL)) {
|
||||||
Window frame_xwindow)
|
meta_bug ("No such frame window 0x%lx!\n", xwindow);
|
||||||
{
|
return;
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
}
|
||||||
|
|
||||||
return meta_window_titlebar_is_onscreen (window);
|
while (request != META_CORE_GET_END) {
|
||||||
}
|
|
||||||
|
|
||||||
Window
|
gpointer answer = va_arg (args, gpointer);
|
||||||
meta_core_get_client_xwindow (Display *xdisplay,
|
|
||||||
Window frame_xwindow)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
return window->xwindow;
|
switch (request) {
|
||||||
}
|
case META_CORE_WINDOW_HAS_FRAME:
|
||||||
|
*((gboolean*)answer) = window != NULL && window->frame != NULL;
|
||||||
|
if (!*((gboolean*)answer)) return; /* see above */
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_CLIENT_WIDTH:
|
||||||
|
*((gint*)answer) = window->rect.width;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_CLIENT_HEIGHT:
|
||||||
|
*((gint*)answer) = window->rect.height;
|
||||||
|
break;
|
||||||
|
case META_CORE_IS_TITLEBAR_ONSCREEN:
|
||||||
|
*((gboolean*)answer) = meta_window_titlebar_is_onscreen (window);
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_CLIENT_XWINDOW:
|
||||||
|
*((Window*)answer) = window->xwindow;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_FLAGS:
|
||||||
|
*((MetaFrameFlags*)answer) = meta_frame_get_flags (window->frame);
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_TYPE:
|
||||||
|
{
|
||||||
|
MetaFrameType base_type = META_FRAME_TYPE_LAST;
|
||||||
|
|
||||||
MetaFrameFlags
|
switch (window->type)
|
||||||
meta_core_get_frame_flags (Display *xdisplay,
|
{
|
||||||
Window frame_xwindow)
|
case META_WINDOW_NORMAL:
|
||||||
{
|
base_type = META_FRAME_TYPE_NORMAL;
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
break;
|
||||||
|
|
||||||
return meta_frame_get_flags (window->frame);
|
case META_WINDOW_DIALOG:
|
||||||
}
|
base_type = META_FRAME_TYPE_DIALOG;
|
||||||
|
break;
|
||||||
|
|
||||||
MetaFrameType
|
case META_WINDOW_MODAL_DIALOG:
|
||||||
meta_core_get_frame_type (Display *xdisplay,
|
base_type = META_FRAME_TYPE_MODAL_DIALOG;
|
||||||
Window frame_xwindow)
|
break;
|
||||||
{
|
|
||||||
MetaWindow *window;
|
|
||||||
MetaFrameType base_type;
|
|
||||||
|
|
||||||
window = get_window (xdisplay, frame_xwindow);
|
case META_WINDOW_MENU:
|
||||||
|
base_type = META_FRAME_TYPE_MENU;
|
||||||
|
break;
|
||||||
|
|
||||||
base_type = META_FRAME_TYPE_LAST;
|
case META_WINDOW_UTILITY:
|
||||||
|
base_type = META_FRAME_TYPE_UTILITY;
|
||||||
|
break;
|
||||||
|
|
||||||
switch (window->type)
|
case META_WINDOW_DESKTOP:
|
||||||
{
|
case META_WINDOW_DOCK:
|
||||||
case META_WINDOW_NORMAL:
|
case META_WINDOW_TOOLBAR:
|
||||||
base_type = META_FRAME_TYPE_NORMAL;
|
case META_WINDOW_SPLASHSCREEN:
|
||||||
break;
|
/* No frame */
|
||||||
|
base_type = META_FRAME_TYPE_LAST;
|
||||||
|
break;
|
||||||
|
|
||||||
case META_WINDOW_DIALOG:
|
}
|
||||||
base_type = META_FRAME_TYPE_DIALOG;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case META_WINDOW_MODAL_DIALOG:
|
if (base_type == META_FRAME_TYPE_LAST)
|
||||||
base_type = META_FRAME_TYPE_MODAL_DIALOG;
|
{
|
||||||
break;
|
/* can't add border if undecorated */
|
||||||
|
*((MetaFrameType*)answer) = META_FRAME_TYPE_LAST;
|
||||||
|
}
|
||||||
|
else if (window->border_only)
|
||||||
|
{
|
||||||
|
/* override base frame type */
|
||||||
|
*((MetaFrameType*)answer) = META_FRAME_TYPE_BORDER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*((MetaFrameType*)answer) = base_type;
|
||||||
|
}
|
||||||
|
|
||||||
case META_WINDOW_MENU:
|
break;
|
||||||
base_type = META_FRAME_TYPE_MENU;
|
}
|
||||||
break;
|
case META_CORE_GET_MINI_ICON:
|
||||||
|
*((GdkPixbuf**)answer) = window->mini_icon;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_ICON:
|
||||||
|
*((GdkPixbuf**)answer) = window->icon;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_X:
|
||||||
|
meta_window_get_position (window, (int*)answer, NULL);
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_Y:
|
||||||
|
meta_window_get_position (window, NULL, (int*)answer);
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_WORKSPACE:
|
||||||
|
*((gint*)answer) = meta_window_get_net_wm_desktop (window);
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_X:
|
||||||
|
*((gint*)answer) = window->frame->rect.x;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_Y:
|
||||||
|
*((gint*)answer) = window->frame->rect.y;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_WIDTH:
|
||||||
|
*((gint*)answer) = window->frame->rect.width;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_FRAME_HEIGHT:
|
||||||
|
*((gint*)answer) = window->frame->rect.height;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_SCREEN_WIDTH:
|
||||||
|
*((gint*)answer) = window->screen->rect.width;
|
||||||
|
break;
|
||||||
|
case META_CORE_GET_SCREEN_HEIGHT:
|
||||||
|
*((gint*)answer) = window->screen->rect.height;
|
||||||
|
break;
|
||||||
|
|
||||||
case META_WINDOW_UTILITY:
|
default:
|
||||||
base_type = META_FRAME_TYPE_UTILITY;
|
meta_warning(_("Unknown window information request: %d"), request);
|
||||||
break;
|
|
||||||
|
|
||||||
case META_WINDOW_DESKTOP:
|
|
||||||
case META_WINDOW_DOCK:
|
|
||||||
case META_WINDOW_TOOLBAR:
|
|
||||||
case META_WINDOW_SPLASHSCREEN:
|
|
||||||
/* No frame */
|
|
||||||
base_type = META_FRAME_TYPE_LAST;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_type == META_FRAME_TYPE_LAST)
|
request = va_arg (args, MetaCoreGetType);
|
||||||
return META_FRAME_TYPE_LAST; /* can't add border if undecorated */
|
}
|
||||||
else if (window->border_only)
|
|
||||||
return META_FRAME_TYPE_BORDER; /* override base frame type */
|
|
||||||
else
|
|
||||||
return base_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkPixbuf*
|
va_end (args);
|
||||||
meta_core_get_mini_icon (Display *xdisplay,
|
|
||||||
Window frame_xwindow)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
return window->mini_icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkPixbuf*
|
|
||||||
meta_core_get_icon (Display *xdisplay,
|
|
||||||
Window frame_xwindow)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
return window->icon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -275,32 +306,6 @@ meta_core_user_focus (Display *xdisplay,
|
|||||||
meta_window_focus (window, timestamp);
|
meta_window_focus (window, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
meta_core_get_position (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *x,
|
|
||||||
int *y)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
meta_window_get_position (window, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_core_get_size (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *width,
|
|
||||||
int *height)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
if (width)
|
|
||||||
*width = window->rect.width;
|
|
||||||
if (height)
|
|
||||||
*height = window->rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_core_minimize (Display *xdisplay,
|
meta_core_minimize (Display *xdisplay,
|
||||||
Window frame_xwindow)
|
Window frame_xwindow)
|
||||||
@ -451,36 +456,6 @@ meta_core_get_active_workspace (Screen *xscreen)
|
|||||||
return meta_workspace_index (screen->active_workspace);
|
return meta_workspace_index (screen->active_workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
meta_core_get_frame_workspace (Display *xdisplay,
|
|
||||||
Window frame_xwindow)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
return meta_window_get_net_wm_desktop (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_core_get_frame_extents (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *x,
|
|
||||||
int *y,
|
|
||||||
int *width,
|
|
||||||
int *height)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
|
||||||
|
|
||||||
if (x)
|
|
||||||
*x = window->frame->rect.x;
|
|
||||||
if (y)
|
|
||||||
*y = window->frame->rect.y;
|
|
||||||
if (width)
|
|
||||||
*width = window->frame->rect.width;
|
|
||||||
if (height)
|
|
||||||
*height = window->frame->rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_core_show_window_menu (Display *xdisplay,
|
meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
@ -730,20 +705,6 @@ meta_core_set_screen_cursor (Display *xdisplay,
|
|||||||
meta_frame_set_screen_cursor (window->frame, cursor);
|
meta_frame_set_screen_cursor (window->frame, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
meta_core_get_screen_size (Display *xdisplay,
|
|
||||||
Window frame_on_screen,
|
|
||||||
int *width,
|
|
||||||
int *height)
|
|
||||||
{
|
|
||||||
MetaWindow *window = get_window (xdisplay, frame_on_screen);
|
|
||||||
|
|
||||||
if (width)
|
|
||||||
*width = window->screen->rect.width;
|
|
||||||
if (height)
|
|
||||||
*height = window->screen->rect.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_core_increment_event_serial (Display *xdisplay)
|
meta_core_increment_event_serial (Display *xdisplay)
|
||||||
{
|
{
|
||||||
|
108
src/core.h
108
src/core.h
@ -29,30 +29,68 @@
|
|||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
void meta_core_get_client_size (Display *xdisplay,
|
typedef enum
|
||||||
Window frame_xwindow,
|
{
|
||||||
int *width,
|
META_CORE_GET_END = 0,
|
||||||
int *height);
|
META_CORE_WINDOW_HAS_FRAME,
|
||||||
|
META_CORE_GET_CLIENT_WIDTH,
|
||||||
|
META_CORE_GET_CLIENT_HEIGHT,
|
||||||
|
META_CORE_IS_TITLEBAR_ONSCREEN,
|
||||||
|
META_CORE_GET_CLIENT_XWINDOW,
|
||||||
|
META_CORE_GET_FRAME_FLAGS,
|
||||||
|
META_CORE_GET_FRAME_TYPE,
|
||||||
|
META_CORE_GET_MINI_ICON,
|
||||||
|
META_CORE_GET_ICON,
|
||||||
|
META_CORE_GET_X,
|
||||||
|
META_CORE_GET_Y,
|
||||||
|
META_CORE_GET_FRAME_WORKSPACE,
|
||||||
|
META_CORE_GET_FRAME_X,
|
||||||
|
META_CORE_GET_FRAME_Y,
|
||||||
|
META_CORE_GET_FRAME_WIDTH,
|
||||||
|
META_CORE_GET_FRAME_HEIGHT,
|
||||||
|
META_CORE_GET_SCREEN_WIDTH,
|
||||||
|
META_CORE_GET_SCREEN_HEIGHT,
|
||||||
|
} MetaCoreGetType;
|
||||||
|
|
||||||
gboolean meta_core_titlebar_is_onscreen (Display *xdisplay,
|
/* General information function about the given window. Pass in a sequence of
|
||||||
Window frame_xwindow);
|
* pairs of MetaCoreGetTypes and pointers to variables; the variables will be
|
||||||
|
* filled with the requested values. End the list with META_CORE_GET_END.
|
||||||
gboolean meta_core_window_has_frame (Display *xdisplay,
|
* For example:
|
||||||
Window frame_xwindow);
|
*
|
||||||
|
* meta_core_get (my_display, my_window,
|
||||||
|
* META_CORE_GET_X, &x,
|
||||||
Window meta_core_get_client_xwindow (Display *xdisplay,
|
* META_CORE_GET_Y, &y,
|
||||||
Window frame_xwindow);
|
* META_CORE_GET_END);
|
||||||
|
*
|
||||||
MetaFrameFlags meta_core_get_frame_flags (Display *xdisplay,
|
* If the window doesn't have a frame, this will raise a meta_bug. To suppress
|
||||||
Window frame_xwindow);
|
* this behaviour, ask META_CORE_WINDOW_HAS_FRAME as the *first* question in
|
||||||
MetaFrameType meta_core_get_frame_type (Display *xdisplay,
|
* the list. If the window has no frame, the answer to this question will be
|
||||||
Window frame_xwindow);
|
* False, and anything else you asked will be undefined. Otherwise, the answer
|
||||||
|
* will be True. The answer will necessarily be True if you ask the question
|
||||||
GdkPixbuf* meta_core_get_mini_icon (Display *xdisplay,
|
* in any other position. The positions of all other questions don't matter.
|
||||||
Window frame_xwindow);
|
*
|
||||||
GdkPixbuf* meta_core_get_icon (Display *xdisplay,
|
* The reason for this function is that some parts of the program don't know
|
||||||
Window frame_xwindow);
|
* about MetaWindows. But they *can* see core.h. So we used to have a whole
|
||||||
|
* load of functions which took a display and an X window, looked up the
|
||||||
|
* relevant MetaWindow, and returned information about it. The trouble with
|
||||||
|
* that is that looking up the MetaWindow is a nontrivial operation, and
|
||||||
|
* consolidating the calls in this way makes (for example) frame exposes
|
||||||
|
* 33% faster, according to valgrind.
|
||||||
|
*
|
||||||
|
* This function would perhaps be slightly better if the questions were
|
||||||
|
* represented by pointers, perhaps gchar*s, because then we could take
|
||||||
|
* advantage of gcc's automatic sentinel checking. On the other hand, this
|
||||||
|
* immediately suggests string comparison, and that's slow.
|
||||||
|
*
|
||||||
|
* Another possible improvement is that core.h still has a bunch of
|
||||||
|
* functions which can't be described by the formula "give a display and
|
||||||
|
* an X window, get a single value" (meta_core_user_move, for example), but
|
||||||
|
* which could theoretically be handled by this function if we relaxed the
|
||||||
|
* requirement that all questions should have exactly one argument.
|
||||||
|
*/
|
||||||
|
void meta_core_get (Display *xdisplay,
|
||||||
|
Window window,
|
||||||
|
...);
|
||||||
|
|
||||||
void meta_core_queue_frame_resize (Display *xdisplay,
|
void meta_core_queue_frame_resize (Display *xdisplay,
|
||||||
Window frame_xwindow);
|
Window frame_xwindow);
|
||||||
@ -78,17 +116,6 @@ void meta_core_user_focus (Display *xdisplay,
|
|||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
|
|
||||||
/* get position of client, same coord space expected by move */
|
|
||||||
void meta_core_get_position (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *x,
|
|
||||||
int *y);
|
|
||||||
|
|
||||||
void meta_core_get_size (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *width,
|
|
||||||
int *height);
|
|
||||||
|
|
||||||
void meta_core_minimize (Display *xdisplay,
|
void meta_core_minimize (Display *xdisplay,
|
||||||
Window frame_xwindow);
|
Window frame_xwindow);
|
||||||
void meta_core_toggle_maximize (Display *xdisplay,
|
void meta_core_toggle_maximize (Display *xdisplay,
|
||||||
@ -126,14 +153,6 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
|
|||||||
Window xroot,
|
Window xroot,
|
||||||
int index);
|
int index);
|
||||||
|
|
||||||
void meta_core_get_frame_extents (Display *xdisplay,
|
|
||||||
Window frame_xwindow,
|
|
||||||
int *x,
|
|
||||||
int *y,
|
|
||||||
int *width,
|
|
||||||
int *height);
|
|
||||||
|
|
||||||
|
|
||||||
void meta_core_show_window_menu (Display *xdisplay,
|
void meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
int root_x,
|
int root_x,
|
||||||
@ -170,11 +189,6 @@ void meta_core_set_screen_cursor (Display *xdisplay,
|
|||||||
Window frame_on_screen,
|
Window frame_on_screen,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
|
|
||||||
void meta_core_get_screen_size (Display *xdisplay,
|
|
||||||
Window frame_on_screen,
|
|
||||||
int *width,
|
|
||||||
int *height);
|
|
||||||
|
|
||||||
/* Used because we ignore EnterNotify when a window is unmapped that
|
/* Used because we ignore EnterNotify when a window is unmapped that
|
||||||
* really shouldn't cause focus changes, by comparing the event serial
|
* really shouldn't cause focus changes, by comparing the event serial
|
||||||
* of the EnterNotify and the UnmapNotify.
|
* of the EnterNotify and the UnmapNotify.
|
||||||
|
218
src/frames.c
218
src/frames.c
@ -73,8 +73,8 @@ static void meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
GdkRegion *region,
|
GdkRegion *region,
|
||||||
int x_offset,
|
int x_offset,
|
||||||
int y_offset);
|
int y_offset);
|
||||||
|
|
||||||
static void meta_frames_set_window_background (MetaFrames *frames,
|
static void meta_frames_set_window_background (MetaFrames *frames,
|
||||||
MetaUIFrame *frame);
|
MetaUIFrame *frame);
|
||||||
@ -102,7 +102,7 @@ static MetaFrameControl get_control (MetaFrames *frames,
|
|||||||
static void clear_tip (MetaFrames *frames);
|
static void clear_tip (MetaFrames *frames);
|
||||||
static void invalidate_all_caches (MetaFrames *frames);
|
static void invalidate_all_caches (MetaFrames *frames);
|
||||||
static void invalidate_whole_window (MetaFrames *frames,
|
static void invalidate_whole_window (MetaFrames *frames,
|
||||||
MetaUIFrame *frame);
|
MetaUIFrame *frame);
|
||||||
|
|
||||||
static GtkWidgetClass *parent_class = NULL;
|
static GtkWidgetClass *parent_class = NULL;
|
||||||
|
|
||||||
@ -115,12 +115,12 @@ meta_frames_get_type (void)
|
|||||||
{
|
{
|
||||||
static const GtkTypeInfo frames_info =
|
static const GtkTypeInfo frames_info =
|
||||||
{
|
{
|
||||||
"MetaFrames",
|
"MetaFrames",
|
||||||
sizeof (MetaFrames),
|
sizeof (MetaFrames),
|
||||||
sizeof (MetaFramesClass),
|
sizeof (MetaFramesClass),
|
||||||
(GtkClassInitFunc) meta_frames_class_init,
|
(GtkClassInitFunc) meta_frames_class_init,
|
||||||
(GtkObjectInitFunc) meta_frames_init,
|
(GtkObjectInitFunc) meta_frames_init,
|
||||||
/* reserved_1 */ NULL,
|
/* reserved_1 */ NULL,
|
||||||
/* reserved_2 */ NULL,
|
/* reserved_2 */ NULL,
|
||||||
(GtkClassInitFunc) NULL,
|
(GtkClassInitFunc) NULL,
|
||||||
};
|
};
|
||||||
@ -295,7 +295,7 @@ typedef struct
|
|||||||
|
|
||||||
static CachedPixels *
|
static CachedPixels *
|
||||||
get_cache (MetaFrames *frames,
|
get_cache (MetaFrames *frames,
|
||||||
MetaUIFrame *frame)
|
MetaUIFrame *frame)
|
||||||
{
|
{
|
||||||
CachedPixels *pixels;
|
CachedPixels *pixels;
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ get_cache (MetaFrames *frames,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
invalidate_cache (MetaFrames *frames,
|
invalidate_cache (MetaFrames *frames,
|
||||||
MetaUIFrame *frame)
|
MetaUIFrame *frame)
|
||||||
{
|
{
|
||||||
CachedPixels *pixels = get_cache (frames, frame);
|
CachedPixels *pixels = get_cache (frames, frame);
|
||||||
int i;
|
int i;
|
||||||
@ -447,8 +447,10 @@ meta_frames_ensure_layout (MetaFrames *frames,
|
|||||||
|
|
||||||
widget = GTK_WIDGET (frames);
|
widget = GTK_WIDGET (frames);
|
||||||
|
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
type = meta_core_get_frame_type (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
style = meta_theme_get_frame_style (meta_theme_get_current (),
|
style = meta_theme_get_frame_style (meta_theme_get_current (),
|
||||||
type, flags);
|
type, flags);
|
||||||
@ -485,7 +487,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
|
|||||||
pango_layout_set_auto_dir (frame->layout, FALSE);
|
pango_layout_set_auto_dir (frame->layout, FALSE);
|
||||||
|
|
||||||
font_desc = meta_gtk_widget_get_font_desc (widget, scale,
|
font_desc = meta_gtk_widget_get_font_desc (widget, scale,
|
||||||
meta_prefs_get_titlebar_font ());
|
meta_prefs_get_titlebar_font ());
|
||||||
|
|
||||||
size = pango_font_description_get_size (font_desc);
|
size = pango_font_description_get_size (font_desc);
|
||||||
|
|
||||||
@ -507,7 +509,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pango_layout_set_font_description (frame->layout,
|
pango_layout_set_font_description (frame->layout,
|
||||||
font_desc);
|
font_desc);
|
||||||
|
|
||||||
pango_font_description_free (font_desc);
|
pango_font_description_free (font_desc);
|
||||||
|
|
||||||
@ -527,11 +529,12 @@ meta_frames_calc_geometry (MetaFrames *frames,
|
|||||||
MetaFrameType type;
|
MetaFrameType type;
|
||||||
MetaButtonLayout button_layout;
|
MetaButtonLayout button_layout;
|
||||||
|
|
||||||
meta_core_get_client_size (gdk_display, frame->xwindow,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
&width, &height);
|
META_CORE_GET_CLIENT_WIDTH, &width,
|
||||||
|
META_CORE_GET_CLIENT_HEIGHT, &height,
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
type = meta_core_get_frame_type (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
meta_frames_ensure_layout (frames, frame);
|
meta_frames_ensure_layout (frames, frame);
|
||||||
|
|
||||||
@ -552,17 +555,17 @@ meta_frames_new (int screen_number)
|
|||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
|
||||||
screen = gdk_display_get_screen (gdk_display_get_default (),
|
screen = gdk_display_get_screen (gdk_display_get_default (),
|
||||||
screen_number);
|
screen_number);
|
||||||
|
|
||||||
return g_object_new (META_TYPE_FRAMES,
|
return g_object_new (META_TYPE_FRAMES,
|
||||||
"screen", screen,
|
"screen", screen,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_frames_manage_window (MetaFrames *frames,
|
meta_frames_manage_window (MetaFrames *frames,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
GdkWindow *window)
|
GdkWindow *window)
|
||||||
{
|
{
|
||||||
MetaUIFrame *frame;
|
MetaUIFrame *frame;
|
||||||
|
|
||||||
@ -614,8 +617,8 @@ meta_frames_unmanage_window (MetaFrames *frames,
|
|||||||
|
|
||||||
/* restore the cursor */
|
/* restore the cursor */
|
||||||
meta_core_set_screen_cursor (gdk_display,
|
meta_core_set_screen_cursor (gdk_display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
META_CURSOR_DEFAULT);
|
META_CURSOR_DEFAULT);
|
||||||
|
|
||||||
gdk_window_set_user_data (frame->window, NULL);
|
gdk_window_set_user_data (frame->window, NULL);
|
||||||
|
|
||||||
@ -678,8 +681,10 @@ meta_frames_get_geometry (MetaFrames *frames,
|
|||||||
if (frame == NULL)
|
if (frame == NULL)
|
||||||
meta_bug ("No such frame 0x%lx\n", xwindow);
|
meta_bug ("No such frame 0x%lx\n", xwindow);
|
||||||
|
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
type = meta_core_get_frame_type (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
||||||
|
|
||||||
@ -914,8 +919,9 @@ meta_frames_apply_shapes (MetaFrames *frames,
|
|||||||
&attrs);
|
&attrs);
|
||||||
|
|
||||||
/* Copy the client's shape to the temporary shape_window */
|
/* Copy the client's shape to the temporary shape_window */
|
||||||
client_window = meta_core_get_client_xwindow (gdk_display,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
frame->xwindow);
|
META_CORE_GET_CLIENT_XWINDOW, &client_window,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
XShapeCombineShape (gdk_display, shape_window, ShapeBounding,
|
XShapeCombineShape (gdk_display, shape_window, ShapeBounding,
|
||||||
fgeom.left_width,
|
fgeom.left_width,
|
||||||
@ -972,11 +978,11 @@ meta_frames_apply_shapes (MetaFrames *frames,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_frames_move_resize_frame (MetaFrames *frames,
|
meta_frames_move_resize_frame (MetaFrames *frames,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
MetaUIFrame *frame = meta_frames_lookup_window (frames, xwindow);
|
MetaUIFrame *frame = meta_frames_lookup_window (frames, xwindow);
|
||||||
int old_x, old_y, old_width, old_height;
|
int old_x, old_y, old_width, old_height;
|
||||||
@ -1145,7 +1151,7 @@ show_tip_now (MetaFrames *frames)
|
|||||||
screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames)));
|
screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames)));
|
||||||
|
|
||||||
meta_fixed_tip_show (gdk_display,
|
meta_fixed_tip_show (gdk_display,
|
||||||
screen_number,
|
screen_number,
|
||||||
rect->x + dx,
|
rect->x + dx,
|
||||||
rect->y + rect->height + 2 + dy,
|
rect->y + rect->height + 2 + dy,
|
||||||
tiptext);
|
tiptext);
|
||||||
@ -1213,7 +1219,9 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
{
|
{
|
||||||
case META_ACTION_TITLEBAR_TOGGLE_SHADE:
|
case META_ACTION_TITLEBAR_TOGGLE_SHADE:
|
||||||
{
|
{
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
if (flags & META_FRAME_ALLOWS_SHADE)
|
if (flags & META_FRAME_ALLOWS_SHADE)
|
||||||
{
|
{
|
||||||
@ -1231,7 +1239,9 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
|
|
||||||
case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE:
|
case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE:
|
||||||
{
|
{
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
||||||
{
|
{
|
||||||
@ -1242,7 +1252,9 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
|
|
||||||
case META_ACTION_TITLEBAR_MINIMIZE:
|
case META_ACTION_TITLEBAR_MINIMIZE:
|
||||||
{
|
{
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
if (flags & META_FRAME_ALLOWS_MINIMIZE)
|
if (flags & META_FRAME_ALLOWS_MINIMIZE)
|
||||||
{
|
{
|
||||||
@ -1440,9 +1452,9 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
dx = event->x_root - event->x;
|
dx = event->x_root - event->x;
|
||||||
dy = event->y_root - event->y;
|
dy = event->y_root - event->y;
|
||||||
|
|
||||||
/* Align to the right end of the menu rectangle if RTL */
|
/* Align to the right end of the menu rectangle if RTL */
|
||||||
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||||
dx += rect->width;
|
dx += rect->width;
|
||||||
|
|
||||||
meta_core_show_window_menu (gdk_display,
|
meta_core_show_window_menu (gdk_display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
@ -1463,6 +1475,7 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
control == META_FRAME_CONTROL_RESIZE_W))
|
control == META_FRAME_CONTROL_RESIZE_W))
|
||||||
{
|
{
|
||||||
MetaGrabOp op;
|
MetaGrabOp op;
|
||||||
|
gboolean titlebar_is_onscreen;
|
||||||
|
|
||||||
op = META_GRAB_OP_NONE;
|
op = META_GRAB_OP_NONE;
|
||||||
|
|
||||||
@ -1497,8 +1510,11 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!meta_core_titlebar_is_onscreen (gdk_display,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
frame->xwindow))
|
META_CORE_IS_TITLEBAR_ONSCREEN, &titlebar_is_onscreen,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
|
if (!titlebar_is_onscreen)
|
||||||
meta_core_show_window_menu (gdk_display,
|
meta_core_show_window_menu (gdk_display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
event->x_root,
|
event->x_root,
|
||||||
@ -1522,7 +1538,9 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
MetaFrameFlags flags;
|
MetaFrameFlags flags;
|
||||||
|
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
if (flags & META_FRAME_ALLOWS_MOVE)
|
if (flags & META_FRAME_ALLOWS_MOVE)
|
||||||
{
|
{
|
||||||
@ -1701,8 +1719,8 @@ meta_frames_button_release_event (GtkWidget *widget,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
meta_frames_update_prelit_control (MetaFrames *frames,
|
meta_frames_update_prelit_control (MetaFrames *frames,
|
||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
MetaFrameControl control)
|
MetaFrameControl control)
|
||||||
{
|
{
|
||||||
MetaFrameControl old_control;
|
MetaFrameControl old_control;
|
||||||
MetaCursor cursor;
|
MetaCursor cursor;
|
||||||
@ -1875,7 +1893,7 @@ meta_frames_motion_notify_event (GtkWidget *widget,
|
|||||||
control = META_FRAME_CONTROL_NONE;
|
control = META_FRAME_CONTROL_NONE;
|
||||||
|
|
||||||
/* Update prelit control and cursor */
|
/* Update prelit control and cursor */
|
||||||
meta_frames_update_prelit_control (frames, frame, control);
|
meta_frames_update_prelit_control (frames, frame, control);
|
||||||
|
|
||||||
/* No tooltip while in the process of clicking */
|
/* No tooltip while in the process of clicking */
|
||||||
}
|
}
|
||||||
@ -1890,7 +1908,7 @@ meta_frames_motion_notify_event (GtkWidget *widget,
|
|||||||
control = get_control (frames, frame, x, y);
|
control = get_control (frames, frame, x, y);
|
||||||
|
|
||||||
/* Update prelit control and cursor */
|
/* Update prelit control and cursor */
|
||||||
meta_frames_update_prelit_control (frames, frame, control);
|
meta_frames_update_prelit_control (frames, frame, control);
|
||||||
|
|
||||||
queue_tip (frames);
|
queue_tip (frames);
|
||||||
}
|
}
|
||||||
@ -1930,8 +1948,8 @@ get_bg_gc (GdkWindow *window, int x_offset, int y_offset)
|
|||||||
if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
|
if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
|
||||||
{
|
{
|
||||||
return get_bg_gc (GDK_WINDOW (private->parent),
|
return get_bg_gc (GDK_WINDOW (private->parent),
|
||||||
x_offset + private->x,
|
x_offset + private->x,
|
||||||
y_offset + private->y);
|
y_offset + private->y);
|
||||||
}
|
}
|
||||||
else if (private->bg_pixmap &&
|
else if (private->bg_pixmap &&
|
||||||
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
||||||
@ -1958,13 +1976,13 @@ get_bg_gc (GdkWindow *window, int x_offset, int y_offset)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clear_backing (GdkPixmap *pixmap,
|
clear_backing (GdkPixmap *pixmap,
|
||||||
GdkWindow *window,
|
GdkWindow *window,
|
||||||
int xoffset, int yoffset)
|
int xoffset, int yoffset)
|
||||||
{
|
{
|
||||||
GdkGC *tmp_gc = get_bg_gc (window, xoffset, yoffset);
|
GdkGC *tmp_gc = get_bg_gc (window, xoffset, yoffset);
|
||||||
|
|
||||||
gdk_draw_rectangle (pixmap, tmp_gc, TRUE,
|
gdk_draw_rectangle (pixmap, tmp_gc, TRUE,
|
||||||
0, 0, -1, -1);
|
0, 0, -1, -1);
|
||||||
|
|
||||||
g_object_unref (tmp_gc);
|
g_object_unref (tmp_gc);
|
||||||
}
|
}
|
||||||
@ -1974,7 +1992,7 @@ clear_backing (GdkPixmap *pixmap,
|
|||||||
|
|
||||||
static GdkPixmap *
|
static GdkPixmap *
|
||||||
generate_pixmap (MetaFrames *frames,
|
generate_pixmap (MetaFrames *frames,
|
||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
MetaRectangle rect)
|
MetaRectangle rect)
|
||||||
{
|
{
|
||||||
GdkRectangle rectangle;
|
GdkRectangle rectangle;
|
||||||
@ -1994,7 +2012,7 @@ generate_pixmap (MetaFrames *frames,
|
|||||||
region = gdk_region_rectangle (&rectangle);
|
region = gdk_region_rectangle (&rectangle);
|
||||||
|
|
||||||
meta_frames_paint_to_drawable (frames, frame, result, region,
|
meta_frames_paint_to_drawable (frames, frame, result, region,
|
||||||
- rectangle.x, - rectangle.y);
|
-rectangle.x, -rectangle.y);
|
||||||
|
|
||||||
gdk_region_destroy (region);
|
gdk_region_destroy (region);
|
||||||
|
|
||||||
@ -2004,22 +2022,26 @@ generate_pixmap (MetaFrames *frames,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
populate_cache (MetaFrames *frames,
|
populate_cache (MetaFrames *frames,
|
||||||
MetaUIFrame *frame)
|
MetaUIFrame *frame)
|
||||||
{
|
{
|
||||||
int top, bottom, left, right;
|
int top, bottom, left, right;
|
||||||
int width, height;
|
int width, height;
|
||||||
int frame_width, frame_height, screen_width, screen_height;
|
int frame_width, frame_height, screen_width, screen_height;
|
||||||
CachedPixels *pixels;
|
CachedPixels *pixels;
|
||||||
|
MetaFrameType frame_type;
|
||||||
|
MetaFrameFlags frame_flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
meta_core_get_frame_extents (gdk_display,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
frame->xwindow,
|
META_CORE_GET_FRAME_WIDTH, &frame_width,
|
||||||
NULL, NULL,
|
META_CORE_GET_FRAME_HEIGHT, &frame_height,
|
||||||
&frame_width, &frame_height);
|
META_CORE_GET_SCREEN_WIDTH, &screen_width,
|
||||||
|
META_CORE_GET_SCREEN_HEIGHT, &screen_height,
|
||||||
meta_core_get_screen_size (gdk_display,
|
META_CORE_GET_CLIENT_WIDTH, &width,
|
||||||
frame->xwindow,
|
META_CORE_GET_CLIENT_HEIGHT, &height,
|
||||||
&screen_width, &screen_height);
|
META_CORE_GET_FRAME_TYPE, &frame_type,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &frame_flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
/* don't cache extremely large windows */
|
/* don't cache extremely large windows */
|
||||||
if (frame_width > 2 * screen_width ||
|
if (frame_width > 2 * screen_width ||
|
||||||
@ -2029,13 +2051,11 @@ populate_cache (MetaFrames *frames,
|
|||||||
}
|
}
|
||||||
|
|
||||||
meta_theme_get_frame_borders (meta_theme_get_current (),
|
meta_theme_get_frame_borders (meta_theme_get_current (),
|
||||||
meta_core_get_frame_type (gdk_display, frame->xwindow),
|
frame_type,
|
||||||
frame->text_height,
|
frame->text_height,
|
||||||
meta_core_get_frame_flags (gdk_display, frame->xwindow),
|
frame_flags,
|
||||||
&top, &bottom, &left, &right);
|
&top, &bottom, &left, &right);
|
||||||
|
|
||||||
meta_core_get_client_size (gdk_display, frame->xwindow, &width, &height);
|
|
||||||
|
|
||||||
pixels = get_cache (frames, frame);
|
pixels = get_cache (frames, frame);
|
||||||
|
|
||||||
/* Setup the rectangles for the four frame borders. First top, then
|
/* Setup the rectangles for the four frame borders. First top, then
|
||||||
@ -2088,14 +2108,14 @@ clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
|
|||||||
* is crucial to handle huge client windows,
|
* is crucial to handle huge client windows,
|
||||||
* like "xterm -geometry 1000x1000"
|
* like "xterm -geometry 1000x1000"
|
||||||
*/
|
*/
|
||||||
meta_core_get_frame_extents (gdk_display,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
frame->xwindow,
|
META_CORE_GET_FRAME_X, &frame_area.x,
|
||||||
&frame_area.x, &frame_area.y,
|
META_CORE_GET_FRAME_Y, &frame_area.y,
|
||||||
&frame_area.width, &frame_area.height);
|
META_CORE_GET_FRAME_WIDTH, &frame_area.width,
|
||||||
|
META_CORE_GET_FRAME_HEIGHT, &frame_area.height,
|
||||||
meta_core_get_screen_size (gdk_display,
|
META_CORE_GET_SCREEN_WIDTH, &screen_area.height,
|
||||||
frame->xwindow,
|
META_CORE_GET_SCREEN_HEIGHT, &screen_area.height,
|
||||||
&screen_area.width, &screen_area.height);
|
META_CORE_GET_END);
|
||||||
|
|
||||||
gdk_region_offset (region, frame_area.x, frame_area.y);
|
gdk_region_offset (region, frame_area.x, frame_area.y);
|
||||||
|
|
||||||
@ -2108,7 +2128,7 @@ clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
subtract_from_region (GdkRegion *region, GdkDrawable *drawable,
|
subtract_from_region (GdkRegion *region, GdkDrawable *drawable,
|
||||||
gint x, gint y)
|
gint x, gint y)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
GdkRegion *reg_rect;
|
GdkRegion *reg_rect;
|
||||||
@ -2199,8 +2219,8 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
GdkRegion *region,
|
GdkRegion *region,
|
||||||
int x_offset,
|
int x_offset,
|
||||||
int y_offset)
|
int y_offset)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
MetaFrameFlags flags;
|
MetaFrameFlags flags;
|
||||||
@ -2311,13 +2331,14 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
button_states[META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND] =
|
button_states[META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND] =
|
||||||
button_states[META_BUTTON_TYPE_CLOSE];
|
button_states[META_BUTTON_TYPE_CLOSE];
|
||||||
|
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
type = meta_core_get_frame_type (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
mini_icon = meta_core_get_mini_icon (gdk_display, frame->xwindow);
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
icon = meta_core_get_icon (gdk_display, frame->xwindow);
|
META_CORE_GET_MINI_ICON, &mini_icon,
|
||||||
|
META_CORE_GET_ICON, &icon,
|
||||||
meta_core_get_client_size (gdk_display, frame->xwindow,
|
META_CORE_GET_CLIENT_WIDTH, &w,
|
||||||
&w, &h);
|
META_CORE_GET_CLIENT_HEIGHT, &h,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
meta_frames_ensure_layout (frames, frame);
|
meta_frames_ensure_layout (frames, frame);
|
||||||
|
|
||||||
@ -2339,9 +2360,10 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
|||||||
type, frame->text_height, flags,
|
type, frame->text_height, flags,
|
||||||
&top, &bottom, &left, &right);
|
&top, &bottom, &left, &right);
|
||||||
|
|
||||||
meta_core_get_screen_size (gdk_display,
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
frame->xwindow,
|
META_CORE_GET_SCREEN_WIDTH, &screen_width,
|
||||||
&screen_width, &screen_height);
|
META_CORE_GET_SCREEN_HEIGHT, &screen_height,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
edges = gdk_region_copy (region);
|
edges = gdk_region_copy (region);
|
||||||
|
|
||||||
@ -2432,12 +2454,14 @@ meta_frames_set_window_background (MetaFrames *frames,
|
|||||||
MetaFrameStyle *style;
|
MetaFrameStyle *style;
|
||||||
gboolean frame_exists;
|
gboolean frame_exists;
|
||||||
|
|
||||||
frame_exists = meta_core_window_has_frame (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_WINDOW_HAS_FRAME, &frame_exists,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_FRAME_TYPE, &type,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
if (frame_exists)
|
if (frame_exists)
|
||||||
{
|
{
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
|
||||||
type = meta_core_get_frame_type (gdk_display, frame->xwindow);
|
|
||||||
style = meta_theme_get_frame_style (meta_theme_get_current (),
|
style = meta_theme_get_frame_style (meta_theme_get_current (),
|
||||||
type, flags);
|
type, flags);
|
||||||
}
|
}
|
||||||
@ -2613,7 +2637,9 @@ get_control (MetaFrames *frames,
|
|||||||
if (POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
|
if (POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
|
||||||
return META_FRAME_CONTROL_MENU;
|
return META_FRAME_CONTROL_MENU;
|
||||||
|
|
||||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
meta_core_get (gdk_display, frame->xwindow,
|
||||||
|
META_CORE_GET_FRAME_FLAGS, &flags,
|
||||||
|
META_CORE_GET_END);
|
||||||
|
|
||||||
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
|
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
|
||||||
has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
|
has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
|
||||||
@ -2783,7 +2809,7 @@ meta_frames_pop_delay_exposes (MetaFrames *frames)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
invalidate_whole_window (MetaFrames *frames,
|
invalidate_whole_window (MetaFrames *frames,
|
||||||
MetaUIFrame *frame)
|
MetaUIFrame *frame)
|
||||||
{
|
{
|
||||||
gdk_window_invalidate_rect (frame->window, NULL, FALSE);
|
gdk_window_invalidate_rect (frame->window, NULL, FALSE);
|
||||||
invalidate_cache (frames, frame);
|
invalidate_cache (frames, frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user