Commit d090d9f2 authored by rhp's avatar rhp
Browse files

...

parent 59513231
/* Metacity common types shared by core.h and ui.h */
/*
* Copyright (C) 2001 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.
*/
#ifndef META_COMMON_H
#define META_COMMON_H
/* Don't include GTK or core headers here */
#include <X11/Xlib.h>
typedef enum
{
META_FRAME_ALLOWS_DELETE = 1 << 0,
META_FRAME_ALLOWS_MENU = 1 << 1,
META_FRAME_ALLOWS_MINIMIZE = 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;
#endif
......@@ -20,4 +20,42 @@
*/
#include "core.h"
#include "display.h"
void
meta_core_get_frame_size (Display *xdisplay,
Window frame_xwindow,
int *width,
int *height)
{
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);
if (width)
*width = window->frame->rect.width;
if (height)
*height = window->frame->rect.height;
}
void
meta_core_get_frame_flags (Display *xdisplay,
Window frame_xwindow,
MetaFrameFlags flags)
{
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);
return meta_frame_get_flags (window->frame);
}
......@@ -26,6 +26,15 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "frames.h"
#include "common.h"
void meta_core_get_frame_size (Display *xdisplay,
Window frame_xwindow,
int *width,
int *height);
void meta_core_get_frame_flags (Display *xdisplay,
Window frame_xwindow,
MetaFrameFlags flags);
#endif
......@@ -24,7 +24,6 @@
#include <glib.h>
#include <X11/Xlib.h>
#include <pango/pangox.h>
#include "eventqueue.h"
typedef struct _MetaDisplay MetaDisplay;
......
This diff is collapsed.
......@@ -24,16 +24,14 @@
#include "window.h"
typedef enum
{
META_FRAME_ACTION_NONE,
META_FRAME_ACTION_MOVING,
META_FRAME_ACTION_DELETING,
META_FRAME_ACTION_TOGGLING_MAXIMIZE,
META_FRAME_ACTION_RESIZING_SE
} MetaFrameAction;
typedef struct _MetaFrameActionGrab MetaFrameActionGrab;
struct _MetaFrameGeometry
{
/* border sizes (space between frame and child) */
int left_width;
int right_width;
int top_height;
int bottom_height;
};
struct _MetaFrame
{
......@@ -47,26 +45,14 @@ struct _MetaFrame
* frame, not the result of ConfigureNotify
*/
MetaRectangle rect;
/* position of client, size of frame */
int child_x;
int child_y;
int right_width;
int bottom_height;
gpointer theme_data;
gulong bg_pixel;
MetaFrameActionGrab *grab;
MetaFrameControl current_control;
guint tooltip_timeout;
guint theme_acquired : 1;
guint mapped : 1;
/* world's lamest expose compression */
guint edges_exposed : 1;
guint title_exposed : 1;
};
void meta_window_ensure_frame (MetaWindow *window);
......@@ -75,10 +61,10 @@ void meta_frame_queue_draw (MetaFrame *frame);
gboolean meta_frame_event (MetaFrame *frame,
XEvent *event);
/* These three should ONLY be called from meta_window_move_resize_internal */
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
/* These should ONLY be called from meta_window_move_resize_internal */
void meta_frame_calc_geometry (MetaFrame *frame,
int child_width,
int child_height,
MetaFrameGeometry *geomp);
void meta_frame_sync_to_window (MetaFrame *frame,
gboolean need_move,
......
This diff is collapsed.
......@@ -24,7 +24,25 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "messages.h"
#include "common.h"
typedef enum
{
META_FRAME_CONTROL_NONE,
META_FRAME_CONTROL_TITLE,
META_FRAME_CONTROL_DELETE,
META_FRAME_CONTROL_MENU,
META_FRAME_CONTROL_MINIMIZE,
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;
/* This is one widget that manages all the window frames
* as subwindows.
......@@ -73,4 +91,19 @@ void meta_frames_set_title (MetaFrames *frames,
Window xwindow,
const char *title);
void meta_frames_get_geometry (MetaFrames *frames,
Window xwindow,
int *top_height, int *bottom_height,
int *left_width, int *right_width);
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);
#endif
......@@ -23,8 +23,6 @@
#include "util.h"
#include "errors.h"
#include "window.h"
#include "colors.h"
#include "uislave.h"
#include "frame.h"
#include "workspace.h"
#include "keybindings.h"
......@@ -35,9 +33,6 @@
#include <locale.h>
#include <string.h>
static void ui_slave_func (MetaUISlave *uislave,
MetaMessage *message,
gpointer data);
static char* get_screen_name (MetaDisplay *display,
int number);
......@@ -188,10 +183,9 @@ meta_screen_new (MetaDisplay *display,
screen->xroot,
0,
&vals);
screen->uislave = meta_ui_slave_new (screen->screen_name,
ui_slave_func,
screen);
screen->ui = meta_ui_new (screen->display,
screen->xscreen);
screen->stack = meta_stack_new (screen);
......@@ -397,37 +391,6 @@ meta_screen_for_x_screen (Screen *xscreen)
return meta_display_screen_for_x_screen (display, xscreen);
}
static void
ui_slave_func (MetaUISlave *uislave,
MetaMessage *message,
gpointer data)
{
switch (message->header.message_code)
{
case MetaMessageCheckCode:
meta_verbose ("Received UI slave check message version: %s host alias: %s messages version: %d\n",
message->check.metacity_version,
message->check.host_alias,
message->check.messages_version);
if (strcmp (message->check.metacity_version, VERSION) != 0 ||
strcmp (message->check.host_alias, HOST_ALIAS) != 0 ||
message->check.messages_version != META_MESSAGES_VERSION)
{
meta_warning ("metacity-uislave has the wrong version; must use the one compiled with metacity\n");
meta_ui_slave_disable (uislave);
}
break;
default:
meta_verbose ("Received unhandled message from UI slave: %d\n",
message->header.message_code);
break;
}
}
static char*
get_screen_name (MetaDisplay *display,
int number)
......
......@@ -25,6 +25,7 @@
#include "display.h"
#include "theme.h"
#include <X11/Xutil.h>
#include "ui.h"
typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
gpointer user_data);
......@@ -37,7 +38,7 @@ struct _MetaScreen
Screen *xscreen;
Window xroot;
MetaThemeEngine *engine;
MetaUISlave *uislave;
MetaUI *ui;
MetaWorkspace *active_workspace;
......
......@@ -20,9 +20,93 @@
*/
#include "ui.h"
#include "frames.h"
struct _MetaUI
{
Display *xdisplay;
Screen *xscreen;
MetaFrames *frames;
};
void
meta_ui_init (int *argc, char ***argv)
{
gtk_init (argc, argv);
}
MetaUI*
meta_ui_new (Display *xdisplay,
Screen *screen)
{
MetaUI *ui;
ui = g_new (MetaUI, 1);
ui->xdisplay = xdisplay;
ui->xscreen = screen;
/* FIXME when gtk has multihead use it here */
ui->frames = meta_frames_new ();
gtk_widget_realize (GTK_WIDGET (ui->frames));
return ui;
}
void
meta_ui_free (MetaUI *ui)
{
gtk_widget_destroy (GTK_WIDGET (ui->frames));
g_free (ui);
}
void
meta_ui_get_frame_geometry (MetaUI *ui,
Window frame_xwindow,
int *top_height, int *bottom_height,
int *left_width, int *right_width)
{
meta_frames_get_geometry (ui->frames, frame_xwindow,
top_height, bottom_height,
left_width, right_width);
}
void
meta_ui_add_frame (MetaUI *ui,
Window xwindow)
{
meta_frames_manage_window (ui->frames, xwindow);
}
void
meta_ui_remove_frame (MetaUI *ui,
Window xwindow)
{
meta_frames_unmanage_window (ui->frames, xwindow);
}
void
meta_ui_reset_frame_bg (MetaUI *ui,
Window xwindow)
{
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)
{
meta_frames_queue_draw (ui->frames, xwindow);
}
......@@ -29,8 +29,28 @@ typedef struct _MetaUI MetaUI;
void meta_ui_init (int *argc, char ***argv);
MetaUI* meta_ui_new (Display *xdisplay);
MetaUI* meta_ui_new (Display *xdisplay,
Screen *screen);
void meta_ui_free (MetaUI *ui);
void meta_ui_get_frame_geometry (MetaUI *ui,
Window frame_xwindow,
int *top_height, int *bottom_height,
int *left_width, int *right_width);
void meta_ui_add_frame (MetaUI *ui,
Window xwindow);
void meta_ui_remove_frame (MetaUI *ui,
Window xwindow);
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);
#endif
......@@ -802,8 +802,6 @@ meta_window_move_resize_internal (MetaWindow *window,
*/
if (window->frame)
meta_frame_calc_geometry (window->frame,
window->rect.width,
window->rect.height,
&fgeom);
constrain_size (window, &fgeom, w, h, &w, &h);
......
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