mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 13:24:09 +00:00
move in here so util.c doesn't require display.[hc]
2002-01-27 Havoc Pennington <hp@pobox.com> * src/display.c (meta_set_syncing): move in here so util.c doesn't require display.[hc] * src/theme.h, src/theme.c: implement coordinate expression parser, write MetaShapeSpec declaration * src/util.c (meta_exit): move in here so we can link to util.c with a different main() * src/theme.h: rename the MetaWindow* enums to MetaFrame*
This commit is contained in:
parent
33dd196cba
commit
8ddeb4f953
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2002-01-27 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/display.c (meta_set_syncing): move in here so util.c doesn't
|
||||||
|
require display.[hc]
|
||||||
|
|
||||||
|
* src/theme.h, src/theme.c: implement coordinate expression
|
||||||
|
parser, write MetaShapeSpec declaration
|
||||||
|
|
||||||
|
* src/util.c (meta_exit): move in here so we can link
|
||||||
|
to util.c with a different main()
|
||||||
|
|
||||||
|
* src/theme.h: rename the MetaWindow* enums to MetaFrame*
|
||||||
|
|
||||||
2002-01-27 Peteris Krisjanis <peteris.krisjanis@ttc.lv>
|
2002-01-27 Peteris Krisjanis <peteris.krisjanis@ttc.lv>
|
||||||
|
|
||||||
* configure.in - Added lv to ALL_LINGUAS
|
* configure.in - Added lv to ALL_LINGUAS
|
||||||
|
@ -55,9 +55,19 @@ metacity_SOURCES= \
|
|||||||
xprops.c \
|
xprops.c \
|
||||||
xprops.h
|
xprops.h
|
||||||
|
|
||||||
bin_PROGRAMS=metacity
|
metacity_theme_viewer_SOURCES= \
|
||||||
|
gradient.c \
|
||||||
|
gradient.h \
|
||||||
|
theme.c \
|
||||||
|
theme.h \
|
||||||
|
theme-viewer.c \
|
||||||
|
util.c \
|
||||||
|
util.h
|
||||||
|
|
||||||
|
bin_PROGRAMS=metacity metacity-theme-viewer
|
||||||
|
|
||||||
metacity_LDADD= @METACITY_LIBS@
|
metacity_LDADD= @METACITY_LIBS@
|
||||||
|
metacity_theme_viewer_LDADD= @METACITY_LIBS@
|
||||||
|
|
||||||
testgradient_SOURCES=gradient.h gradient.c testgradient.c
|
testgradient_SOURCES=gradient.h gradient.c testgradient.c
|
||||||
|
|
||||||
|
@ -2057,3 +2057,30 @@ meta_display_unshow_desktop (MetaDisplay *display)
|
|||||||
|
|
||||||
queue_windows_showing (display);
|
queue_windows_showing (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean is_syncing = FALSE;
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_is_syncing (void)
|
||||||
|
{
|
||||||
|
return is_syncing;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_set_syncing (gboolean setting)
|
||||||
|
{
|
||||||
|
if (setting != is_syncing)
|
||||||
|
{
|
||||||
|
GSList *tmp;
|
||||||
|
|
||||||
|
is_syncing = setting;
|
||||||
|
|
||||||
|
tmp = meta_displays_list ();
|
||||||
|
while (tmp != NULL)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = tmp->data;
|
||||||
|
XSynchronize (display->xdisplay, is_syncing);
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -274,13 +274,6 @@ meta_quit (MetaExitCode code)
|
|||||||
g_main_quit (meta_main_loop);
|
g_main_quit (meta_main_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
meta_exit (MetaExitCode code)
|
|
||||||
{
|
|
||||||
|
|
||||||
exit (code);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_restart (void)
|
meta_restart (void)
|
||||||
{
|
{
|
||||||
|
247
src/theme-viewer.c
Normal file
247
src/theme-viewer.c
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
/* Metacity theme viewer and test app main() */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2002 Havoc Pennington
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include "util.h"
|
||||||
|
#include "theme.h"
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static void run_position_expression_tests (void);
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
|
||||||
|
|
||||||
|
run_position_expression_tests ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GdkRectangle rect;
|
||||||
|
const char *expr;
|
||||||
|
int expected_x;
|
||||||
|
int expected_y;
|
||||||
|
MetaPositionExprError expected_error;
|
||||||
|
} PositionExpressionTest;
|
||||||
|
|
||||||
|
#define NO_ERROR -1
|
||||||
|
|
||||||
|
static const PositionExpressionTest position_expression_tests[] = {
|
||||||
|
/* Just numbers */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"10", 20, 30, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14.37", 24, 34, NO_ERROR },
|
||||||
|
/* Binary expressions with 2 ints */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 * 10", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 + 10", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 - 10", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 / 2", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions with floats and mixed float/ints */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"7.0 / 3.5", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12.1 / 3", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12 / 2.95", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions without whitespace after first number */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14* 10", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14+ 10", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14- 10", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8/ 2", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"7.0/ 3.5", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12.1/ 3", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12/ 2.95", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions without whitespace before second number */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 *10", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 +10", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 -10", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 /2", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"7.0 /3.5", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12.1 /3", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12 /2.95", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions without any whitespace */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14*10", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14+10", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14-10", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8/2", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"7.0/3.5", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12.1/3", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"12/2.95", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions with parentheses */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(14) * (10)", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(14) + (10)", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(14) - (10)", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(8) / (2)", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(7.0) / (3.5)", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(12.1) / (3)", 14, 24, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(12) / (2.95)", 14, 24, NO_ERROR },
|
||||||
|
/* Lots of extra parentheses */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(((14)) * ((10)))", 150, 160, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"((((14)))) + ((((((((10))))))))", 34, 44, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"((((((((((14 - 10))))))))))", 14, 24, NO_ERROR },
|
||||||
|
/* Binary expressions with variables */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"2 * width", 90, 100, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"2 * height", 110, 120, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"width - 10", 40, 50, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"height / 2", 35, 45, NO_ERROR },
|
||||||
|
/* More than two operands */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 / 2 + 5", 19, 29, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 * 2 + 5", 31, 41, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 + 2 * 5", 28, 38, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 + 8 / 2", 22, 32, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"14 / (2 + 5)", 12, 22, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"8 * (2 + 5)", 66, 76, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(8 + 2) * 5", 60, 70, NO_ERROR },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(8 + 8) / 2", 18, 28, NO_ERROR },
|
||||||
|
/* Errors */
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"2 * foo", 0, 0, META_POSITION_EXPR_ERROR_UNKNOWN_VARIABLE },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"2 *", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"- width", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"! * 2", 0, 0, META_POSITION_EXPR_ERROR_BAD_CHARACTER },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
" ", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"() () (( ) ()) ((()))", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"(*) () ((/) ()) ((()))", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"2 * 5 /", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"+ 2 * 5", 0, 0, META_POSITION_EXPR_ERROR_FAILED },
|
||||||
|
{ { 10, 20, 40, 50 },
|
||||||
|
"+ 2 * 5", 0, 0, META_POSITION_EXPR_ERROR_FAILED }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
run_position_expression_tests (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < G_N_ELEMENTS (position_expression_tests))
|
||||||
|
{
|
||||||
|
GError *err;
|
||||||
|
gboolean retval;
|
||||||
|
const PositionExpressionTest *test;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
test = &position_expression_tests[i];
|
||||||
|
|
||||||
|
if (g_getenv ("META_PRINT_TESTS") != NULL)
|
||||||
|
g_print ("Test expression: \"%s\" expecting x = %d y = %d",
|
||||||
|
test->expr, test->expected_x, test->expected_y);
|
||||||
|
|
||||||
|
err = NULL;
|
||||||
|
|
||||||
|
retval = meta_parse_position_expression (test->expr,
|
||||||
|
test->rect.x,
|
||||||
|
test->rect.y,
|
||||||
|
test->rect.width,
|
||||||
|
test->rect.height,
|
||||||
|
&x, &y,
|
||||||
|
&err);
|
||||||
|
|
||||||
|
if (retval && err)
|
||||||
|
g_error ("position expression test returned TRUE but set error");
|
||||||
|
if (!retval && err == NULL)
|
||||||
|
g_error ("position expression test returned FALSE but didn't set error");
|
||||||
|
if (test->expected_error != NO_ERROR)
|
||||||
|
{
|
||||||
|
if (err == NULL)
|
||||||
|
g_error ("Error was expected but none given");
|
||||||
|
if (err->code != test->expected_error)
|
||||||
|
g_error ("Error %d was expected but %d given",
|
||||||
|
test->expected_error, err->code);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (err)
|
||||||
|
g_error ("Error not expected but one was returned: %s",
|
||||||
|
err->message);
|
||||||
|
|
||||||
|
if (x != test->expected_x)
|
||||||
|
g_error ("x value was %d, %d was expected", x, test->expected_x);
|
||||||
|
|
||||||
|
if (y != test->expected_y)
|
||||||
|
g_error ("y value was %d, %d was expected", y, test->expected_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
g_error_free (err);
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
1073
src/theme.c
1073
src/theme.c
File diff suppressed because it is too large
Load Diff
209
src/theme.h
209
src/theme.h
@ -31,10 +31,19 @@ typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
|
|||||||
typedef struct _MetaTextureSpec MetaTextureSpec;
|
typedef struct _MetaTextureSpec MetaTextureSpec;
|
||||||
typedef struct _MetaGradientSpec MetaGradientSpec;
|
typedef struct _MetaGradientSpec MetaGradientSpec;
|
||||||
typedef struct _MetaColorSpec MetaColorSpec;
|
typedef struct _MetaColorSpec MetaColorSpec;
|
||||||
|
typedef struct _MetaShapeSpec MetaShapeSpec;
|
||||||
typedef struct _MetaFrameLayout MetaFrameLayout;
|
typedef struct _MetaFrameLayout MetaFrameLayout;
|
||||||
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
||||||
typedef struct _MetaTheme MetaTheme;
|
typedef struct _MetaTheme MetaTheme;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_TEXTURE_DRAW_UNSCALED,
|
||||||
|
META_TEXTURE_DRAW_SCALED_VERTICALLY,
|
||||||
|
META_TEXTURE_DRAW_SCALED_HORIZONTALLY,
|
||||||
|
META_TEXTURE_DRAW_SCALED_BOTH
|
||||||
|
} MetaTextureDrawMode;
|
||||||
|
|
||||||
/* Parameters used to calculate the geometry of the frame */
|
/* Parameters used to calculate the geometry of the frame */
|
||||||
struct _MetaFrameLayout
|
struct _MetaFrameLayout
|
||||||
{
|
{
|
||||||
@ -121,6 +130,100 @@ struct _MetaColorSpec
|
|||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
/* Basic drawing */
|
||||||
|
META_SHAPE_LINE,
|
||||||
|
META_SHAPE_RECTANGLE,
|
||||||
|
META_SHAPE_ARC,
|
||||||
|
|
||||||
|
/* Texture in a specific rectangle */
|
||||||
|
META_SHAPE_TEXTURE,
|
||||||
|
|
||||||
|
/* GTK theme engine stuff */
|
||||||
|
META_SHAPE_GTK_ARROW,
|
||||||
|
META_SHAPE_GTK_BOX,
|
||||||
|
META_SHAPE_GTK_VLINE
|
||||||
|
} MetaShapeType;
|
||||||
|
|
||||||
|
struct _MetaShapeSpec
|
||||||
|
{
|
||||||
|
MetaShapeType type;
|
||||||
|
|
||||||
|
/* Positions are strings because they can be expressions */
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct {
|
||||||
|
MetaColorSpec *color_spec;
|
||||||
|
int dash_on_length;
|
||||||
|
int dash_off_length;
|
||||||
|
int width;
|
||||||
|
char *x1;
|
||||||
|
char *y1;
|
||||||
|
char *x2;
|
||||||
|
char *y2;
|
||||||
|
} line;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
MetaColorSpec *color_spec;
|
||||||
|
gboolean filled;
|
||||||
|
char *x;
|
||||||
|
char *y;
|
||||||
|
char *width;
|
||||||
|
char *height;
|
||||||
|
} rectangle;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
MetaColorSpec *color_spec;
|
||||||
|
gboolean filled;
|
||||||
|
char *x;
|
||||||
|
char *y;
|
||||||
|
char *width;
|
||||||
|
char *height;
|
||||||
|
double start_angle;
|
||||||
|
double extent_angle;
|
||||||
|
} arc;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
MetaTextureSpec *texture_spec;
|
||||||
|
MetaTextureDrawMode mode;
|
||||||
|
double xalign;
|
||||||
|
double yalign;
|
||||||
|
char *x;
|
||||||
|
char *y;
|
||||||
|
char *width;
|
||||||
|
char *height;
|
||||||
|
} texture;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
GtkStateType state;
|
||||||
|
GtkShadowType shadow;
|
||||||
|
GtkArrowType arrow;
|
||||||
|
char *x;
|
||||||
|
char *y;
|
||||||
|
char *width;
|
||||||
|
char *height;
|
||||||
|
} gtk_arrow;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
GtkStateType state;
|
||||||
|
GtkShadowType shadow;
|
||||||
|
char *x;
|
||||||
|
char *y;
|
||||||
|
char *width;
|
||||||
|
char *height;
|
||||||
|
} gtk_box;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
GtkStateType state;
|
||||||
|
char *x;
|
||||||
|
char *y1;
|
||||||
|
char *y2;
|
||||||
|
} gtk_vline;
|
||||||
|
|
||||||
|
} data;
|
||||||
|
};
|
||||||
|
|
||||||
struct _MetaGradientSpec
|
struct _MetaGradientSpec
|
||||||
{
|
{
|
||||||
MetaGradientType type;
|
MetaGradientType type;
|
||||||
@ -135,14 +238,6 @@ typedef enum
|
|||||||
META_TEXTURE_COMPOSITE
|
META_TEXTURE_COMPOSITE
|
||||||
} MetaTextureType;
|
} MetaTextureType;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
META_TEXTURE_DRAW_UNSCALED,
|
|
||||||
META_TEXTURE_DRAW_SCALED_VERTICALLY,
|
|
||||||
META_TEXTURE_DRAW_SCALED_HORIZONTALLY,
|
|
||||||
META_TEXTURE_DRAW_SCALED_BOTH
|
|
||||||
} MetaTextureDrawMode;
|
|
||||||
|
|
||||||
struct _MetaTextureSpec
|
struct _MetaTextureSpec
|
||||||
{
|
{
|
||||||
MetaTextureType type;
|
MetaTextureType type;
|
||||||
@ -252,6 +347,8 @@ typedef enum
|
|||||||
META_FRAME_PIECE_LEFT_END_OF_BOTTOM_EDGE,
|
META_FRAME_PIECE_LEFT_END_OF_BOTTOM_EDGE,
|
||||||
/* place on right end of bottom edge of the frame, unscaled */
|
/* place on right end of bottom edge of the frame, unscaled */
|
||||||
META_FRAME_PIECE_RIGHT_END_OF_BOTTOM_EDGE,
|
META_FRAME_PIECE_RIGHT_END_OF_BOTTOM_EDGE,
|
||||||
|
/* place over entire frame, after drawing everything else */
|
||||||
|
META_FRAME_PIECE_OVERLAY,
|
||||||
/* Used to get size of the enum */
|
/* Used to get size of the enum */
|
||||||
META_FRAME_PIECE_LAST
|
META_FRAME_PIECE_LAST
|
||||||
} MetaFramePiece;
|
} MetaFramePiece;
|
||||||
@ -259,16 +356,15 @@ typedef enum
|
|||||||
struct _MetaFrameStyle
|
struct _MetaFrameStyle
|
||||||
{
|
{
|
||||||
int refcount;
|
int refcount;
|
||||||
|
MetaFrameStyle *parent;
|
||||||
MetaTextureSpec *button_icons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
MetaTextureSpec *button_icons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
||||||
MetaTextureSpec *button_backgrounds[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
MetaTextureSpec *button_backgrounds[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
|
||||||
MetaTextureSpec *pieces[META_FRAME_PIECE_LAST];
|
MetaTextureSpec *pieces[META_FRAME_PIECE_LAST];
|
||||||
MetaFrameLayout *layout;
|
MetaFrameLayout *layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Kinds of frame...
|
||||||
/* FIXME dammit, these are not mutually exclusive; how to handle
|
*
|
||||||
* the mess...
|
|
||||||
*
|
|
||||||
* normal -> noresize / vert only / horz only / both
|
* normal -> noresize / vert only / horz only / both
|
||||||
* focused / unfocused
|
* focused / unfocused
|
||||||
* max -> focused / unfocused
|
* max -> focused / unfocused
|
||||||
@ -284,43 +380,48 @@ struct _MetaFrameStyle
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_WINDOW_STATE_NORMAL,
|
META_FRAME_STATE_NORMAL,
|
||||||
META_WINDOW_STATE_MAXIMIZED,
|
META_FRAME_STATE_MAXIMIZED,
|
||||||
META_WINDOW_STATE_SHADED,
|
META_FRAME_STATE_SHADED,
|
||||||
META_WINDOW_STATE_MAXIMIZED_AND_SHADED,
|
META_FRAME_STATE_MAXIMIZED_AND_SHADED,
|
||||||
META_WINDOW_STATE_LAST
|
META_FRAME_STATE_LAST
|
||||||
} MetaWindowState;
|
} MetaFrameState;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_WINDOW_RESIZE_NONE,
|
META_FRAME_RESIZE_NONE,
|
||||||
META_WINDOW_RESIZE_VERTICAL,
|
META_FRAME_RESIZE_VERTICAL,
|
||||||
META_WINDOW_RESIZE_HORIZONTAL,
|
META_FRAME_RESIZE_HORIZONTAL,
|
||||||
META_WINDOW_RESIZE_BOTH,
|
META_FRAME_RESIZE_BOTH,
|
||||||
META_WINDOW_RESIZE_LAST
|
META_FRAME_RESIZE_LAST
|
||||||
} MetaWindowResize;
|
} MetaFrameResize;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_WINDOW_FOCUS_NO,
|
META_FRAME_FOCUS_NO,
|
||||||
META_WINDOW_FOCUS_YES,
|
META_FRAME_FOCUS_YES,
|
||||||
META_WINDOW_FOCUS_LAST
|
META_FRAME_FOCUS_LAST
|
||||||
} MetaWindowFocus;
|
} MetaFrameFocus;
|
||||||
|
|
||||||
/* One StyleSet per window type (for window types that get a frame) */
|
/* One StyleSet per window type (for window types that get a frame) */
|
||||||
struct _MetaFrameStyleSet
|
struct _MetaFrameStyleSet
|
||||||
{
|
{
|
||||||
MetaFrameStyle *normal_styles[META_WINDOW_RESIZE_LAST][META_WINDOW_FOCUS_LAST];
|
int refcount;
|
||||||
MetaFrameStyle *maximized_styles[META_WINDOW_FOCUS_LAST];
|
MetaFrameStyleSet *parent;
|
||||||
MetaFrameStyle *shaded_styles[META_WINDOW_FOCUS_LAST];
|
MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
|
||||||
MetaFrameStyle *maximized_and_shaded_styles[META_WINDOW_FOCUS_LAST];
|
MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
|
||||||
|
MetaFrameStyle *shaded_styles[META_FRAME_FOCUS_LAST];
|
||||||
|
MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaTheme
|
struct _MetaTheme
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
char *filename;
|
char *filename;
|
||||||
MetaFrameStyleSet *style_sets[META_FRAME_TYPE_LAST];
|
|
||||||
|
GHashTable *styles_by_name;
|
||||||
|
GHashTable *style_sets_by_name;
|
||||||
|
MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaFrameLayout* meta_frame_layout_new (void);
|
MetaFrameLayout* meta_frame_layout_new (void);
|
||||||
@ -341,6 +442,21 @@ void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
int client_height,
|
int client_height,
|
||||||
MetaFrameGeometry *fgeom);
|
MetaFrameGeometry *fgeom);
|
||||||
|
|
||||||
|
#define META_POSITION_EXPR_ERROR (g_quark_from_static_string ("meta-position-expr-error"))
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_POSITION_EXPR_ERROR_BAD_CHARACTER,
|
||||||
|
META_POSITION_EXPR_ERROR_BAD_PARENS,
|
||||||
|
META_POSITION_EXPR_ERROR_UNKNOWN_VARIABLE,
|
||||||
|
META_POSITION_EXPR_ERROR_DIVIDE_BY_ZERO,
|
||||||
|
META_POSITION_EXPR_ERROR_MOD_ON_FLOAT,
|
||||||
|
META_POSITION_EXPR_ERROR_FAILED
|
||||||
|
} MetaPositionExprError;
|
||||||
|
|
||||||
|
gboolean meta_parse_position_expression (const char *expr,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
int *x_return, int *y_return,
|
||||||
|
GError **err);
|
||||||
|
|
||||||
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
|
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
|
||||||
void meta_color_spec_free (MetaColorSpec *spec);
|
void meta_color_spec_free (MetaColorSpec *spec);
|
||||||
@ -348,6 +464,23 @@ void meta_color_spec_render (MetaColorSpec *spec,
|
|||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
GdkColor *color);
|
GdkColor *color);
|
||||||
|
|
||||||
|
MetaShapeSpec* meta_shape_spec_new (MetaShapeType type);
|
||||||
|
void meta_shape_spec_free (MetaShapeSpec *spec);
|
||||||
|
void meta_shape_spec_draw (const MetaShapeSpec *spec,
|
||||||
|
GtkWidget *widget,
|
||||||
|
GdkDrawable *drawable,
|
||||||
|
const GdkRectangle *clip,
|
||||||
|
/* logical region being drawn,
|
||||||
|
* shape coords are offset by
|
||||||
|
* x,y and w/h variables are
|
||||||
|
* available in shape coord
|
||||||
|
* expressions.
|
||||||
|
*/
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
MetaGradientSpec* meta_gradient_spec_new (MetaGradientType type);
|
MetaGradientSpec* meta_gradient_spec_new (MetaGradientType type);
|
||||||
void meta_gradient_spec_free (MetaGradientSpec *desc);
|
void meta_gradient_spec_free (MetaGradientSpec *desc);
|
||||||
GdkPixbuf* meta_gradient_spec_render (const MetaGradientSpec *desc,
|
GdkPixbuf* meta_gradient_spec_render (const MetaGradientSpec *desc,
|
||||||
@ -376,11 +509,15 @@ void meta_texture_spec_draw (const MetaTextureSpec *desc,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
MetaFrameStyle* meta_frame_style_new (void);
|
MetaFrameStyle* meta_frame_style_new (MetaFrameStyle *parent);
|
||||||
void meta_frame_style_ref (MetaFrameStyle *style);
|
void meta_frame_style_ref (MetaFrameStyle *style);
|
||||||
void meta_frame_style_unref (MetaFrameStyle *style);
|
void meta_frame_style_unref (MetaFrameStyle *style);
|
||||||
|
|
||||||
MetaFrameStyleSet* meta_frame_style_set_new (void);
|
MetaFrameStyleSet* meta_frame_style_set_new (MetaFrameStyleSet *parent);
|
||||||
void meta_frame_style_set_free (MetaFrameStyleSet *style_set);
|
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set);
|
||||||
|
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
|
||||||
|
|
||||||
|
MetaTheme* meta_theme_new (void);
|
||||||
|
void meta_theme_free (MetaTheme *theme);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
34
src/util.c
34
src/util.c
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "display.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -29,7 +28,6 @@
|
|||||||
|
|
||||||
static gboolean is_verbose = FALSE;
|
static gboolean is_verbose = FALSE;
|
||||||
static gboolean is_debugging = FALSE;
|
static gboolean is_debugging = FALSE;
|
||||||
static gboolean is_syncing = FALSE;
|
|
||||||
static int no_prefix = 0;
|
static int no_prefix = 0;
|
||||||
static FILE* logfile = NULL;
|
static FILE* logfile = NULL;
|
||||||
|
|
||||||
@ -88,31 +86,6 @@ meta_set_debugging (gboolean setting)
|
|||||||
is_debugging = setting;
|
is_debugging = setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_is_syncing (void)
|
|
||||||
{
|
|
||||||
return is_syncing;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
meta_set_syncing (gboolean setting)
|
|
||||||
{
|
|
||||||
if (setting != is_syncing)
|
|
||||||
{
|
|
||||||
GSList *tmp;
|
|
||||||
|
|
||||||
is_syncing = setting;
|
|
||||||
|
|
||||||
tmp = meta_displays_list ();
|
|
||||||
while (tmp != NULL)
|
|
||||||
{
|
|
||||||
MetaDisplay *display = tmp->data;
|
|
||||||
XSynchronize (display->xdisplay, is_syncing);
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_debug_spew (const char *format, ...)
|
meta_debug_spew (const char *format, ...)
|
||||||
{
|
{
|
||||||
@ -300,3 +273,10 @@ meta_pop_no_msg_prefix (void)
|
|||||||
|
|
||||||
--no_prefix;
|
--no_prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_exit (MetaExitCode code)
|
||||||
|
{
|
||||||
|
|
||||||
|
exit (code);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user