Commit 5fd26a27 authored by rhp's avatar rhp
Browse files

...

parent d090d9f2
......@@ -2,6 +2,8 @@
INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\"
metacity_SOURCES= \
core.c \
core.h \
display.c \
display.h \
errors.c \
......@@ -16,14 +18,14 @@ metacity_SOURCES= \
keybindings.h \
main.c \
main.h \
menu.c \
menu.h \
screen.c \
screen.h \
session.c \
session.h \
stack.c \
stack.h \
ui.c \
ui.h \
util.c \
util.h \
window.c \
......
......@@ -20,7 +20,7 @@
*/
#include "core.h"
#include "display.h"
#include "frame.h"
void
meta_core_get_frame_size (Display *xdisplay,
......@@ -43,10 +43,9 @@ meta_core_get_frame_size (Display *xdisplay,
*height = window->frame->rect.height;
}
void
MetaFrameFlags
meta_core_get_frame_flags (Display *xdisplay,
Window frame_xwindow,
MetaFrameFlags flags)
Window frame_xwindow)
{
MetaDisplay *display;
MetaWindow *window;
......@@ -59,3 +58,21 @@ meta_core_get_frame_flags (Display *xdisplay,
return meta_frame_get_flags (window->frame);
}
void
meta_core_queue_frame_resize (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);
if (window == NULL || window->frame == NULL)
meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
g_warning ("FIXME");
}
......@@ -33,8 +33,10 @@ void meta_core_get_frame_size (Display *xdisplay,
int *width,
int *height);
void meta_core_get_frame_flags (Display *xdisplay,
Window frame_xwindow,
MetaFrameFlags flags);
MetaFrameFlags meta_core_get_frame_flags (Display *xdisplay,
Window frame_xwindow);
void meta_core_queue_frame_resize (Display *xdisplay,
Window frame_xwindow);
#endif
......@@ -197,9 +197,9 @@ meta_display_open (const char *name)
*/
display->leader_window = None;
screens = NULL;
#if 0
/* disable multihead pending GTK support */
screens = NULL;
i = 0;
while (i < ScreenCount (xdisplay))
{
......@@ -212,9 +212,12 @@ meta_display_open (const char *name)
++i;
}
#else
screen = meta_screen_new (display, DefaultScreen (xdisplay));
if (screen)
screens = g_slist_prepend (screens, screen);
{
MetaScreen *screen;
screen = meta_screen_new (display, DefaultScreen (xdisplay));
if (screen)
screens = g_slist_prepend (screens, screen);
}
#endif
if (screens == NULL)
......@@ -753,7 +756,7 @@ event_get_modified_window (MetaDisplay *display,
static const char*
focus_detail (int d)
{
const char *detail = "(????)";
const char *detail = "???";
switch (d)
{
case NotifyAncestor:
......@@ -788,7 +791,7 @@ focus_detail (int d)
static const char*
focus_mode (int m)
{
const char *mode = "(????)";
const char *mode = "???";
switch (m)
{
case NotifyNormal:
......@@ -959,7 +962,7 @@ meta_spew_event (MetaDisplay *display,
else if (event->xproperty.state == PropertyDelete)
state = "PropertyDelete";
else
state = "(????)";
state = "???";
extra = g_strdup_printf ("atom: %s state: %s",
str ? str : "(unknown atom)",
......
......@@ -26,6 +26,17 @@
#include <X11/Xlib.h>
#include "eventqueue.h"
/* this doesn't really belong here, oh well. */
typedef struct _MetaRectangle MetaRectangle;
struct _MetaRectangle
{
int x;
int y;
int width;
int height;
};
typedef struct _MetaDisplay MetaDisplay;
typedef struct _MetaFrame MetaFrame;
typedef struct _MetaScreen MetaScreen;
......@@ -109,7 +120,6 @@ MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display,
Screen *screen);
void meta_display_grab (MetaDisplay *display);
void meta_display_ungrab (MetaDisplay *display);
PangoContext* meta_display_get_pango_context (MetaDisplay *display);
gboolean meta_display_is_double_click (MetaDisplay *display);
/* A given MetaWindow may have various X windows that "belong"
......
......@@ -21,7 +21,6 @@
#include "frame.h"
#include "errors.h"
#include "uislave.h"
void
meta_window_ensure_frame (MetaWindow *window)
......@@ -103,7 +102,6 @@ void
meta_window_destroy_frame (MetaWindow *window)
{
MetaFrame *frame;
MetaFrameInfo info;
if (window->frame == NULL)
return;
......@@ -156,7 +154,7 @@ meta_frame_get_flags (MetaFrame *frame)
flags |= META_FRAME_ALLOWS_DELETE;
if (frame->window->type == META_WINDOW_NORMAL)
flags |= (META_FRAME_ALLOWS_ICONIFY | META_FRAME_ALLOWS_MAXIMIZE);
flags |= (META_FRAME_ALLOWS_MINIMIZE | META_FRAME_ALLOWS_MAXIMIZE);
if (!frame->window->has_maximize_func)
flags &= ~META_FRAME_ALLOWS_MAXIMIZE;
......@@ -172,6 +170,8 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->on_all_workspaces)
flags |= META_FRAME_STUCK;
return flags;
}
void
......@@ -210,12 +210,11 @@ meta_frame_sync_to_window (MetaFrame *frame,
gboolean need_move,
gboolean need_resize)
{
meta_verbose ("Syncing frame geometry %d,%d %dx%d (SE: %d,%d) pixel %ld\n",
meta_verbose ("Syncing frame geometry %d,%d %dx%d (SE: %d,%d)\n",
frame->rect.x, frame->rect.y,
frame->rect.width, frame->rect.height,
frame->rect.x + frame->rect.width,
frame->rect.y + frame->rect.height,
frame->bg_pixel);
frame->rect.y + frame->rect.height);
/* set bg to none to avoid flicker */
if (need_resize)
......
......@@ -24,6 +24,8 @@
#include "window.h"
typedef struct _MetaFrameGeometry MetaFrameGeometry;
struct _MetaFrameGeometry
{
/* border sizes (space between frame and child) */
......
This diff is collapsed.
......@@ -49,16 +49,16 @@ typedef enum
*/
#define META_TYPE_FRAMES (meta_frames_get_type ())
#define META_FRAMES(obj) (META_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
#define META_FRAMES_CLASS(klass) (META_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
#define META_IS_FRAMES(obj) (META_CHECK_TYPE ((obj), META_TYPE_FRAMES))
#define META_IS_FRAMES_CLASS(klass) (META_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
#define META_FRAMES_GET_CLASS(obj) (META_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
#define META_FRAMES(obj) (GTK_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
#define META_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
#define META_IS_FRAMES(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_FRAMES))
#define META_IS_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
#define META_FRAMES_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
typedef struct _MetaFrames MetaFrames;
typedef struct _MetaFramesClass MetaFramesClass;
typedef struct _MetaFrame MetaFrame;
typedef struct _MetaUIFrame MetaUIFrame;
typedef struct _MetaFrameProperties MetaFrameProperties;
struct _MetaFrames
......@@ -99,10 +99,6 @@ void meta_frames_get_geometry (MetaFrames *frames,
void meta_frames_reset_bg (MetaFrames *frames,
Window xwindow);
void meta_frames_set_flags (MetaFrames *frames,
Window xwindow,
MetaFrameFlags flags);
void meta_frames_queue_draw (MetaFrames *frames,
Window xwindow);
......
......@@ -25,6 +25,8 @@
#include "errors.h"
#include "ui.h"
#include <glib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <stdio.h>
......
......@@ -98,7 +98,6 @@ meta_screen_new (MetaDisplay *display,
Window xroot;
Display *xdisplay;
Cursor cursor;
XGCValues vals;
/* Only display->name, display->xdisplay, and display->error_traps
* can really be used in this function, since normally screens are
......@@ -147,12 +146,7 @@ meta_screen_new (MetaDisplay *display,
screen->number = number;
screen->screen_name = get_screen_name (display, number);
screen->xscreen = ScreenOfDisplay (xdisplay, number);
screen->xroot = xroot;
screen->pango_context = NULL;
screen->engine = &meta_default_engine;
screen->showing_tooltip = FALSE;
screen->xroot = xroot;
if (display->leader_window == None)
display->leader_window = XCreateSimpleWindow (display->xdisplay,
......@@ -173,24 +167,13 @@ meta_screen_new (MetaDisplay *display,
meta_workspace_new (screen);
meta_workspace_new (screen);
meta_workspace_new (screen);
meta_screen_init_visual_info (screen);
meta_screen_init_ui_colors (screen);
meta_screen_grab_keys (screen);
screen->scratch_gc = XCreateGC (screen->display->xdisplay,
screen->xroot,
0,
&vals);
screen->ui = meta_ui_new (screen->display,
screen->ui = meta_ui_new (screen->display->xdisplay,
screen->xscreen);
screen->stack = meta_stack_new (screen);
/* hack pango to get its coverage window */
meta_screen_get_pango_context (screen, NULL, PANGO_DIRECTION_LTR);
meta_verbose ("Added screen %d ('%s') root 0x%lx\n",
screen->number, screen->screen_name, screen->xroot);
......@@ -203,15 +186,10 @@ meta_screen_free (MetaScreen *screen)
{
meta_screen_ungrab_keys (screen);
meta_ui_slave_free (screen->uislave);
meta_ui_free (screen->ui);
meta_stack_free (screen->stack);
XFreeGC (screen->display->xdisplay,
screen->scratch_gc);
if (screen->pango_context)
g_object_unref (G_OBJECT (screen->pango_context));
g_free (screen->screen_name);
g_free (screen);
}
......@@ -255,129 +233,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
XFree (children);
}
static GC
get_gc_func (PangoContext *context, PangoColor *color, GC base_gc)
{
MetaScreen *screen;
GC new_gc;
XGCValues vals;
int copy_mask = (GCFunction | GCPlaneMask | GCForeground | GCBackground |
GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle |
GCFillStyle | GCFillRule | GCTile | GCStipple | GCTileStipXOrigin |
GCTileStipYOrigin | GCFont | GCSubwindowMode |
GCGraphicsExposures | GCClipXOrigin | GCClipYOrigin |
GCDashOffset | GCArcMode);
screen = g_object_get_data (G_OBJECT (context), "meta-screen");
new_gc = XCreateGC (screen->display->xdisplay,
screen->xroot,
0,
&vals);
XCopyGC (screen->display->xdisplay, base_gc, copy_mask, new_gc);
vals.foreground = meta_screen_get_x_pixel (screen, color);
XChangeGC (screen->display->xdisplay, new_gc, GCForeground, &vals);
return new_gc;
}
static void
free_gc_func (PangoContext *context, GC gc)
{
MetaScreen *screen;
screen = g_object_get_data (G_OBJECT (context), "meta-screen");
XFreeGC (screen->display->xdisplay, gc);
}
static char*
get_default_language (void)
{
/* Copied from GTK, Copyright 2001 Red Hat Inc. */
gchar *lang;
gchar *p;
lang = g_strdup (setlocale (LC_CTYPE, NULL));
p = strchr (lang, '.');
if (p)
*p = '\0';
p = strchr (lang, '@');
if (p)
*p = '\0';
return lang;
}
PangoContext*
meta_screen_get_pango_context (MetaScreen *screen,
const PangoFontDescription *desc,
PangoDirection direction)
{
if (screen->pango_context == NULL)
{
PangoContext *ctx;
char *lang;
/* Copied from GDK, Copyright 2001 Red Hat, Inc. */
#ifdef HAVE_XFT
static int use_xft = -1;
if (use_xft == -1)
{
char *val = g_getenv ("META_USE_XFT");
use_xft = val && (atoi (val) != 0);
}
if (use_xft)
ctx = pango_xft_get_context (screen->display, screen->number);
else
#endif /* HAVE_XFT */
ctx = pango_x_get_context (screen->display->xdisplay);
g_object_set_data (G_OBJECT (ctx), "meta-screen", screen);
pango_x_context_set_funcs (ctx, get_gc_func, free_gc_func);
lang = get_default_language ();
pango_context_set_lang (ctx, lang);
g_free (lang);
/* FIXME these two lines are wrong;
* we should be storing a context for each direction/desc,
* so that the args to meta_screen_get_pango_context()
* are honored.
*/
pango_context_set_base_dir (ctx, direction);
if (desc == NULL)
{
desc = pango_font_description_from_string ("Sans 12");
pango_context_set_font_description (ctx, desc);
pango_font_description_free (desc);
}
else
{
pango_context_set_font_description (ctx, desc);
}
{
/* Make Pango grab server now not later */
PangoLayout *hack;
hack = pango_layout_new (ctx);
pango_layout_set_text (hack, "foo", -1);
pango_layout_get_extents (hack, NULL, NULL);
g_object_unref (G_OBJECT (hack));
}
screen->pango_context = ctx;
}
return screen->pango_context;
}
MetaScreen*
meta_screen_for_x_screen (Screen *xscreen)
{
......@@ -495,27 +350,6 @@ meta_screen_queue_frame_redraws (MetaScreen *screen)
}
void
meta_screen_show_tip (MetaScreen *screen,
int root_x,
int root_y,
const char *markup)
{
/* even if screen->showing_tip, may change position/text */
meta_ui_slave_show_tip (screen->uislave, root_x, root_y, markup);
screen->showing_tooltip = TRUE;
}
void
meta_screen_hide_tip (MetaScreen *screen)
{
if (screen->showing_tooltip)
{
meta_ui_slave_hide_tip (screen->uislave);
screen->showing_tooltip = FALSE;
}
}
int
meta_screen_get_n_workspaces (MetaScreen *screen)
{
......
......@@ -23,7 +23,6 @@
#define META_SCREEN_H
#include "display.h"
#include "theme.h"
#include <X11/Xutil.h>
#include "ui.h"
......@@ -37,25 +36,9 @@ struct _MetaScreen
char *screen_name;
Screen *xscreen;
Window xroot;
MetaThemeEngine *engine;
MetaUI *ui;
MetaWorkspace *active_workspace;
XVisualInfo visual_info;
MetaUIColors colors;
/* In screen's visual, no guarantees about colors, shouldn't be
* left with a clip.
*/
GC scratch_gc;
guint showing_tooltip : 1;
/* we only need one since we only draw to a single visual (that of
* root window)
*/
PangoContext *pango_context;
MetaStack *stack;
};
......@@ -64,19 +47,11 @@ MetaScreen* meta_screen_new (MetaDisplay *displ
int number);
void meta_screen_free (MetaScreen *screen);
void meta_screen_manage_all_windows (MetaScreen *screen);
PangoContext* meta_screen_get_pango_context (MetaScreen *screen,
const PangoFontDescription *desc,
PangoDirection direction);
MetaScreen* meta_screen_for_x_screen (Screen *xscreen);
void meta_screen_foreach_window (MetaScreen *screen,
MetaScreenWindowFunc func,
gpointer data);
void meta_screen_queue_frame_redraws (MetaScreen *screen);
void meta_screen_show_tip (MetaScreen *screen,
int root_x,
int root_y,
const char *markup);
void meta_screen_hide_tip (MetaScreen *screen);
int meta_screen_get_n_workspaces (MetaScreen *screen);
......
......@@ -21,6 +21,7 @@
#include "ui.h"
#include "frames.h"
#include "util.h"
struct _MetaUI
{
......@@ -32,7 +33,8 @@ struct _MetaUI
void
meta_ui_init (int *argc, char ***argv)
{
gtk_init (argc, argv);
if (!gtk_init_check (argc, argv))
meta_fatal ("Unable to open X display %s\n", gdk_display_name);
}
MetaUI*
......@@ -93,14 +95,6 @@ meta_ui_reset_frame_bg (MetaUI *ui,
meta_frames_reset_bg (ui->frames, xwindow);
}
void
meta_ui_set_frame_flags (MetaUI *ui,
Window xwindow,
MetaFrameFlags flags)
{
meta_frames_set_flags (ui->frames, xwindow, flags);
}
void
meta_ui_queue_frame_draw (MetaUI *ui,
Window xwindow)
......
......@@ -23,7 +23,7 @@
#define META_UI_H
/* Don't include gtk.h here */
#include "window.h"
#include "common.h"
typedef struct _MetaUI MetaUI;
......@@ -46,10 +46,6 @@ void meta_ui_remove_frame (MetaUI *ui,
void meta_ui_reset_frame_bg (MetaUI *ui,
Window xwindow);
void meta_ui_set_frame_flags (MetaUI *ui,
Window xwindow,
MetaFrameFlags flags);
void meta_ui_queue_frame_draw (MetaUI *ui,
Window xwindow);
......
......@@ -24,16 +24,6 @@
#include <glib.h>
typedef struct _MetaRectangle MetaRectangle;
struct _MetaRectangle
{
int x;
int y;
int width;
int height;
};
gboolean meta_is_verbose (void);
void meta_set_verbose (gboolean setting);
gboolean meta_is_debugging (void);
......@@ -61,3 +51,5 @@ void meta_pop_no_msg_prefix (void);
#define _(x) x
#endif
......@@ -903,7 +903,6 @@ meta_window_move_resize_internal (MetaWindow *window,
window->frame->child_y = fgeom.top_height;
window->frame->right_width = fgeom.right_width;
window->frame->bottom_height = fgeom.bottom_height;
window->frame->bg_pixel = fgeom.background_pixel;
}
/* See ICCCM 4.1.5 for when to send ConfigureNotify */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment