Add multi-screen support. Also add patch by Erwann Chenede to make

2002-05-08  Anders Carlsson  <andersca@gnu.org>

	* configure.in:
	* src/display.c: (meta_display_open):
	* src/fixedtip.c: (meta_fixed_tip_show):
	* src/fixedtip.h:
	* src/frames.c: (meta_frames_new), (show_tip_now):
	* src/frames.h:
	* src/menu.c: (meta_window_menu_new):
	* src/ui.c: (meta_ui_new):
	Add multi-screen support. Also add patch by Erwann Chenede
	to make tooltips appear on the correct screen.
This commit is contained in:
Anders Carlsson 2002-05-08 16:24:28 +00:00 committed by Anders Carlsson
parent 3f7203a3a4
commit 0494b044d5
9 changed files with 54 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2002-05-08 Anders Carlsson <andersca@gnu.org>
* configure.in:
* src/display.c: (meta_display_open):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/fixedtip.h:
* src/frames.c: (meta_frames_new), (show_tip_now):
* src/frames.h:
* src/menu.c: (meta_window_menu_new):
* src/ui.c: (meta_ui_new):
Add multi-screen support. Also add patch by Erwann Chenede
to make tooltips appear on the correct screen.
2002-05-07 Anders Carlsson <andersca@gnu.org> 2002-05-07 Anders Carlsson <andersca@gnu.org>
* src/workspace.c (set_work_area_hint): Doh, only update * src/workspace.c (set_work_area_hint): Doh, only update

View File

@ -89,6 +89,10 @@ PKG_CHECK_MODULES(METACITY, gtk+-2.0 >= 2.0.0 gconf-2.0 >= 1.1.9)
PKG_CHECK_MODULES(METACITY_MESSAGE, gtk+-2.0 >= 2.0.0) PKG_CHECK_MODULES(METACITY_MESSAGE, gtk+-2.0 >= 2.0.0)
PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 2.0.0) PKG_CHECK_MODULES(METACITY_WINDOW_DEMO, gtk+-2.0 >= 2.0.0)
if $PKG_CONFIG --atleast-version 2.1.0 gtk+-2.0; then
AC_DEFINE(HAVE_GTK_MULTIHEAD,,[gtk+ with multihead support found])
fi
AC_PATH_XTRA AC_PATH_XTRA
CFLAGS="$METACITY_CFLAGS $CFLAGS $X_CFLAGS" CFLAGS="$METACITY_CFLAGS $CFLAGS $X_CFLAGS"

View File

@ -323,8 +323,9 @@ meta_display_open (const char *name)
display->no_focus_window = None; display->no_focus_window = None;
screens = NULL; screens = NULL;
#if 0
/* disable multihead pending GTK support */ #ifdef HAVE_GTK_MULTIHEAD
i = 0; i = 0;
while (i < ScreenCount (xdisplay)) while (i < ScreenCount (xdisplay))
{ {

View File

@ -36,13 +36,16 @@ expose_handler (GtkTooltips *tooltips)
} }
void void
meta_fixed_tip_show (Display *xdisplay, meta_fixed_tip_show (Display *xdisplay, int screen_number,
int root_x, int root_y, int root_x, int root_y,
const char *markup_text) const char *markup_text)
{ {
if (tip == NULL) if (tip == NULL)
{ {
tip = gtk_window_new (GTK_WINDOW_POPUP); tip = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_screen (GTK_WINDOW (tip),
gdk_display_get_screen (gdk_get_default_display (),
screen_number));
gtk_widget_set_app_paintable (tip, TRUE); gtk_widget_set_app_paintable (tip, TRUE);
gtk_window_set_policy (GTK_WINDOW (tip), FALSE, FALSE, TRUE); gtk_window_set_policy (GTK_WINDOW (tip), FALSE, FALSE, TRUE);
gtk_widget_set_name (tip, "gtk-tooltips"); gtk_widget_set_name (tip, "gtk-tooltips");

View File

@ -25,7 +25,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
void meta_fixed_tip_show (Display *xdisplay, void meta_fixed_tip_show (Display *xdisplay, int screen_number,
int root_x, int root_y, int root_x, int root_y,
const char *markup_text); const char *markup_text);
void meta_fixed_tip_hide (void); void meta_fixed_tip_hide (void);

View File

@ -400,9 +400,22 @@ meta_frames_calc_geometry (MetaFrames *frames,
} }
MetaFrames* MetaFrames*
meta_frames_new (void) meta_frames_new (int screen_number)
{ {
return g_object_new (META_TYPE_FRAMES, NULL); #ifdef HAVE_GTK_MULTIHEAD
GdkScreen *screen;
screen = gdk_display_get_screen (gdk_get_default_display (),
screen_number);
return g_object_new (META_TYPE_FRAMES,
"screen", screen,
NULL);
#else
return g_object_new (META_TYPE_FRAMES,
NULL);
#endif
} }
void void
@ -706,6 +719,7 @@ show_tip_now (MetaFrames *frames)
MetaFrameGeometry fgeom; MetaFrameGeometry fgeom;
GdkRectangle *rect; GdkRectangle *rect;
int dx, dy; int dx, dy;
int screen_number;
meta_frames_calc_geometry (frames, frame, &fgeom); meta_frames_calc_geometry (frames, frame, &fgeom);
@ -714,8 +728,13 @@ show_tip_now (MetaFrames *frames)
/* get conversion delta for root-to-frame coords */ /* get conversion delta for root-to-frame coords */
dx = root_x - x; dx = root_x - x;
dy = root_y - y; dy = root_y - y;
#ifdef HAVE_GTK_MULTIHEAD
screen_number = gdk_screen_get_number (gtk_widget_get_screen (GTK_WIDGET (frames)));
#else
screen_number = XScreenNumberOfScreen (DefaultScreen (gdk_display));
#endif
meta_fixed_tip_show (gdk_display, meta_fixed_tip_show (gdk_display,
screen_number,
rect->x + dx, rect->x + dx,
rect->y + rect->height + 2 + dy, rect->y + rect->height + 2 + dy,
tiptext); tiptext);

View File

@ -99,7 +99,7 @@ struct _MetaFramesClass
GType meta_frames_get_type (void) G_GNUC_CONST; GType meta_frames_get_type (void) G_GNUC_CONST;
MetaFrames *meta_frames_new (void); MetaFrames *meta_frames_new (int screen_number);
void meta_frames_manage_window (MetaFrames *frames, void meta_frames_manage_window (MetaFrames *frames,
Window xwindow); Window xwindow);

View File

@ -175,7 +175,10 @@ meta_window_menu_new (MetaFrames *frames,
menu->insensitive = insensitive; menu->insensitive = insensitive;
menu->menu = gtk_menu_new (); menu->menu = gtk_menu_new ();
#ifdef HAVE_GTK_MULTIHEAD
gtk_menu_set_screen (GTK_MENU (menu->menu),
gtk_widget_get_screen (GTK_WIDGET (frames)));
#endif
i = 0; i = 0;
while (i < (int) G_N_ELEMENTS (menuitems)) while (i < (int) G_N_ELEMENTS (menuitems))
{ {

View File

@ -141,8 +141,8 @@ meta_ui_new (Display *xdisplay,
ui->xdisplay = xdisplay; ui->xdisplay = xdisplay;
ui->xscreen = screen; ui->xscreen = screen;
/* FIXME when gtk has multihead use it here */ g_assert (xdisplay == gdk_display);
ui->frames = meta_frames_new (); ui->frames = meta_frames_new (XScreenNumberOfScreen (screen));
gtk_widget_realize (GTK_WIDGET (ui->frames)); gtk_widget_realize (GTK_WIDGET (ui->frames));
return ui; return ui;