mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so that we know when to mark it as always on top. Added six grab ops, one to do and one to undo each of the three new titlebar buttons (shade, above, stick). Added six new button functions, similarly. (#96229) * frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X attribute, set META_FRAME_ABOVE in its flags. * frames.c (meta_frames_apply_shapes): Allow variable amounts of rounding. (#113162) * frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect, get_control): extend handling of existing buttons to the 3*2 new kinds of button. (#96229) * frames.c (meta_frames_button_press_event): translate clicks on the 3*2 new kinds of button to the new grab ops. (#96229) * frames.c (meta_frames_button_release_event): implement the various actions for the 3*2 new kinds of button. (#96229) * frames.c (meta_frames_update_prelit_control, meta_frames_motion_notify_event): extend existing motion notifications for buttons to the 3*2 new kinds of button. (#96229) * frames.c (meta_frames_set_window_background): handle specified background colours and alpha transparency. (#151261) * frames.h (MetaFrameControl): New control types for the 3*2 new kinds of button. (#96229) * iconcache.[ch] (meta_read_icons): use theme's fallback icons if a window has no icon; use metacity's fallback icons only if the theme does not provide any. (#11363) * iconcache.[ch] (meta_invalidate_default_icons (new function)): clear icon cache on windows using default icons, and update them. (#11363) * main.c (main): added \n to error message. * prefs.c (button_function_from_string): extend for 3 new button types. (#96229) * prefs.c (button_opposite_function (new function)): return a button function's inverse (shade -> unshade, etc) (#96229) * prefs.c (update_button_layout): allocate space for a button's inverse, if it has one. (#96229) * theme-parser.c (ParseState): add state for fallback icons (#11363) * theme-parser.c (ParseInfo): add format_version; remove menu_icon_* (#114305) * theme-parser.c (parse_positive_integer): add lookup for integer constants (#331356) * theme-parser.c (parse_rounding (new function)): parse window rounding amount (#113162) * theme-parser.c (parse_alpha): don't set error if the number can't be parsed since it'll already be set; change tolerance in comparison from 1e6 to 1e-6 * theme-parser.c (parse_color (new function)): parse colour, including possible constant lookup. * theme-parser.c (parse_toplevel_element): allow defining of various new kinds of constant; allow hide_buttons (#121639) and more detailed rounding attributes on <frame_geometry> (#113162); allow background and alpha attributes on <frame_style>; (#151261) remove support for <menu_icon> except as stub; (#114305) add support for loading stock images (#113465); add support for <fallback>. (#11363)) * theme-parser.c (parse_draw_op_element): add from and to attribute for arcs. (#121603) * theme-parser.c (parse_style_element): add check for theme version supporting a button function. (#96229) * theme-parser.c (parse_style_set_element): add ability for shaded windows to be resizable (#114304) * theme-parser.c (meta_theme_load): add theme versioning routine. * theme.c ( meta_frame_layout_get_borders): return rectangles for the new 3*2 kinds of button, except where they're inapplicable. (#96229) * theme.c (meta_frame_layout_calc_geometry): don't format buttons on windows with no buttons (#121639); strip the 3*2 new kinds of button correctly (#96229); allow variable amounts of rounding (#113162). * theme.c (meta_frame_style_new): set alpha to 255 by default. (#151261) * theme.c (meta_frame_style_unref): free colour spec if allocated. (#151261) * theme.c (meta_frame_style_validate): it's only an error not to include a button if that button is valid in the current theme. (#96229) * theme.c (button_rect): return rectangles for the new 3*2 kinds of button. (#96229) * theme.c (meta_frame_style_set_unref): free differently resizable shaded styles. (#114304) * theme.c (get_style): look up differently resizable styles for shaded windows. (#114304) * theme.c (free_menu_ops (removed function), get_menu_icon (removed function), meta_theme_draw_menu_icon (removed function), meta_menu_icon_type_from_string (removed function), meta_menu_icon_type_to_string (removed function), meta_theme_free, meta_theme_validate): removed menu icon code. (#114305) * theme.c (meta_theme_load_image): add size_of_theme_icons parameter. (#113465) * theme.c (meta_theme_define_color_constant (new function), meta_theme_lookup_color_constant (new function)): allow definition of colour constants. (#129747) * theme.c (meta_button_type_from_string, meta_button_type_to_string): add the 3*2 new kinds of button. (#96229) * theme.c (meta_theme_earliest_version_with_button (new function)): return the theme version each button was introduced in. (#96229) * theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and corner radiuses. (#113162) * theme.h (MetaFrameGeometry): add rectangles for the 3*2 new buttons. (#96229) * theme.h (MetaButtonType): the 3*2 new buttons. (#96229) * theme.h (MetaFrameStyle): add window_background_color and window_background_alpha so that we can specify background on a <frame_style>. (#151261) * theme.h (MetaFrameStyleSet): shaded_styles gets resize dimension. (#114304) * theme.h (MetaTheme): added format_version, color_constants hash, (#129747) fallback_icon and fallback_mini_icon, (#11363) and removed menu_icons. (#114305) * theme.h (META_THEME_ALLOWS (new macro)): return whether a theme supports a given feature. Also, several macros representing new features in v2. * ui.c (meta_ui_set_current_theme)): also invalidate default icons. (#11363) * window.[ch] (meta_window_update_icon_now)): became non-static. (#11363)
This commit is contained in:
parent
9e341dd4d8
commit
90359a5346
164
ChangeLog
164
ChangeLog
@ -1,3 +1,167 @@
|
||||
2006-10-07 Thomas Thurman <thomas@thurman.org.uk>
|
||||
|
||||
* common.h: Added "above" to the list of flags a frame can have, so
|
||||
that we know when to mark it as always on top. Added six grab ops,
|
||||
one to do and one to undo each of the three new titlebar buttons
|
||||
(shade, above, stick). Added six new button functions, similarly.
|
||||
(#96229)
|
||||
|
||||
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
|
||||
attribute, set META_FRAME_ABOVE in its flags.
|
||||
|
||||
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
|
||||
rounding. (#113162)
|
||||
|
||||
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
|
||||
get_control): extend handling of existing buttons to the
|
||||
3*2 new kinds of button. (#96229)
|
||||
|
||||
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
|
||||
new kinds of button to the new grab ops. (#96229)
|
||||
|
||||
* frames.c (meta_frames_button_release_event): implement the various
|
||||
actions for the 3*2 new kinds of button. (#96229)
|
||||
|
||||
* frames.c (meta_frames_update_prelit_control,
|
||||
meta_frames_motion_notify_event): extend existing motion
|
||||
notifications for buttons to the 3*2 new kinds of button. (#96229)
|
||||
|
||||
* frames.c (meta_frames_set_window_background): handle specified
|
||||
background colours and alpha transparency. (#151261)
|
||||
|
||||
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
|
||||
of button. (#96229)
|
||||
|
||||
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
|
||||
window has no icon; use metacity's fallback icons only if the theme
|
||||
does not provide any. (#11363)
|
||||
|
||||
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
|
||||
icon cache on windows using default icons, and update them. (#11363)
|
||||
|
||||
* main.c (main): added \n to error message.
|
||||
|
||||
* prefs.c (button_function_from_string): extend for 3 new button
|
||||
types. (#96229)
|
||||
|
||||
* prefs.c (button_opposite_function (new function)): return a button
|
||||
function's inverse (shade -> unshade, etc) (#96229)
|
||||
|
||||
* prefs.c (update_button_layout): allocate space for a button's
|
||||
inverse, if it has one. (#96229)
|
||||
|
||||
* theme-parser.c (ParseState): add state for fallback icons (#11363)
|
||||
|
||||
* theme-parser.c (ParseInfo): add format_version; remove
|
||||
menu_icon_* (#114305)
|
||||
|
||||
* theme-parser.c (parse_positive_integer): add lookup for integer
|
||||
constants (#331356)
|
||||
|
||||
* theme-parser.c (parse_rounding (new function)): parse window
|
||||
rounding amount (#113162)
|
||||
|
||||
* theme-parser.c (parse_alpha): don't set error if the number can't
|
||||
be parsed since it'll already be set; change tolerance in comparison
|
||||
from 1e6 to 1e-6
|
||||
|
||||
* theme-parser.c (parse_color (new function)): parse colour, including
|
||||
possible constant lookup.
|
||||
|
||||
* theme-parser.c (parse_toplevel_element): allow defining of various
|
||||
new kinds of constant; allow
|
||||
hide_buttons (#121639) and more detailed rounding attributes on
|
||||
<frame_geometry> (#113162); allow background and alpha attributes on
|
||||
<frame_style>; (#151261) remove support for <menu_icon> except as
|
||||
stub; (#114305) add support for loading stock images (#113465); add
|
||||
support for <fallback>. (#11363))
|
||||
|
||||
* theme-parser.c (parse_draw_op_element): add from and to attribute
|
||||
for arcs. (#121603)
|
||||
|
||||
* theme-parser.c (parse_style_element): add check for theme version
|
||||
supporting a button function. (#96229)
|
||||
|
||||
* theme-parser.c (parse_style_set_element): add ability for shaded
|
||||
windows to be resizable (#114304)
|
||||
|
||||
* theme-parser.c (meta_theme_load): add theme versioning routine.
|
||||
|
||||
* theme.c ( meta_frame_layout_get_borders): return rectangles for
|
||||
the new 3*2 kinds of button, except where they're
|
||||
inapplicable. (#96229)
|
||||
|
||||
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
|
||||
windows with no buttons (#121639); strip the 3*2 new kinds of button
|
||||
correctly (#96229); allow variable amounts of rounding (#113162).
|
||||
|
||||
* theme.c (meta_frame_style_new): set alpha to 255 by
|
||||
default. (#151261)
|
||||
|
||||
* theme.c (meta_frame_style_unref): free colour spec if
|
||||
allocated. (#151261)
|
||||
|
||||
* theme.c (meta_frame_style_validate): it's only an error not to
|
||||
include a button if that button is valid in the current
|
||||
theme. (#96229)
|
||||
|
||||
* theme.c (button_rect): return rectangles for the new 3*2 kinds
|
||||
of button. (#96229)
|
||||
|
||||
* theme.c (meta_frame_style_set_unref): free differently resizable
|
||||
shaded styles. (#114304)
|
||||
|
||||
* theme.c (get_style): look up differently resizable styles
|
||||
for shaded windows. (#114304)
|
||||
|
||||
* theme.c (free_menu_ops (removed function), get_menu_icon
|
||||
(removed function), meta_theme_draw_menu_icon (removed function),
|
||||
meta_menu_icon_type_from_string (removed function),
|
||||
meta_menu_icon_type_to_string (removed function),
|
||||
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
|
||||
|
||||
* theme.c (meta_theme_load_image): add size_of_theme_icons
|
||||
parameter. (#113465)
|
||||
|
||||
* theme.c (meta_theme_define_color_constant (new function),
|
||||
meta_theme_lookup_color_constant (new function)): allow
|
||||
definition of colour constants. (#129747)
|
||||
|
||||
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
|
||||
add the 3*2 new kinds of button. (#96229)
|
||||
|
||||
* theme.c (meta_theme_earliest_version_with_button (new function)):
|
||||
return the theme version each button was introduced in. (#96229)
|
||||
|
||||
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
|
||||
corner radiuses. (#113162)
|
||||
|
||||
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
|
||||
buttons. (#96229)
|
||||
|
||||
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
|
||||
|
||||
* theme.h (MetaFrameStyle): add window_background_color and
|
||||
window_background_alpha so that we can specify background on a
|
||||
<frame_style>. (#151261)
|
||||
|
||||
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
|
||||
dimension. (#114304)
|
||||
|
||||
* theme.h (MetaTheme): added format_version, color_constants
|
||||
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
|
||||
and removed menu_icons. (#114305)
|
||||
|
||||
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
|
||||
supports a given feature. Also, several macros representing
|
||||
new features in v2.
|
||||
|
||||
* ui.c (meta_ui_set_current_theme)): also invalidate default
|
||||
icons. (#11363)
|
||||
|
||||
* window.[ch] (meta_window_update_icon_now)): became
|
||||
non-static. (#11363)
|
||||
|
||||
2006-10-06 Elijah Newren <newren gmail com>
|
||||
|
||||
* src/metacity-dialog.c (kill_window_question): Be nice to
|
||||
|
17
src/common.h
17
src/common.h
@ -46,7 +46,8 @@ typedef enum
|
||||
META_FRAME_ALLOWS_SHADE = 1 << 10,
|
||||
META_FRAME_ALLOWS_MOVE = 1 << 11,
|
||||
META_FRAME_FULLSCREEN = 1 << 12,
|
||||
META_FRAME_IS_FLASHING = 1 << 13
|
||||
META_FRAME_IS_FLASHING = 1 << 13,
|
||||
META_FRAME_ABOVE = 1 << 14
|
||||
} MetaFrameFlags;
|
||||
|
||||
typedef enum
|
||||
@ -131,7 +132,13 @@ typedef enum
|
||||
META_GRAB_OP_CLICKING_MAXIMIZE,
|
||||
META_GRAB_OP_CLICKING_UNMAXIMIZE,
|
||||
META_GRAB_OP_CLICKING_DELETE,
|
||||
META_GRAB_OP_CLICKING_MENU
|
||||
META_GRAB_OP_CLICKING_MENU,
|
||||
META_GRAB_OP_CLICKING_SHADE,
|
||||
META_GRAB_OP_CLICKING_UNSHADE,
|
||||
META_GRAB_OP_CLICKING_ABOVE,
|
||||
META_GRAB_OP_CLICKING_UNABOVE,
|
||||
META_GRAB_OP_CLICKING_STICK,
|
||||
META_GRAB_OP_CLICKING_UNSTICK
|
||||
} MetaGrabOp;
|
||||
|
||||
typedef enum
|
||||
@ -226,6 +233,12 @@ typedef enum
|
||||
META_BUTTON_FUNCTION_MINIMIZE,
|
||||
META_BUTTON_FUNCTION_MAXIMIZE,
|
||||
META_BUTTON_FUNCTION_CLOSE,
|
||||
META_BUTTON_FUNCTION_SHADE,
|
||||
META_BUTTON_FUNCTION_ABOVE,
|
||||
META_BUTTON_FUNCTION_STICK,
|
||||
META_BUTTON_FUNCTION_UNSHADE,
|
||||
META_BUTTON_FUNCTION_UNABOVE,
|
||||
META_BUTTON_FUNCTION_UNSTICK,
|
||||
META_BUTTON_FUNCTION_LAST
|
||||
} MetaButtonFunction;
|
||||
|
||||
|
70
src/core.c
70
src/core.c
@ -29,6 +29,17 @@
|
||||
#include "workspace.h"
|
||||
#include "prefs.h"
|
||||
|
||||
/* Looks up the MetaWindow representing the frame of the given X window.
|
||||
* Used as a helper function by a bunch of the functions below.
|
||||
*
|
||||
* FIXME: The functions that use this function throw the result away
|
||||
* after use. Many of these functions tend to be called in small groups,
|
||||
* which results in get_window() getting called several times in succession
|
||||
* with the same parameters. We should profile to see whether this wastes
|
||||
* much time, and if it does we should look into a generalised
|
||||
* meta_core_get_window_info() which takes a bunch of pointers to variables
|
||||
* to put its results in, and only fills in the non-null ones.
|
||||
*/
|
||||
static MetaWindow *
|
||||
get_window (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
@ -62,6 +73,19 @@ meta_core_get_client_size (Display *xdisplay,
|
||||
*height = window->rect.height;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_core_window_has_frame (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaWindow *window;
|
||||
|
||||
display = meta_display_for_x_display (xdisplay);
|
||||
window = meta_display_lookup_x_window (display, frame_xwindow);
|
||||
|
||||
return window != NULL && window->frame != NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_core_titlebar_is_onscreen (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
@ -368,6 +392,24 @@ meta_core_unstick (Display *xdisplay,
|
||||
meta_window_unstick (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_make_above (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
meta_window_make_above (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_unmake_above (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
meta_window_unmake_above (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_stick (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
@ -712,3 +754,31 @@ meta_core_increment_event_serial (Display *xdisplay)
|
||||
meta_display_increment_event_serial (display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_invalidate_default_icons (void)
|
||||
{
|
||||
GSList *displays, *windows;
|
||||
|
||||
for (displays = meta_displays_list ();
|
||||
displays != NULL;
|
||||
displays = displays->next)
|
||||
{
|
||||
|
||||
for (windows = meta_display_list_windows (displays->data);
|
||||
windows != NULL;
|
||||
windows = windows->next)
|
||||
{
|
||||
|
||||
MetaWindow *window = (MetaWindow*)windows->data;
|
||||
|
||||
if (window->icon_cache.origin == USING_FALLBACK_ICON)
|
||||
{
|
||||
meta_icon_cache_free (&(window->icon_cache));
|
||||
meta_window_update_icon_now (window);
|
||||
}
|
||||
}
|
||||
|
||||
g_slist_free (windows);
|
||||
}
|
||||
}
|
||||
|
||||
|
10
src/core.h
10
src/core.h
@ -37,6 +37,10 @@ void meta_core_get_client_size (Display *xdisplay,
|
||||
gboolean meta_core_titlebar_is_onscreen (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
|
||||
gboolean meta_core_window_has_frame (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
|
||||
|
||||
Window meta_core_get_client_xwindow (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
|
||||
@ -106,6 +110,10 @@ void meta_core_unstick (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_stick (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_unmake_above (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_make_above (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_change_workspace (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
int new_workspace);
|
||||
@ -175,6 +183,8 @@ void meta_core_increment_event_serial (Display *display);
|
||||
|
||||
int meta_ui_get_last_event_serial (Display *xdisplay);
|
||||
|
||||
void meta_invalidate_default_icons (void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -279,6 +279,9 @@ meta_frame_get_flags (MetaFrame *frame)
|
||||
if (frame->is_flashing)
|
||||
flags |= META_FRAME_IS_FLASHING;
|
||||
|
||||
if (frame->window->wm_state_above)
|
||||
flags |= META_FRAME_ABOVE;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
407
src/frames.c
407
src/frames.c
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include "boxes.h"
|
||||
#include "frames.h"
|
||||
#include "util.h"
|
||||
@ -757,10 +758,10 @@ meta_frames_apply_shapes (MetaFrames *frames,
|
||||
|
||||
meta_frames_calc_geometry (frames, frame, &fgeom);
|
||||
|
||||
if (!(fgeom.top_left_corner_rounded ||
|
||||
fgeom.top_right_corner_rounded ||
|
||||
fgeom.bottom_left_corner_rounded ||
|
||||
fgeom.bottom_right_corner_rounded ||
|
||||
if (!(fgeom.top_left_corner_rounded_radius != 0 ||
|
||||
fgeom.top_right_corner_rounded_radius != 0 ||
|
||||
fgeom.bottom_left_corner_rounded_radius != 0 ||
|
||||
fgeom.bottom_right_corner_rounded_radius != 0 ||
|
||||
window_has_shape))
|
||||
{
|
||||
if (frame->shape_applied)
|
||||
@ -785,102 +786,72 @@ meta_frames_apply_shapes (MetaFrames *frames,
|
||||
|
||||
corners_xregion = XCreateRegion ();
|
||||
|
||||
if (fgeom.top_left_corner_rounded)
|
||||
if (fgeom.top_left_corner_rounded_radius != 0)
|
||||
{
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = 5;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
const int radius = fgeom.top_left_corner_rounded_radius;
|
||||
int i;
|
||||
|
||||
xrect.y = 1;
|
||||
xrect.width = 3;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = 2;
|
||||
xrect.width = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = 3;
|
||||
xrect.width = 1;
|
||||
xrect.height = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
for (i=0; i<radius; i++)
|
||||
{
|
||||
const int width = 1 + (radius - floor(sqrt(radius*radius - (radius-i)*(radius-i))));
|
||||
xrect.x = 0;
|
||||
xrect.y = i;
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
}
|
||||
}
|
||||
|
||||
if (fgeom.top_right_corner_rounded)
|
||||
if (fgeom.top_right_corner_rounded_radius != 0)
|
||||
{
|
||||
xrect.x = new_window_width - 5;
|
||||
xrect.y = 0;
|
||||
xrect.width = 5;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
const int radius = fgeom.top_right_corner_rounded_radius;
|
||||
int i;
|
||||
|
||||
xrect.y = 1;
|
||||
xrect.x = new_window_width - 3;
|
||||
xrect.width = 3;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = 2;
|
||||
xrect.x = new_window_width - 2;
|
||||
xrect.width = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = 3;
|
||||
xrect.x = new_window_width - 1;
|
||||
xrect.width = 1;
|
||||
xrect.height = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
for (i=0; i<radius; i++)
|
||||
{
|
||||
const int width = 1 + (radius - floor(sqrt(radius*radius - (radius-i)*(radius-i))));
|
||||
xrect.x = new_window_width - width;
|
||||
xrect.y = i;
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
}
|
||||
}
|
||||
|
||||
if (fgeom.bottom_left_corner_rounded)
|
||||
if (fgeom.bottom_left_corner_rounded_radius != 0)
|
||||
{
|
||||
xrect.x = 0;
|
||||
xrect.y = new_window_height - 1;
|
||||
xrect.width = 5;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = new_window_height - 2;
|
||||
xrect.width = 3;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = new_window_height - 3;
|
||||
xrect.width = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
const int radius = fgeom.bottom_left_corner_rounded_radius;
|
||||
int i;
|
||||
|
||||
xrect.y = new_window_height - 5;
|
||||
xrect.width = 1;
|
||||
xrect.height = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
for (i=0; i<radius; i++)
|
||||
{
|
||||
const int width = 1 + (radius - floor(sqrt(radius*radius - (radius-i)*(radius-i))));
|
||||
xrect.x = 0;
|
||||
xrect.y = new_window_height - i;
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
}
|
||||
}
|
||||
|
||||
if (fgeom.bottom_right_corner_rounded)
|
||||
if (fgeom.bottom_right_corner_rounded_radius != 0)
|
||||
{
|
||||
xrect.x = new_window_width - 5;
|
||||
xrect.y = new_window_height - 1;
|
||||
xrect.width = 5;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = new_window_height - 2;
|
||||
xrect.x = new_window_width - 3;
|
||||
xrect.width = 3;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
|
||||
xrect.y = new_window_height - 3;
|
||||
xrect.x = new_window_width - 2;
|
||||
xrect.width = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
const int radius = fgeom.bottom_right_corner_rounded_radius;
|
||||
int i;
|
||||
|
||||
xrect.y = new_window_height - 5;
|
||||
xrect.x = new_window_width - 1;
|
||||
xrect.width = 1;
|
||||
xrect.height = 2;
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
for (i=0; i<radius; i++)
|
||||
{
|
||||
const int width = 1 + (radius - floor(sqrt(radius*radius - (radius-i)*(radius-i))));
|
||||
xrect.x = new_window_width - width;
|
||||
xrect.y = new_window_height - i;
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
|
||||
}
|
||||
}
|
||||
|
||||
window_xregion = XCreateRegion ();
|
||||
@ -1102,6 +1073,24 @@ show_tip_now (MetaFrames *frames)
|
||||
case META_FRAME_CONTROL_UNMAXIMIZE:
|
||||
tiptext = _("Unmaximize Window");
|
||||
break;
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
tiptext = _("Roll Up Window");
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
tiptext = _("Unroll Window");
|
||||
break;
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
tiptext = _("Keep Window On Top");
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
tiptext = _("Remove Window From Top");
|
||||
break;
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
tiptext = _("Always On Visible Workspace");
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
tiptext = _("Put Window On Only One Workspace");
|
||||
break;
|
||||
case META_FRAME_CONTROL_RESIZE_SE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_RESIZE_S:
|
||||
@ -1308,6 +1297,12 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
control == META_FRAME_CONTROL_UNMAXIMIZE ||
|
||||
control == META_FRAME_CONTROL_MINIMIZE ||
|
||||
control == META_FRAME_CONTROL_DELETE ||
|
||||
control == META_FRAME_CONTROL_SHADE ||
|
||||
control == META_FRAME_CONTROL_UNSHADE ||
|
||||
control == META_FRAME_CONTROL_ABOVE ||
|
||||
control == META_FRAME_CONTROL_UNABOVE ||
|
||||
control == META_FRAME_CONTROL_STICK ||
|
||||
control == META_FRAME_CONTROL_UNSTICK ||
|
||||
control == META_FRAME_CONTROL_MENU))
|
||||
{
|
||||
MetaGrabOp op = META_GRAB_OP_NONE;
|
||||
@ -1329,6 +1324,24 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
case META_FRAME_CONTROL_MENU:
|
||||
op = META_GRAB_OP_CLICKING_MENU;
|
||||
break;
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
op = META_GRAB_OP_CLICKING_SHADE;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
op = META_GRAB_OP_CLICKING_UNSHADE;
|
||||
break;
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
op = META_GRAB_OP_CLICKING_ABOVE;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
op = META_GRAB_OP_CLICKING_UNABOVE;
|
||||
break;
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
op = META_GRAB_OP_CLICKING_STICK;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
op = META_GRAB_OP_CLICKING_UNSTICK;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
@ -1567,6 +1580,48 @@ meta_frames_button_release_event (GtkWidget *widget,
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_SHADE:
|
||||
if (control == META_FRAME_CONTROL_SHADE)
|
||||
meta_core_shade (gdk_display, frame->xwindow, event->time);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_UNSHADE:
|
||||
if (control == META_FRAME_CONTROL_UNSHADE)
|
||||
meta_core_unshade (gdk_display, frame->xwindow, event->time);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_ABOVE:
|
||||
if (control == META_FRAME_CONTROL_ABOVE)
|
||||
meta_core_make_above (gdk_display, frame->xwindow);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_UNABOVE:
|
||||
if (control == META_FRAME_CONTROL_UNABOVE)
|
||||
meta_core_unmake_above (gdk_display, frame->xwindow);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_STICK:
|
||||
if (control == META_FRAME_CONTROL_STICK)
|
||||
meta_core_stick (gdk_display, frame->xwindow);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
case META_GRAB_OP_CLICKING_UNSTICK:
|
||||
if (control == META_FRAME_CONTROL_UNSTICK)
|
||||
meta_core_unstick (gdk_display, frame->xwindow);
|
||||
|
||||
meta_core_end_grab_op (gdk_display, event->time);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1590,6 +1645,7 @@ meta_frames_update_prelit_control (MetaFrames *frames,
|
||||
MetaFrameControl old_control;
|
||||
MetaCursor cursor;
|
||||
|
||||
|
||||
meta_verbose ("Updating prelit control from %u to %u\n",
|
||||
frame->prelit_control, control);
|
||||
|
||||
@ -1613,6 +1669,18 @@ meta_frames_update_prelit_control (MetaFrames *frames,
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNMAXIMIZE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
break;
|
||||
case META_FRAME_CONTROL_RESIZE_SE:
|
||||
cursor = META_CURSOR_SE_RESIZE;
|
||||
break;
|
||||
@ -1650,6 +1718,12 @@ meta_frames_update_prelit_control (MetaFrames *frames,
|
||||
case META_FRAME_CONTROL_MINIMIZE:
|
||||
case META_FRAME_CONTROL_MAXIMIZE:
|
||||
case META_FRAME_CONTROL_DELETE:
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
case META_FRAME_CONTROL_UNMAXIMIZE:
|
||||
/* leave control set */
|
||||
break;
|
||||
@ -1698,6 +1772,12 @@ meta_frames_motion_notify_event (GtkWidget *widget,
|
||||
case META_GRAB_OP_CLICKING_MINIMIZE:
|
||||
case META_GRAB_OP_CLICKING_MAXIMIZE:
|
||||
case META_GRAB_OP_CLICKING_UNMAXIMIZE:
|
||||
case META_GRAB_OP_CLICKING_SHADE:
|
||||
case META_GRAB_OP_CLICKING_UNSHADE:
|
||||
case META_GRAB_OP_CLICKING_ABOVE:
|
||||
case META_GRAB_OP_CLICKING_UNABOVE:
|
||||
case META_GRAB_OP_CLICKING_STICK:
|
||||
case META_GRAB_OP_CLICKING_UNSTICK:
|
||||
{
|
||||
MetaFrameControl control;
|
||||
int x, y;
|
||||
@ -1716,8 +1796,20 @@ meta_frames_motion_notify_event (GtkWidget *widget,
|
||||
grab_op == META_GRAB_OP_CLICKING_MINIMIZE) ||
|
||||
(control == META_FRAME_CONTROL_MAXIMIZE &&
|
||||
(grab_op == META_GRAB_OP_CLICKING_MAXIMIZE ||
|
||||
grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE))))
|
||||
control = META_FRAME_CONTROL_NONE;
|
||||
grab_op == META_GRAB_OP_CLICKING_UNMAXIMIZE)) ||
|
||||
(control == META_FRAME_CONTROL_SHADE &&
|
||||
grab_op == META_GRAB_OP_CLICKING_SHADE) ||
|
||||
(control == META_FRAME_CONTROL_UNSHADE &&
|
||||
grab_op == META_GRAB_OP_CLICKING_UNSHADE) ||
|
||||
(control == META_FRAME_CONTROL_ABOVE &&
|
||||
grab_op == META_GRAB_OP_CLICKING_ABOVE) ||
|
||||
(control == META_FRAME_CONTROL_UNABOVE &&
|
||||
grab_op == META_GRAB_OP_CLICKING_UNABOVE) ||
|
||||
(control == META_FRAME_CONTROL_STICK &&
|
||||
grab_op == META_GRAB_OP_CLICKING_STICK) ||
|
||||
(control == META_FRAME_CONTROL_UNSTICK &&
|
||||
grab_op == META_GRAB_OP_CLICKING_UNSTICK)))
|
||||
control = META_FRAME_CONTROL_NONE;
|
||||
|
||||
/* Update prelit control and cursor */
|
||||
meta_frames_update_prelit_control (frames, frame, control);
|
||||
@ -2097,6 +2189,42 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_MAXIMIZE] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_SHADE)
|
||||
button_states[META_BUTTON_TYPE_SHADE] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_SHADE] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_UNSHADE)
|
||||
button_states[META_BUTTON_TYPE_UNSHADE] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_UNSHADE] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_ABOVE)
|
||||
button_states[META_BUTTON_TYPE_ABOVE] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_ABOVE] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_UNABOVE)
|
||||
button_states[META_BUTTON_TYPE_UNABOVE] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_UNABOVE] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_STICK)
|
||||
button_states[META_BUTTON_TYPE_STICK] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_STICK] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_UNSTICK)
|
||||
button_states[META_BUTTON_TYPE_UNSTICK] = META_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
button_states[META_BUTTON_TYPE_UNSTICK] = META_BUTTON_STATE_PRELIGHT;
|
||||
break;
|
||||
case META_FRAME_CONTROL_DELETE:
|
||||
if (grab_op == META_GRAB_OP_CLICKING_DELETE)
|
||||
button_states[META_BUTTON_TYPE_CLOSE] = META_BUTTON_STATE_PRESSED;
|
||||
@ -2182,17 +2310,52 @@ static void
|
||||
meta_frames_set_window_background (MetaFrames *frames,
|
||||
MetaUIFrame *frame)
|
||||
{
|
||||
gtk_style_set_background (GTK_WIDGET (frames)->style,
|
||||
frame->window, GTK_STATE_NORMAL);
|
||||
MetaFrameFlags flags;
|
||||
MetaFrameType type;
|
||||
MetaFrameStyle *style;
|
||||
gboolean frame_exists;
|
||||
|
||||
#if 0
|
||||
/* This is what we want for transparent background */
|
||||
{
|
||||
col.pixel = 0;
|
||||
gdk_window_set_background (window, &col);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
frame_exists = meta_core_window_has_frame (gdk_display, frame->xwindow);
|
||||
|
||||
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 (),
|
||||
type, flags);
|
||||
}
|
||||
|
||||
if (frame_exists && style->window_background_color != NULL)
|
||||
{
|
||||
GdkColor color;
|
||||
GdkVisual *visual;
|
||||
|
||||
meta_color_spec_render (style->window_background_color,
|
||||
GTK_WIDGET (frames),
|
||||
&color);
|
||||
|
||||
/* Fill in color.pixel */
|
||||
|
||||
gdk_rgb_find_color (gtk_widget_get_colormap (GTK_WIDGET (frames)),
|
||||
&color);
|
||||
|
||||
/* Set A in ARGB to window_background_alpha, if we have ARGB */
|
||||
|
||||
visual = gtk_widget_get_visual (GTK_WIDGET (frames));
|
||||
if (visual->depth == 32) /* we have ARGB */
|
||||
{
|
||||
color.pixel = (color.pixel & 0xffffff) &
|
||||
style->window_background_alpha << 24;
|
||||
}
|
||||
|
||||
gdk_window_set_background (frame->window, &color);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_style_set_background (GTK_WIDGET (frames)->style,
|
||||
frame->window, GTK_STATE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_frames_enter_notify_event (GtkWidget *widget,
|
||||
@ -2259,6 +2422,24 @@ control_rect (MetaFrameControl control,
|
||||
case META_FRAME_CONTROL_UNMAXIMIZE:
|
||||
rect = &fgeom->max_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_SHADE:
|
||||
rect = &fgeom->shade_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSHADE:
|
||||
rect = &fgeom->unshade_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_ABOVE:
|
||||
rect = &fgeom->above_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNABOVE:
|
||||
rect = &fgeom->unabove_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_STICK:
|
||||
rect = &fgeom->stick_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_UNSTICK:
|
||||
rect = &fgeom->unstick_rect.visible;
|
||||
break;
|
||||
case META_FRAME_CONTROL_RESIZE_SE:
|
||||
break;
|
||||
case META_FRAME_CONTROL_RESIZE_S:
|
||||
@ -2336,6 +2517,36 @@ get_control (MetaFrames *frames,
|
||||
return META_FRAME_CONTROL_MAXIMIZE;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.shade_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_SHADE;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.unshade_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_UNSHADE;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.above_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_ABOVE;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.unabove_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_UNABOVE;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.stick_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_STICK;
|
||||
}
|
||||
|
||||
if (POINT_IN_RECT (x, y, fgeom.unstick_rect.clickable))
|
||||
{
|
||||
return META_FRAME_CONTROL_UNSTICK;
|
||||
}
|
||||
|
||||
/* South resize always has priority over north resize,
|
||||
* in case of overlap.
|
||||
*/
|
||||
|
@ -38,6 +38,12 @@ typedef enum
|
||||
META_FRAME_CONTROL_MINIMIZE,
|
||||
META_FRAME_CONTROL_MAXIMIZE,
|
||||
META_FRAME_CONTROL_UNMAXIMIZE,
|
||||
META_FRAME_CONTROL_SHADE,
|
||||
META_FRAME_CONTROL_UNSHADE,
|
||||
META_FRAME_CONTROL_ABOVE,
|
||||
META_FRAME_CONTROL_UNABOVE,
|
||||
META_FRAME_CONTROL_STICK,
|
||||
META_FRAME_CONTROL_UNSTICK,
|
||||
META_FRAME_CONTROL_RESIZE_SE,
|
||||
META_FRAME_CONTROL_RESIZE_S,
|
||||
META_FRAME_CONTROL_RESIZE_SW,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "iconcache.h"
|
||||
#include "ui.h"
|
||||
#include "errors.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@ -499,19 +500,6 @@ get_kwm_win_icon (MetaDisplay *display,
|
||||
return;
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* These MUST be in ascending order of preference;
|
||||
* i.e. if we get _NET_WM_ICON and already have
|
||||
* WM_HINTS, we prefer _NET_WM_ICON
|
||||
*/
|
||||
USING_NO_ICON,
|
||||
USING_FALLBACK_ICON,
|
||||
USING_KWM_WIN_ICON,
|
||||
USING_WM_HINTS,
|
||||
USING_NET_WM_ICON
|
||||
} IconOrigin;
|
||||
|
||||
void
|
||||
meta_icon_cache_init (MetaIconCache *icon_cache)
|
||||
{
|
||||
@ -830,13 +818,23 @@ meta_read_icons (MetaScreen *screen,
|
||||
if (icon_cache->want_fallback &&
|
||||
icon_cache->origin < USING_FALLBACK_ICON)
|
||||
{
|
||||
get_fallback_icons (screen,
|
||||
iconp,
|
||||
ideal_width,
|
||||
ideal_height,
|
||||
mini_iconp,
|
||||
ideal_mini_width,
|
||||
ideal_mini_height);
|
||||
MetaTheme *theme = meta_theme_get_current ();
|
||||
|
||||
if (theme->fallback_icon == NULL || theme->fallback_mini_icon == NULL)
|
||||
{
|
||||
get_fallback_icons (screen,
|
||||
iconp,
|
||||
ideal_width,
|
||||
ideal_height,
|
||||
mini_iconp,
|
||||
ideal_mini_width,
|
||||
ideal_mini_height);
|
||||
}
|
||||
|
||||
if (theme->fallback_icon != NULL)
|
||||
*iconp = theme->fallback_icon;
|
||||
if (theme->fallback_mini_icon != NULL)
|
||||
*mini_iconp = theme->fallback_mini_icon;
|
||||
|
||||
replace_cache (icon_cache, USING_FALLBACK_ICON,
|
||||
*iconp, *mini_iconp);
|
||||
|
@ -28,6 +28,19 @@
|
||||
|
||||
typedef struct _MetaIconCache MetaIconCache;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* These MUST be in ascending order of preference;
|
||||
* i.e. if we get _NET_WM_ICON and already have
|
||||
* WM_HINTS, we prefer _NET_WM_ICON
|
||||
*/
|
||||
USING_NO_ICON,
|
||||
USING_FALLBACK_ICON,
|
||||
USING_KWM_WIN_ICON,
|
||||
USING_WM_HINTS,
|
||||
USING_NET_WM_ICON
|
||||
} IconOrigin;
|
||||
|
||||
struct _MetaIconCache
|
||||
{
|
||||
int origin;
|
||||
|
@ -365,7 +365,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (!meta_ui_have_a_theme ())
|
||||
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes."),
|
||||
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes.\n"),
|
||||
METACITY_DATADIR"/themes");
|
||||
|
||||
/* Connect to SM as late as possible - but before managing display,
|
||||
|
46
src/prefs.c
46
src/prefs.c
@ -1381,10 +1381,42 @@ button_function_from_string (const char *str)
|
||||
return META_BUTTON_FUNCTION_MAXIMIZE;
|
||||
else if (strcmp (str, "close") == 0)
|
||||
return META_BUTTON_FUNCTION_CLOSE;
|
||||
else
|
||||
else if (strcmp (str, "shade") == 0)
|
||||
return META_BUTTON_FUNCTION_SHADE;
|
||||
else if (strcmp (str, "above") == 0)
|
||||
return META_BUTTON_FUNCTION_ABOVE;
|
||||
else if (strcmp (str, "stick") == 0)
|
||||
return META_BUTTON_FUNCTION_STICK;
|
||||
else
|
||||
/* don't know; give up */
|
||||
return META_BUTTON_FUNCTION_LAST;
|
||||
}
|
||||
|
||||
static MetaButtonFunction
|
||||
button_opposite_function (MetaButtonFunction ofwhat)
|
||||
{
|
||||
switch (ofwhat)
|
||||
{
|
||||
case META_BUTTON_FUNCTION_SHADE:
|
||||
return META_BUTTON_FUNCTION_UNSHADE;
|
||||
case META_BUTTON_FUNCTION_UNSHADE:
|
||||
return META_BUTTON_FUNCTION_SHADE;
|
||||
|
||||
case META_BUTTON_FUNCTION_ABOVE:
|
||||
return META_BUTTON_FUNCTION_UNABOVE;
|
||||
case META_BUTTON_FUNCTION_UNABOVE:
|
||||
return META_BUTTON_FUNCTION_ABOVE;
|
||||
|
||||
case META_BUTTON_FUNCTION_STICK:
|
||||
return META_BUTTON_FUNCTION_UNSTICK;
|
||||
case META_BUTTON_FUNCTION_UNSTICK:
|
||||
return META_BUTTON_FUNCTION_STICK;
|
||||
|
||||
default:
|
||||
return META_BUTTON_FUNCTION_LAST;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_button_layout (const char *value)
|
||||
{
|
||||
@ -1435,6 +1467,11 @@ update_button_layout (const char *value)
|
||||
new_layout.left_buttons[i] = f;
|
||||
used[f] = TRUE;
|
||||
++i;
|
||||
|
||||
f = button_opposite_function (f);
|
||||
|
||||
if (f != META_BUTTON_FUNCTION_LAST)
|
||||
new_layout.left_buttons[i++] = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1473,7 +1510,12 @@ update_button_layout (const char *value)
|
||||
new_layout.right_buttons[i] = f;
|
||||
used[f] = TRUE;
|
||||
++i;
|
||||
}
|
||||
|
||||
f = button_opposite_function (f);
|
||||
|
||||
if (f != META_BUTTON_FUNCTION_LAST)
|
||||
new_layout.right_buttons[i++] = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
||||
|
File diff suppressed because it is too large
Load Diff
501
src/theme.c
501
src/theme.c
@ -27,6 +27,8 @@
|
||||
#include "util.h"
|
||||
#include "gradient.h"
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtkimage.h>
|
||||
#include <gtk/gtkicontheme.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@ -394,8 +396,51 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
|
||||
static MetaButtonSpace*
|
||||
rect_for_function (MetaFrameGeometry *fgeom,
|
||||
MetaFrameFlags flags,
|
||||
MetaButtonFunction function)
|
||||
MetaButtonFunction function,
|
||||
MetaTheme *theme)
|
||||
{
|
||||
|
||||
/* Firstly, check version-specific things. */
|
||||
|
||||
if (META_THEME_ALLOWS(theme, META_THEME_SHADE_STICK_ABOVE_BUTTONS))
|
||||
{
|
||||
switch (function)
|
||||
{
|
||||
case META_BUTTON_FUNCTION_SHADE:
|
||||
if ((flags & META_FRAME_ALLOWS_SHADE) && !(flags & META_FRAME_SHADED))
|
||||
return &fgeom->shade_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_ABOVE:
|
||||
if (!(flags & META_FRAME_ABOVE))
|
||||
return &fgeom->above_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_STICK:
|
||||
if (!(flags & META_FRAME_STUCK))
|
||||
return &fgeom->stick_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_UNSHADE:
|
||||
if ((flags & META_FRAME_ALLOWS_SHADE) && (flags & META_FRAME_SHADED))
|
||||
return &fgeom->unshade_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_UNABOVE:
|
||||
if (flags & META_FRAME_ABOVE)
|
||||
return &fgeom->unabove_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_UNSTICK:
|
||||
if (flags & META_FRAME_STUCK)
|
||||
return &fgeom->unstick_rect;
|
||||
default:
|
||||
/* just go on to the next switch block */;
|
||||
}
|
||||
}
|
||||
|
||||
/* now consider the buttons which exist in all versions */
|
||||
|
||||
switch (function)
|
||||
{
|
||||
case META_BUTTON_FUNCTION_MENU:
|
||||
@ -418,6 +463,19 @@ rect_for_function (MetaFrameGeometry *fgeom,
|
||||
return &fgeom->close_rect;
|
||||
else
|
||||
return NULL;
|
||||
case META_BUTTON_FUNCTION_STICK:
|
||||
case META_BUTTON_FUNCTION_SHADE:
|
||||
case META_BUTTON_FUNCTION_ABOVE:
|
||||
case META_BUTTON_FUNCTION_UNSTICK:
|
||||
case META_BUTTON_FUNCTION_UNSHADE:
|
||||
case META_BUTTON_FUNCTION_UNABOVE:
|
||||
/* we are being asked for a >v1 button which hasn't been handled yet,
|
||||
* so obviously we're not in a theme which supports that version.
|
||||
* therefore, we don't show the button. return NULL and all will
|
||||
* be well.
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
case META_BUTTON_FUNCTION_LAST:
|
||||
return NULL;
|
||||
}
|
||||
@ -468,7 +526,8 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
||||
int client_width,
|
||||
int client_height,
|
||||
const MetaButtonLayout *button_layout,
|
||||
MetaFrameGeometry *fgeom)
|
||||
MetaFrameGeometry *fgeom,
|
||||
MetaTheme *theme)
|
||||
{
|
||||
int i, n_left, n_right;
|
||||
int x;
|
||||
@ -544,18 +603,20 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
||||
right_func_rects[i] = NULL;
|
||||
|
||||
/* Try to fill in rects */
|
||||
if (button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST)
|
||||
if (button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST && !layout->hide_buttons)
|
||||
{
|
||||
left_func_rects[n_left] = rect_for_function (fgeom, flags,
|
||||
button_layout->left_buttons[i]);
|
||||
button_layout->left_buttons[i],
|
||||
theme);
|
||||
if (left_func_rects[n_left] != NULL)
|
||||
++n_left;
|
||||
}
|
||||
|
||||
if (button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST)
|
||||
if (button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST && !layout->hide_buttons)
|
||||
{
|
||||
right_func_rects[n_right] = rect_for_function (fgeom, flags,
|
||||
button_layout->right_buttons[i]);
|
||||
button_layout->right_buttons[i],
|
||||
theme);
|
||||
if (right_func_rects[n_right] != NULL)
|
||||
++n_right;
|
||||
}
|
||||
@ -610,10 +671,28 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
||||
break; /* Everything fits, bail out */
|
||||
|
||||
/* Otherwise we need to shave out a button. Shave
|
||||
* min, max, close, then menu (menu is most useful);
|
||||
* above, stick, shade, min, max, close, then menu (menu is most useful);
|
||||
* prefer the default button locations.
|
||||
*/
|
||||
if (strip_button (left_func_rects, left_bg_rects,
|
||||
&n_left, &fgeom->above_rect))
|
||||
continue;
|
||||
else if (strip_button (right_func_rects, right_bg_rects,
|
||||
&n_right, &fgeom->above_rect))
|
||||
continue;
|
||||
else if (strip_button (left_func_rects, left_bg_rects,
|
||||
&n_left, &fgeom->stick_rect))
|
||||
continue;
|
||||
else if (strip_button (right_func_rects, right_bg_rects,
|
||||
&n_right, &fgeom->stick_rect))
|
||||
continue;
|
||||
else if (strip_button (left_func_rects, left_bg_rects,
|
||||
&n_left, &fgeom->shade_rect))
|
||||
continue;
|
||||
else if (strip_button (right_func_rects, right_bg_rects,
|
||||
&n_right, &fgeom->shade_rect))
|
||||
continue;
|
||||
else if (strip_button (left_func_rects, left_bg_rects,
|
||||
&n_left, &fgeom->min_rect))
|
||||
continue;
|
||||
else if (strip_button (right_func_rects, right_bg_rects,
|
||||
@ -751,20 +830,20 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
||||
else
|
||||
min_size_for_rounding = 5;
|
||||
|
||||
fgeom->top_left_corner_rounded = FALSE;
|
||||
fgeom->top_right_corner_rounded = FALSE;
|
||||
fgeom->bottom_left_corner_rounded = FALSE;
|
||||
fgeom->bottom_right_corner_rounded = FALSE;
|
||||
fgeom->top_left_corner_rounded_radius = 0;
|
||||
fgeom->top_right_corner_rounded_radius = 0;
|
||||
fgeom->bottom_left_corner_rounded_radius = 0;
|
||||
fgeom->bottom_right_corner_rounded_radius = 0;
|
||||
|
||||
if (fgeom->top_height + fgeom->left_width >= min_size_for_rounding)
|
||||
fgeom->top_left_corner_rounded = layout->top_left_corner_rounded;
|
||||
fgeom->top_left_corner_rounded_radius = layout->top_left_corner_rounded_radius;
|
||||
if (fgeom->top_height + fgeom->right_width >= min_size_for_rounding)
|
||||
fgeom->top_right_corner_rounded = layout->top_right_corner_rounded;
|
||||
fgeom->top_right_corner_rounded_radius = layout->top_right_corner_rounded_radius;
|
||||
|
||||
if (fgeom->bottom_height + fgeom->left_width >= min_size_for_rounding)
|
||||
fgeom->bottom_left_corner_rounded = layout->bottom_left_corner_rounded;
|
||||
fgeom->bottom_left_corner_rounded_radius = layout->bottom_left_corner_rounded_radius;
|
||||
if (fgeom->bottom_height + fgeom->right_width >= min_size_for_rounding)
|
||||
fgeom->bottom_right_corner_rounded = layout->bottom_right_corner_rounded;
|
||||
fgeom->bottom_right_corner_rounded_radius = layout->bottom_right_corner_rounded_radius;
|
||||
}
|
||||
|
||||
MetaGradientSpec*
|
||||
@ -3743,6 +3822,9 @@ meta_frame_style_new (MetaFrameStyle *parent)
|
||||
|
||||
style->refcount = 1;
|
||||
|
||||
/* Default alpha is fully opaque */
|
||||
style->window_background_alpha = 255;
|
||||
|
||||
style->parent = parent;
|
||||
if (parent)
|
||||
meta_frame_style_ref (parent);
|
||||
@ -3790,6 +3872,9 @@ meta_frame_style_unref (MetaFrameStyle *style)
|
||||
if (style->layout)
|
||||
meta_frame_layout_unref (style->layout);
|
||||
|
||||
if (style->window_background_color)
|
||||
meta_color_spec_free (style->window_background_color);
|
||||
|
||||
/* we hold a reference to any parent style */
|
||||
if (style->parent)
|
||||
meta_frame_style_unref (style->parent);
|
||||
@ -3841,6 +3926,7 @@ get_button (MetaFrameStyle *style,
|
||||
|
||||
gboolean
|
||||
meta_frame_style_validate (MetaFrameStyle *style,
|
||||
guint current_theme_version,
|
||||
GError **error)
|
||||
{
|
||||
int i, j;
|
||||
@ -3855,7 +3941,9 @@ meta_frame_style_validate (MetaFrameStyle *style,
|
||||
{
|
||||
for (j = 0; j < META_BUTTON_STATE_LAST; j++)
|
||||
{
|
||||
if (get_button (style, i, j) == NULL)
|
||||
if (get_button (style, i, j) == NULL &&
|
||||
meta_theme_earliest_version_with_button (i) <= current_theme_version
|
||||
)
|
||||
{
|
||||
g_set_error (error, META_THEME_ERROR,
|
||||
META_THEME_ERROR_FAILED,
|
||||
@ -3907,6 +3995,30 @@ button_rect (MetaButtonType type,
|
||||
*rect = fgeom->close_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_SHADE:
|
||||
*rect = fgeom->shade_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_UNSHADE:
|
||||
*rect = fgeom->unshade_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_ABOVE:
|
||||
*rect = fgeom->above_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_UNABOVE:
|
||||
*rect = fgeom->unabove_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_STICK:
|
||||
*rect = fgeom->stick_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_UNSTICK:
|
||||
*rect = fgeom->unstick_rect.visible;
|
||||
break;
|
||||
|
||||
case META_BUTTON_TYPE_MAXIMIZE:
|
||||
*rect = fgeom->max_rect.visible;
|
||||
break;
|
||||
@ -4218,10 +4330,12 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
|
||||
free_focus_styles (style_set->normal_styles[i]);
|
||||
{
|
||||
free_focus_styles (style_set->normal_styles[i]);
|
||||
free_focus_styles (style_set->shaded_styles[i]);
|
||||
}
|
||||
|
||||
free_focus_styles (style_set->maximized_styles);
|
||||
free_focus_styles (style_set->shaded_styles);
|
||||
free_focus_styles (style_set->maximized_and_shaded_styles);
|
||||
|
||||
if (style_set->parent)
|
||||
@ -4243,47 +4357,53 @@ get_style (MetaFrameStyleSet *style_set,
|
||||
|
||||
style = NULL;
|
||||
|
||||
if (state == META_FRAME_STATE_NORMAL)
|
||||
switch (state)
|
||||
{
|
||||
style = style_set->normal_styles[resize][focus];
|
||||
case META_FRAME_STATE_NORMAL:
|
||||
case META_FRAME_STATE_SHADED:
|
||||
{
|
||||
if (state == META_FRAME_STATE_SHADED)
|
||||
style = style_set->shaded_styles[resize][focus];
|
||||
else
|
||||
style = style_set->normal_styles[resize][focus];
|
||||
|
||||
/* Try parent if we failed here */
|
||||
if (style == NULL && style_set->parent)
|
||||
style = get_style (style_set->parent, state, resize, focus);
|
||||
/* Try parent if we failed here */
|
||||
if (style == NULL && style_set->parent)
|
||||
style = get_style (style_set->parent, state, resize, focus);
|
||||
|
||||
/* Allow people to omit the vert/horz/none resize modes */
|
||||
if (style == NULL &&
|
||||
resize != META_FRAME_RESIZE_BOTH)
|
||||
style = get_style (style_set, state, META_FRAME_RESIZE_BOTH, focus);
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaFrameStyle **styles;
|
||||
/* Allow people to omit the vert/horz/none resize modes */
|
||||
if (style == NULL &&
|
||||
resize != META_FRAME_RESIZE_BOTH)
|
||||
style = get_style (style_set, state, META_FRAME_RESIZE_BOTH, focus);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
MetaFrameStyle **styles;
|
||||
|
||||
styles = NULL;
|
||||
styles = NULL;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case META_FRAME_STATE_SHADED:
|
||||
styles = style_set->shaded_styles;
|
||||
break;
|
||||
case META_FRAME_STATE_MAXIMIZED:
|
||||
styles = style_set->maximized_styles;
|
||||
break;
|
||||
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
|
||||
styles = style_set->maximized_and_shaded_styles;
|
||||
break;
|
||||
case META_FRAME_STATE_NORMAL:
|
||||
case META_FRAME_STATE_LAST:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
switch (state)
|
||||
{
|
||||
case META_FRAME_STATE_MAXIMIZED:
|
||||
styles = style_set->maximized_styles;
|
||||
break;
|
||||
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
|
||||
styles = style_set->maximized_and_shaded_styles;
|
||||
break;
|
||||
case META_FRAME_STATE_NORMAL:
|
||||
case META_FRAME_STATE_SHADED:
|
||||
case META_FRAME_STATE_LAST:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
style = styles[focus];
|
||||
style = styles[focus];
|
||||
|
||||
/* Try parent if we failed here */
|
||||
if (style == NULL && style_set->parent)
|
||||
style = get_style (style_set->parent, state, resize, focus);
|
||||
/* Try parent if we failed here */
|
||||
if (style == NULL && style_set->parent)
|
||||
style = get_style (style_set->parent, state, resize, focus);
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
@ -4430,17 +4550,6 @@ meta_theme_new (void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_menu_ops (MetaDrawOpList *op_lists[META_MENU_ICON_TYPE_LAST][N_GTK_STATES])
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < META_MENU_ICON_TYPE_LAST; i++)
|
||||
for (j = 0; j < N_GTK_STATES; j++)
|
||||
if (op_lists[i][j])
|
||||
meta_draw_op_list_unref (op_lists[i][j]);
|
||||
}
|
||||
|
||||
void
|
||||
meta_theme_free (MetaTheme *theme)
|
||||
{
|
||||
@ -4476,34 +4585,15 @@ meta_theme_free (MetaTheme *theme)
|
||||
if (theme->style_sets_by_type[i])
|
||||
meta_frame_style_set_unref (theme->style_sets_by_type[i]);
|
||||
|
||||
free_menu_ops (theme->menu_icons);
|
||||
|
||||
DEBUG_FILL_STRUCT (theme);
|
||||
g_free (theme);
|
||||
}
|
||||
|
||||
static MetaDrawOpList*
|
||||
get_menu_icon (MetaTheme *theme,
|
||||
MetaMenuIconType type,
|
||||
GtkStateType state)
|
||||
{
|
||||
MetaDrawOpList *op_list;
|
||||
|
||||
op_list = theme->menu_icons[type][state];
|
||||
|
||||
/* We fall back to normal if other states aren't found */
|
||||
if (op_list == NULL &&
|
||||
state != GTK_STATE_NORMAL)
|
||||
return get_menu_icon (theme, type, GTK_STATE_NORMAL);
|
||||
|
||||
return op_list;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_theme_validate (MetaTheme *theme,
|
||||
GError **error)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (theme != NULL, FALSE);
|
||||
|
||||
@ -4558,24 +4648,13 @@ meta_theme_validate (MetaTheme *theme,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < META_MENU_ICON_TYPE_LAST; i++)
|
||||
for (j = 0; j < N_GTK_STATES; j++)
|
||||
if (get_menu_icon (theme, i, j) == NULL)
|
||||
{
|
||||
g_set_error (error, META_THEME_ERROR,
|
||||
META_THEME_ERROR_FAILED,
|
||||
_("<menu_icon function=\"%s\" state=\"%s\" draw_ops=\"whatever\"/> must be specified for this theme"),
|
||||
meta_menu_icon_type_to_string (i),
|
||||
meta_gtk_state_to_string (j));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GdkPixbuf*
|
||||
meta_theme_load_image (MetaTheme *theme,
|
||||
const char *filename,
|
||||
guint size_of_theme_icons,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
@ -4585,19 +4664,32 @@ meta_theme_load_image (MetaTheme *theme,
|
||||
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
char *full_path;
|
||||
|
||||
full_path = g_build_filename (theme->dirname, filename, NULL);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (full_path, error);
|
||||
if (pixbuf == NULL)
|
||||
|
||||
if (g_str_has_prefix (filename, "theme:") &&
|
||||
META_THEME_ALLOWS (theme, META_THEME_IMAGES_FROM_ICON_THEMES))
|
||||
{
|
||||
pixbuf = gtk_icon_theme_load_icon (
|
||||
gtk_icon_theme_get_default (),
|
||||
filename+6,
|
||||
size_of_theme_icons,
|
||||
0,
|
||||
error);
|
||||
if (pixbuf == NULL) return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *full_path;
|
||||
full_path = g_build_filename (theme->dirname, filename, NULL);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (full_path, error);
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
g_free (full_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_free (full_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_free (full_path);
|
||||
|
||||
}
|
||||
g_hash_table_replace (theme->images_by_filename,
|
||||
g_strdup (filename),
|
||||
pixbuf);
|
||||
@ -4749,7 +4841,8 @@ meta_theme_draw_frame (MetaTheme *theme,
|
||||
flags,
|
||||
client_width, client_height,
|
||||
button_layout,
|
||||
&fgeom);
|
||||
&fgeom,
|
||||
theme);
|
||||
|
||||
meta_frame_style_draw (style,
|
||||
widget,
|
||||
@ -4764,37 +4857,6 @@ meta_theme_draw_frame (MetaTheme *theme,
|
||||
mini_icon, icon);
|
||||
}
|
||||
|
||||
void
|
||||
meta_theme_draw_menu_icon (MetaTheme *theme,
|
||||
GtkWidget *widget,
|
||||
GdkDrawable *drawable,
|
||||
const GdkRectangle *clip,
|
||||
MetaRectangle offset_rect,
|
||||
MetaMenuIconType type)
|
||||
{
|
||||
MetaDrawInfo info;
|
||||
MetaDrawOpList *op_list;
|
||||
|
||||
g_return_if_fail (type < META_BUTTON_TYPE_LAST);
|
||||
|
||||
op_list = get_menu_icon (theme, type,
|
||||
GTK_WIDGET_STATE (widget));
|
||||
|
||||
info.mini_icon = NULL;
|
||||
info.icon = NULL;
|
||||
info.title_layout = NULL;
|
||||
info.title_layout_width = 0;
|
||||
info.title_layout_height = 0;
|
||||
info.fgeom = NULL;
|
||||
|
||||
meta_draw_op_list_draw (op_list,
|
||||
widget,
|
||||
drawable,
|
||||
clip,
|
||||
&info,
|
||||
offset_rect);
|
||||
}
|
||||
|
||||
void
|
||||
meta_theme_get_frame_borders (MetaTheme *theme,
|
||||
MetaFrameType type,
|
||||
@ -4856,7 +4918,8 @@ meta_theme_calc_geometry (MetaTheme *theme,
|
||||
flags,
|
||||
client_width, client_height,
|
||||
button_layout,
|
||||
fgeom);
|
||||
fgeom,
|
||||
theme);
|
||||
}
|
||||
|
||||
MetaFrameLayout*
|
||||
@ -5054,6 +5117,68 @@ meta_theme_lookup_float_constant (MetaTheme *theme,
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_theme_define_color_constant (MetaTheme *theme,
|
||||
const char *name,
|
||||
const char *value,
|
||||
GError **error)
|
||||
{
|
||||
if (theme->color_constants == NULL)
|
||||
theme->color_constants = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
NULL);
|
||||
|
||||
if (!first_uppercase (name))
|
||||
{
|
||||
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
||||
_("User-defined constants must begin with a capital letter; \"%s\" does not"),
|
||||
name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_hash_table_lookup_extended (theme->color_constants, name, NULL, NULL))
|
||||
{
|
||||
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
||||
_("Constant \"%s\" has already been defined"),
|
||||
name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_hash_table_insert (theme->color_constants,
|
||||
g_strdup (name),
|
||||
g_strdup (value));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_theme_lookup_color_constant (MetaTheme *theme,
|
||||
const char *name,
|
||||
char **value)
|
||||
{
|
||||
char *result;
|
||||
|
||||
*value = NULL;
|
||||
|
||||
if (theme->color_constants == NULL)
|
||||
return FALSE;
|
||||
|
||||
result = g_hash_table_lookup (theme->color_constants, name);
|
||||
|
||||
if (result)
|
||||
{
|
||||
*value = result;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PangoFontDescription*
|
||||
meta_gtk_widget_get_font_desc (GtkWidget *widget,
|
||||
double scale,
|
||||
@ -5176,8 +5301,24 @@ meta_button_state_to_string (MetaButtonState state)
|
||||
}
|
||||
|
||||
MetaButtonType
|
||||
meta_button_type_from_string (const char *str)
|
||||
meta_button_type_from_string (const char *str, MetaTheme *theme)
|
||||
{
|
||||
if (META_THEME_ALLOWS(theme, META_THEME_SHADE_STICK_ABOVE_BUTTONS))
|
||||
{
|
||||
if (strcmp ("shade", str) == 0)
|
||||
return META_BUTTON_TYPE_SHADE;
|
||||
else if (strcmp ("above", str) == 0)
|
||||
return META_BUTTON_TYPE_ABOVE;
|
||||
else if (strcmp ("stick", str) == 0)
|
||||
return META_BUTTON_TYPE_STICK;
|
||||
else if (strcmp ("unshade", str) == 0)
|
||||
return META_BUTTON_TYPE_UNSHADE;
|
||||
else if (strcmp ("unabove", str) == 0)
|
||||
return META_BUTTON_TYPE_UNABOVE;
|
||||
else if (strcmp ("unstick", str) == 0)
|
||||
return META_BUTTON_TYPE_UNSTICK;
|
||||
}
|
||||
|
||||
if (strcmp ("close", str) == 0)
|
||||
return META_BUTTON_TYPE_CLOSE;
|
||||
else if (strcmp ("maximize", str) == 0)
|
||||
@ -5213,7 +5354,19 @@ meta_button_type_to_string (MetaButtonType type)
|
||||
return "maximize";
|
||||
case META_BUTTON_TYPE_MINIMIZE:
|
||||
return "minimize";
|
||||
case META_BUTTON_TYPE_MENU:
|
||||
case META_BUTTON_TYPE_SHADE:
|
||||
return "shade";
|
||||
case META_BUTTON_TYPE_ABOVE:
|
||||
return "above";
|
||||
case META_BUTTON_TYPE_STICK:
|
||||
return "stick";
|
||||
case META_BUTTON_TYPE_UNSHADE:
|
||||
return "unshade";
|
||||
case META_BUTTON_TYPE_UNABOVE:
|
||||
return "unabove";
|
||||
case META_BUTTON_TYPE_UNSTICK:
|
||||
return "unstick";
|
||||
case META_BUTTON_TYPE_MENU:
|
||||
return "menu";
|
||||
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
||||
return "left_left_background";
|
||||
@ -5234,41 +5387,6 @@ meta_button_type_to_string (MetaButtonType type)
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
MetaMenuIconType
|
||||
meta_menu_icon_type_from_string (const char *str)
|
||||
{
|
||||
if (strcmp ("close", str) == 0)
|
||||
return META_MENU_ICON_TYPE_CLOSE;
|
||||
else if (strcmp ("maximize", str) == 0)
|
||||
return META_MENU_ICON_TYPE_MAXIMIZE;
|
||||
else if (strcmp ("minimize", str) == 0)
|
||||
return META_MENU_ICON_TYPE_MINIMIZE;
|
||||
else if (strcmp ("unmaximize", str) == 0)
|
||||
return META_MENU_ICON_TYPE_UNMAXIMIZE;
|
||||
else
|
||||
return META_MENU_ICON_TYPE_LAST;
|
||||
}
|
||||
|
||||
const char*
|
||||
meta_menu_icon_type_to_string (MetaMenuIconType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case META_MENU_ICON_TYPE_CLOSE:
|
||||
return "close";
|
||||
case META_MENU_ICON_TYPE_MAXIMIZE:
|
||||
return "maximize";
|
||||
case META_MENU_ICON_TYPE_MINIMIZE:
|
||||
return "minimize";
|
||||
case META_MENU_ICON_TYPE_UNMAXIMIZE:
|
||||
return "unmaximize";
|
||||
case META_MENU_ICON_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
MetaFramePiece
|
||||
meta_frame_piece_from_string (const char *str)
|
||||
{
|
||||
@ -6044,3 +6162,34 @@ draw_bg_gradient_composite (const MetaTextureSpec *bg,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
guint
|
||||
meta_theme_earliest_version_with_button (MetaButtonType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case META_BUTTON_TYPE_CLOSE:
|
||||
case META_BUTTON_TYPE_MAXIMIZE:
|
||||
case META_BUTTON_TYPE_MINIMIZE:
|
||||
case META_BUTTON_TYPE_MENU:
|
||||
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
||||
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
|
||||
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
|
||||
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
|
||||
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
|
||||
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
|
||||
return 1;
|
||||
|
||||
case META_BUTTON_TYPE_SHADE:
|
||||
case META_BUTTON_TYPE_ABOVE:
|
||||
case META_BUTTON_TYPE_STICK:
|
||||
case META_BUTTON_TYPE_UNSHADE:
|
||||
case META_BUTTON_TYPE_UNABOVE:
|
||||
case META_BUTTON_TYPE_UNSTICK:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
meta_warning("Unknown button %d\n", type);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
80
src/theme.h
80
src/theme.h
@ -100,11 +100,14 @@ struct _MetaFrameLayout
|
||||
/* Whether title text will be displayed */
|
||||
guint has_title : 1;
|
||||
|
||||
/* Whether we should hide the buttons */
|
||||
guint hide_buttons : 1;
|
||||
|
||||
/* Round corners */
|
||||
guint top_left_corner_rounded : 1;
|
||||
guint top_right_corner_rounded : 1;
|
||||
guint bottom_left_corner_rounded : 1;
|
||||
guint bottom_right_corner_rounded : 1;
|
||||
guint top_left_corner_rounded_radius;
|
||||
guint top_right_corner_rounded_radius;
|
||||
guint bottom_left_corner_rounded_radius;
|
||||
guint bottom_right_corner_rounded_radius;
|
||||
};
|
||||
|
||||
struct _MetaButtonSpace
|
||||
@ -145,6 +148,12 @@ struct _MetaFrameGeometry
|
||||
MetaButtonSpace max_rect;
|
||||
MetaButtonSpace min_rect;
|
||||
MetaButtonSpace menu_rect;
|
||||
MetaButtonSpace shade_rect;
|
||||
MetaButtonSpace above_rect;
|
||||
MetaButtonSpace stick_rect;
|
||||
MetaButtonSpace unshade_rect;
|
||||
MetaButtonSpace unabove_rect;
|
||||
MetaButtonSpace unstick_rect;
|
||||
|
||||
#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
|
||||
GdkRectangle left_left_background;
|
||||
@ -156,10 +165,10 @@ struct _MetaFrameGeometry
|
||||
/* End of button rects (if changed adjust memset hack) */
|
||||
|
||||
/* Round corners */
|
||||
guint top_left_corner_rounded : 1;
|
||||
guint top_right_corner_rounded : 1;
|
||||
guint bottom_left_corner_rounded : 1;
|
||||
guint bottom_right_corner_rounded : 1;
|
||||
guint top_left_corner_rounded_radius;
|
||||
guint top_right_corner_rounded_radius;
|
||||
guint bottom_left_corner_rounded_radius;
|
||||
guint bottom_right_corner_rounded_radius;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@ -438,6 +447,12 @@ typedef enum
|
||||
META_BUTTON_TYPE_MAXIMIZE,
|
||||
META_BUTTON_TYPE_MINIMIZE,
|
||||
META_BUTTON_TYPE_MENU,
|
||||
META_BUTTON_TYPE_SHADE,
|
||||
META_BUTTON_TYPE_ABOVE,
|
||||
META_BUTTON_TYPE_STICK,
|
||||
META_BUTTON_TYPE_UNSHADE,
|
||||
META_BUTTON_TYPE_UNABOVE,
|
||||
META_BUTTON_TYPE_UNSTICK,
|
||||
META_BUTTON_TYPE_LAST
|
||||
} MetaButtonType;
|
||||
|
||||
@ -503,6 +518,9 @@ struct _MetaFrameStyle
|
||||
MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
||||
MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
|
||||
MetaFrameLayout *layout;
|
||||
MetaColorSpec *window_background_color; /* can be NULL to use the standard
|
||||
GTK theme engine */
|
||||
guint8 window_background_alpha; /* 0=transparent; 255=opaque */
|
||||
};
|
||||
|
||||
/* Kinds of frame...
|
||||
@ -552,7 +570,7 @@ struct _MetaFrameStyleSet
|
||||
MetaFrameStyleSet *parent;
|
||||
MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
|
||||
MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
|
||||
MetaFrameStyle *shaded_styles[META_FRAME_FOCUS_LAST];
|
||||
MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
|
||||
MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
|
||||
};
|
||||
|
||||
@ -566,16 +584,19 @@ struct _MetaTheme
|
||||
char *copyright;
|
||||
char *date;
|
||||
char *description;
|
||||
guint format_version;
|
||||
|
||||
GHashTable *integer_constants;
|
||||
GHashTable *float_constants;
|
||||
GHashTable *color_constants;
|
||||
GHashTable *images_by_filename;
|
||||
GHashTable *layouts_by_name;
|
||||
GHashTable *draw_op_lists_by_name;
|
||||
GHashTable *styles_by_name;
|
||||
GHashTable *style_sets_by_name;
|
||||
MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
|
||||
MetaDrawOpList *menu_icons[META_MENU_ICON_TYPE_LAST][N_GTK_STATES];
|
||||
|
||||
GdkPixbuf *fallback_icon, *fallback_mini_icon;
|
||||
};
|
||||
|
||||
struct _MetaPositionExprEnv
|
||||
@ -616,7 +637,8 @@ void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout
|
||||
int client_width,
|
||||
int client_height,
|
||||
const MetaButtonLayout *button_layout,
|
||||
MetaFrameGeometry *fgeom);
|
||||
MetaFrameGeometry *fgeom,
|
||||
MetaTheme *theme);
|
||||
|
||||
gboolean meta_frame_layout_validate (const MetaFrameLayout *layout,
|
||||
GError **error);
|
||||
@ -703,6 +725,7 @@ void meta_frame_style_draw (MetaFrameStyle *style,
|
||||
|
||||
|
||||
gboolean meta_frame_style_validate (MetaFrameStyle *style,
|
||||
guint current_theme_version,
|
||||
GError **error);
|
||||
|
||||
MetaFrameStyleSet* meta_frame_style_set_new (MetaFrameStyleSet *parent);
|
||||
@ -722,6 +745,7 @@ gboolean meta_theme_validate (MetaTheme *theme,
|
||||
GError **error);
|
||||
GdkPixbuf* meta_theme_load_image (MetaTheme *theme,
|
||||
const char *filename,
|
||||
guint size_of_theme_icons,
|
||||
GError **error);
|
||||
|
||||
MetaFrameStyle* meta_theme_get_frame_style (MetaTheme *theme,
|
||||
@ -749,13 +773,6 @@ void meta_theme_draw_frame (MetaTheme *theme,
|
||||
GdkPixbuf *mini_icon,
|
||||
GdkPixbuf *icon);
|
||||
|
||||
void meta_theme_draw_menu_icon (MetaTheme *theme,
|
||||
GtkWidget *widget,
|
||||
GdkDrawable *drawable,
|
||||
const GdkRectangle *clip,
|
||||
MetaRectangle offset_rect,
|
||||
MetaMenuIconType type);
|
||||
|
||||
void meta_theme_get_frame_borders (MetaTheme *theme,
|
||||
MetaFrameType type,
|
||||
int text_height,
|
||||
@ -808,6 +825,14 @@ gboolean meta_theme_lookup_float_constant (MetaTheme *theme,
|
||||
const char *name,
|
||||
double *value);
|
||||
|
||||
gboolean meta_theme_define_color_constant (MetaTheme *theme,
|
||||
const char *name,
|
||||
const char *value,
|
||||
GError **error);
|
||||
gboolean meta_theme_lookup_color_constant (MetaTheme *theme,
|
||||
const char *name,
|
||||
char **value);
|
||||
|
||||
char* meta_theme_replace_constants (MetaTheme *theme,
|
||||
const char *expr,
|
||||
GError **err);
|
||||
@ -826,10 +851,9 @@ MetaGtkColorComponent meta_color_component_from_string (const char *s
|
||||
const char* meta_color_component_to_string (MetaGtkColorComponent component);
|
||||
MetaButtonState meta_button_state_from_string (const char *str);
|
||||
const char* meta_button_state_to_string (MetaButtonState state);
|
||||
MetaButtonType meta_button_type_from_string (const char *str);
|
||||
MetaButtonType meta_button_type_from_string (const char *str,
|
||||
MetaTheme *theme);
|
||||
const char* meta_button_type_to_string (MetaButtonType type);
|
||||
MetaMenuIconType meta_menu_icon_type_from_string (const char *str);
|
||||
const char* meta_menu_icon_type_to_string (MetaMenuIconType type);
|
||||
MetaFramePiece meta_frame_piece_from_string (const char *str);
|
||||
const char* meta_frame_piece_to_string (MetaFramePiece piece);
|
||||
MetaFrameState meta_frame_state_from_string (const char *str);
|
||||
@ -851,5 +875,19 @@ const char* meta_gtk_arrow_to_string (GtkArrowType a
|
||||
MetaImageFillType meta_image_fill_type_from_string (const char *str);
|
||||
const char* meta_image_fill_type_to_string (MetaImageFillType fill_type);
|
||||
|
||||
guint meta_theme_earliest_version_with_button (MetaButtonType type);
|
||||
|
||||
#define META_THEME_ALLOWS(theme, feature) (theme->format_version >= feature)
|
||||
|
||||
/* What version of the theme file format were various features introduced in? */
|
||||
#define META_THEME_SHADE_STICK_ABOVE_BUTTONS 2
|
||||
#define META_THEME_UBIQUITOUS_CONSTANTS 2
|
||||
#define META_THEME_VARIED_ROUND_CORNERS 2
|
||||
#define META_THEME_IMAGES_FROM_ICON_THEMES 2
|
||||
#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
|
||||
#define META_THEME_DEGREES_IN_ARCS 2
|
||||
#define META_THEME_HIDDEN_BUTTONS 2
|
||||
#define META_THEME_COLOR_CONSTANTS 2
|
||||
#define META_THEME_FRAME_BACKGROUNDS 2
|
||||
|
||||
#endif
|
||||
|
2
src/ui.c
2
src/ui.c
@ -30,6 +30,7 @@
|
||||
#include "menu.h"
|
||||
#include "core.h"
|
||||
#include "theme.h"
|
||||
#include "iconcache.h"
|
||||
|
||||
#include "inlinepixbufs.h"
|
||||
|
||||
@ -736,6 +737,7 @@ meta_ui_set_current_theme (const char *name,
|
||||
gboolean force_reload)
|
||||
{
|
||||
meta_theme_set_current (name, force_reload);
|
||||
meta_invalidate_default_icons ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -110,7 +110,6 @@ static void meta_window_flush_calc_showing (MetaWindow *window);
|
||||
|
||||
static void meta_window_unqueue_move_resize (MetaWindow *window);
|
||||
|
||||
static void meta_window_update_icon_now (MetaWindow *window);
|
||||
static void meta_window_unqueue_update_icon (MetaWindow *window);
|
||||
|
||||
static gboolean queue_calc_showing_func (MetaWindow *window,
|
||||
@ -5484,7 +5483,7 @@ redraw_icon (MetaWindow *window)
|
||||
meta_ui_queue_frame_draw (window->screen->ui, window->frame->xwindow);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
meta_window_update_icon_now (MetaWindow *window)
|
||||
{
|
||||
GdkPixbuf *icon;
|
||||
|
@ -607,4 +607,7 @@ void meta_window_set_user_time (MetaWindow *window,
|
||||
void meta_window_set_demands_attention (MetaWindow *window);
|
||||
|
||||
void meta_window_unset_demands_attention (MetaWindow *window);
|
||||
|
||||
void meta_window_update_icon_now (MetaWindow *window);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user