draw titlebar highlight with snazzy gradient that needs some tweaking to

2002-01-05  Havoc Pennington  <hp@pobox.com>

	* src/frames.c (meta_frames_expose_event): draw titlebar highlight
	with snazzy gradient that needs some tweaking to be less
	dumb-looking

	* src/theme.c: replace old theme.[hc] contents with newer stuff
	that doesn't do anything
This commit is contained in:
Havoc Pennington 2002-01-06 04:51:53 +00:00 committed by Havoc Pennington
parent 3d1d70b727
commit 8b680dfdd2
7 changed files with 312 additions and 908 deletions

View File

@ -1,3 +1,12 @@
2002-01-05 Havoc Pennington <hp@pobox.com>
* src/frames.c (meta_frames_expose_event): draw titlebar highlight
with snazzy gradient that needs some tweaking to be less
dumb-looking
* src/theme.c: replace old theme.[hc] contents with newer stuff
that doesn't do anything
2002-01-05 Havoc Pennington <hp@pobox.com>
GTK 1.2 plug/socket clients still broken, don't know why.

View File

@ -40,6 +40,8 @@ metacity_SOURCES= \
stack.h \
tabpopup.c \
tabpopup.h \
theme.c \
theme.h \
ui.c \
ui.h \
util.c \

View File

@ -25,6 +25,7 @@
#include "core.h"
#include "menu.h"
#include "fixedtip.h"
#include "theme.h"
#define DEFAULT_INNER_BUTTON_BORDER 3
@ -1759,6 +1760,7 @@ meta_frames_expose_event (GtkWidget *widget,
{
layout_gc = widget->style->fg_gc[GTK_STATE_SELECTED];
#if 0
/* Draw blue background */
gdk_draw_rectangle (frame->window,
widget->style->bg_gc[GTK_STATE_SELECTED],
@ -1767,6 +1769,30 @@ meta_frames_expose_event (GtkWidget *widget,
fgeom.title_rect.y,
fgeom.title_rect.width,
fgeom.title_rect.height);
#else
{
GdkPixbuf *gradient;
gradient = meta_theme_get_gradient (META_GRADIENT_HORIZONTAL,
&widget->style->bg[GTK_STATE_SELECTED],
&widget->style->bg[GTK_STATE_NORMAL],
fgeom.title_rect.width,
fgeom.title_rect.height);
gdk_pixbuf_render_to_drawable (gradient,
frame->window,
widget->style->bg_gc[GTK_STATE_SELECTED],
0, 0,
fgeom.title_rect.x,
fgeom.title_rect.y,
fgeom.title_rect.width,
fgeom.title_rect.height,
GDK_RGB_DITHER_NORMAL,
0, 0);
g_object_unref (G_OBJECT (gradient));
}
#endif
}
if (frame->layout)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Metacity Theme Engine Header */
/* Metacity Theme Rendering */
/*
* Copyright (C) 2001 Havoc Pennington
@ -22,118 +22,22 @@
#ifndef META_THEME_H
#define META_THEME_H
/* don't add any internal headers here; theme.h is an installed/public
* header.
*/
#include <X11/Xlib.h>
#include <glib.h>
#include "api.h"
#include "frames.h"
typedef struct _MetaFrameInfo MetaFrameInfo;
typedef struct _MetaFrameGeometry MetaFrameGeometry;
typedef struct _MetaThemeEngine MetaThemeEngine;
/* theme.[hc] is basically responsible for drawing parts of the UI using
* theme data
*/
typedef enum
{
META_FRAME_ALLOWS_DELETE = 1 << 0,
META_FRAME_ALLOWS_MENU = 1 << 1,
META_FRAME_ALLOWS_ICONIFY = 1 << 2,
META_FRAME_ALLOWS_MAXIMIZE = 1 << 3,
META_FRAME_ALLOWS_RESIZE = 1 << 4,
META_FRAME_TRANSIENT = 1 << 5,
META_FRAME_HAS_FOCUS = 1 << 6,
META_FRAME_SHADED = 1 << 7,
META_FRAME_STUCK = 1 << 8
} MetaFrameFlags;
META_GRADIENT_VERTICAL,
META_GRADIENT_HORIZONTAL
} MetaGradientType;
typedef enum
{
META_FRAME_CONTROL_NONE,
META_FRAME_CONTROL_TITLE,
META_FRAME_CONTROL_DELETE,
META_FRAME_CONTROL_MENU,
META_FRAME_CONTROL_ICONIFY,
META_FRAME_CONTROL_MAXIMIZE,
META_FRAME_CONTROL_RESIZE_SE,
META_FRAME_CONTROL_RESIZE_S,
META_FRAME_CONTROL_RESIZE_SW,
META_FRAME_CONTROL_RESIZE_N,
META_FRAME_CONTROL_RESIZE_NE,
META_FRAME_CONTROL_RESIZE_NW,
META_FRAME_CONTROL_RESIZE_W,
META_FRAME_CONTROL_RESIZE_E
} MetaFrameControl;
struct _MetaFrameInfo
{
/* These are read-only to engines */
MetaFrameFlags flags;
Window drawable; /* == None except in expose */
int xoffset, yoffset; /* add to frame coords to get drawable coords */
Display *display;
Screen *screen;
Visual *visual;
int depth;
const char *title;
const MetaUIColors *colors;
MetaFrameControl current_control;
MetaUIState current_control_state;
/* Equal to child size before fill_frame_geometry
* has been called
*/
int width;
int height;
};
struct _MetaFrameGeometry
{
/* border sizes (space between frame and child) */
int left_width;
int right_width;
int top_height;
int bottom_height;
/* background color */
unsigned long background_pixel;
Pixmap shape_mask;
/* FIXME shape region? */
};
struct _MetaThemeEngine
{
void (* unload_engine) (void);
/* returns frame_data to use */
gpointer (* acquire_frame) (MetaFrameInfo *info);
/* should free frame_data */
void (* release_frame) (MetaFrameInfo *info,
gpointer frame_data);
void (* fill_frame_geometry) (MetaFrameInfo *info,
MetaFrameGeometry *geom,
gpointer frame_data);
void (* expose_frame) (MetaFrameInfo *info,
int x, int y,
int width, int height,
gpointer frame_data);
MetaFrameControl (* get_control) (MetaFrameInfo *info,
int x, int y,
gpointer frame_data);
void (* get_control_rect) (MetaFrameInfo *info,
MetaFrameControl control,
int *x, int *y,
int *width, int *height,
gpointer frame_data);
};
extern MetaThemeEngine meta_default_engine;
GdkPixbuf* meta_theme_get_gradient (MetaGradientType type,
const GdkColor *color_one,
const GdkColor *color_two,
int width,
int height);
#endif

View File

@ -175,6 +175,9 @@ topic_name (MetaDebugTopic topic)
case META_DEBUG_FOCUS:
return "FOCUS";
break;
case META_DEBUG_GRADIENT_CACHE:
return "GRADIENT_CACHE";
break;
}
return "Window manager";

View File

@ -45,7 +45,8 @@ void meta_fatal (const char *format,
typedef enum
{
META_DEBUG_FOCUS
META_DEBUG_FOCUS,
META_DEBUG_GRADIENT_CACHE
} MetaDebugTopic;