put in attempted fix for the GTK 1.2 plug/socket screwup, now that my

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

	* src/window.c (meta_window_notify_focus): put in attempted fix
	for the GTK 1.2 plug/socket screwup, now that my fixed debug spew
	reveals what's actually happening. ;-)

	* src/gradient.c (meta_gradient_description_new): object
	to store gradient descriptions

	* src/window.c (meta_window_notify_focus): fix the debug spew
	that was confusing me

	* src/wm-tester/focus-window.c: add little program to focus
	a window ID
This commit is contained in:
Havoc Pennington 2002-01-07 03:26:09 +00:00 committed by Havoc Pennington
parent ac85e1e225
commit f36ba88085
8 changed files with 144 additions and 114 deletions

View File

@ -1,3 +1,18 @@
2002-01-06 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_notify_focus): put in attempted fix
for the GTK 1.2 plug/socket screwup, now that my fixed debug spew
reveals what's actually happening. ;-)
* src/gradient.c (meta_gradient_description_new): object
to store gradient descriptions
* src/window.c (meta_window_notify_focus): fix the debug spew
that was confusing me
* src/wm-tester/focus-window.c: add little program to focus
a window ID
2002-01-06 Havoc Pennington <hp@pobox.com>
* src/theme.c (meta_theme_get_gradient): change to use spiffy

View File

@ -736,118 +736,39 @@ meta_gradient_create_multi_diagonal (int width, int height,
return pixbuf;
}
#ifdef META_TEST_GRADIENTS
#include <gtk/gtk.h>
typedef void (* RenderGradientFunc) (GdkDrawable *drawable,
GdkGC *gc,
int width,
int height);
static void
render_simple (GdkDrawable *drawable,
GdkGC *gc,
int width, int height,
MetaGradientType type)
MetaGradientDescription*
meta_gradient_description_new (MetaGradientType type,
const GdkColor *colors,
int n_colors)
{
GdkPixbuf *pixbuf;
GdkColor from, to;
MetaGradientDescription *desc;
gdk_color_parse ("blue", &from);
gdk_color_parse ("green", &to);
desc = g_new (MetaGradientDescription, 1);
pixbuf = meta_gradient_create_simple (width, height,
&from, &to,
type);
desc->type = type;
desc->colors = g_new (GdkColor, n_colors);
desc->n_colors = n_colors;
gdk_pixbuf_render_to_drawable (pixbuf,
drawable,
gc,
0, 0,
0, 0, width, height,
GDK_RGB_DITHER_NORMAL,
0, 0);
memcpy (desc->colors, colors, sizeof (GdkColor) * n_colors);
g_object_unref (G_OBJECT (pixbuf));
}
static void
render_vertical_func (GdkDrawable *drawable,
GdkGC *gc,
int width, int height)
{
render_simple (drawable, gc, width, height, META_GRADIENT_VERTICAL);
}
static void
render_horizontal_func (GdkDrawable *drawable,
GdkGC *gc,
int width, int height)
{
render_simple (drawable, gc, width, height, META_GRADIENT_HORIZONTAL);
}
static void
render_diagonal_func (GdkDrawable *drawable,
GdkGC *gc,
int width, int height)
{
render_simple (drawable, gc, width, height, META_GRADIENT_DIAGONAL);
}
static gboolean
expose_callback (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
RenderGradientFunc func = data;
(* func) (widget->window,
widget->style->fg_gc[widget->state],
widget->allocation.width,
widget->allocation.height);
return TRUE;
}
static GtkWidget*
create_gradient_window (RenderGradientFunc func)
{
GtkWidget *window;
GtkWidget *drawing_area;
window = gtk_window_new (GTK_WINDOW_POPUP);
drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (drawing_area, 175, 175);
g_signal_connect (G_OBJECT (drawing_area),
"expose_event",
G_CALLBACK (expose_callback),
func);
gtk_container_add (GTK_CONTAINER (window), drawing_area);
return window;
return desc;
}
void
meta_gradient_test (void)
meta_gradient_description_free (MetaGradientDescription *desc)
{
GtkWidget *window;
g_return_if_fail (desc != NULL);
window = create_gradient_window (render_vertical_func);
gtk_window_move (GTK_WINDOW (window), 0, 0);
gtk_widget_show_all (window);
window = create_gradient_window (render_horizontal_func);
gtk_window_move (GTK_WINDOW (window), 0, 200);
gtk_widget_show_all (window);
window = create_gradient_window (render_diagonal_func);
gtk_window_move (GTK_WINDOW (window), 200, 0);
gtk_widget_show_all (window);
g_free (desc->colors);
g_free (desc);
}
#endif
GdkPixbuf*
meta_gradient_description_render (const MetaGradientDescription *desc,
int width,
int height)
{
return meta_gradient_create_multi (width, height,
desc->colors, desc->n_colors,
desc->type);
}

View File

@ -32,6 +32,26 @@ typedef enum
META_GRADIENT_DIAGONAL
} MetaGradientType;
typedef struct _MetaGradientDescription MetaGradientDescription;
/* this doesn't support interwoven at the moment, since
* I don't know what interwoven is good for
*/
struct _MetaGradientDescription
{
MetaGradientType type;
GdkColor *colors;
int n_colors;
};
MetaGradientDescription* meta_gradient_description_new (MetaGradientType type,
const GdkColor *colors,
int n_colors);
void meta_gradient_description_free (MetaGradientDescription *desc);
GdkPixbuf* meta_gradient_description_render (const MetaGradientDescription *desc,
int width,
int height);
GdkPixbuf* meta_gradient_create_simple (int width,
int height,

View File

@ -1,5 +1,13 @@
#! /bin/bash
if test -z "$XNEST_DISPLAY"; then
XNEST_DISPLAY=:1
fi
if test -z "$CLIENT_DISPLAY"; then
CLIENT_DISPLAY=:1
fi
if test -z "$SCREENS"; then
SCREENS=1
fi
@ -27,33 +35,41 @@ if test -n "$ICON_TEST"; then
fi
if test -z "$ONLY_WM"; then
Xnest -ac :1 -scrns $SCREENS -geometry 640x480 -bw 15 &
echo "Launching Xnest"
Xnest -ac $XNEST_DISPLAY -scrns $SCREENS -geometry 640x480 -bw 15 &
## usleep 800000
sleep 1
if test -n "$XMON_DIR"; then
echo "Launching xmond"
$XMON_DIR/xmonui | $XMON_DIR/xmond -server $XNEST_DISPLAY &
sleep 1
fi
echo "Launching clients"
if test -n "$TEST_CLIENT"; then
DISPLAY=:1 $TEST_CLIENT &
DISPLAY=$CLIENT_DISPLAY $TEST_CLIENT &
fi
if test $CLIENTS != 0; then
for I in `seq 1 $CLIENTS`; do
echo "Launching xterm $I"
DISPLAY=:1 xterm -geometry 25x15 &
DISPLAY=$CLIENT_DISPLAY xterm -geometry 25x15 &
done
fi
if test $SM_CLIENTS != 0; then
for I in `seq 1 $SM_CLIENTS`; do
echo "Launching gnome-terminal $I"
DISPLAY=:1 gnome-terminal --geometry 25x15 &
DISPLAY=$CLIENT_DISPLAY gnome-terminal --geometry 25x15 &
done
fi
usleep 50000
DISPLAY=:1 xsetroot -solid royalblue3
DISPLAY=$CLIENT_DISPLAY xsetroot -solid royalblue3
fi
if test -z "$ONLY_SETUP"; then
METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=:1 exec libtool --mode=execute $DEBUG ./metacity $OPTIONS
METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=$CLIENT_DISPLAY exec libtool --mode=execute $DEBUG ./metacity $OPTIONS
fi

View File

@ -28,7 +28,14 @@
/* theme.[hc] is basically responsible for drawing parts of the UI using
* theme data
*/
typedef struct _MetaFrameStyle MetaFrameStyle;
struct _MetaFrameStyle
{
MetaGradientDescription *title_gradient;
};
GdkPixbuf* meta_theme_get_gradient (MetaGradientType type,
const GdkColor *color_one,

View File

@ -2683,13 +2683,13 @@ meta_window_notify_focus (MetaWindow *window,
event->type != UnmapNotify ?
meta_focus_mode_to_string (event->xfocus.mode) : "n/a",
event->type != UnmapNotify ?
meta_focus_detail_to_string (event->xfocus.mode) : "n/a");
meta_focus_detail_to_string (event->xfocus.detail) : "n/a");
if ((event->type == FocusIn ||
event->type == FocusOut) &&
(event->xfocus.mode == NotifyGrab ||
event->xfocus.mode == NotifyUngrab ||
/* From WindowMaker */
/* From WindowMaker, ignore all funky pointer root events */
event->xfocus.detail > NotifyNonlinearVirtual))
{
meta_topic (META_DEBUG_FOCUS,
@ -2720,6 +2720,16 @@ meta_window_notify_focus (MetaWindow *window,
else if (event->type == FocusOut ||
event->type == UnmapNotify)
{
if (event->type == FocusOut &&
event->xfocus.detail == NotifyInferior)
{
/* This event means the client moved focus to a subwindow */
meta_topic (META_DEBUG_FOCUS,
"Ignoring focus out on %s with NotifyInferior\n",
window->desc);
return TRUE;
}
if (window == window->display->focus_window)
{
meta_topic (META_DEBUG_FOCUS,

View File

@ -7,7 +7,11 @@ wm_tester_SOURCES= \
test_gravity_SOURCES= \
test-gravity.c
noinst_PROGRAMS=wm-tester test-gravity
focus_window_SOURCES= \
focus-window.c
noinst_PROGRAMS=wm-tester test-gravity focus-window
wm_tester_LDADD= @METACITY_LIBS@
test_gravity_LDADD= @METACITY_LIBS@
focus_window_LDADD= @METACITY_LIBS@

View File

@ -0,0 +1,37 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
Display *d;
Window w;
const char *w_str;
char *end;
if (argc != 2)
{
fprintf (stderr, "Usage: focus-window WINDOWID\n");
exit (1);
}
d = XOpenDisplay (NULL);
w_str = argv[1];
end = NULL;
w = strtoul (w_str, &end, 16);
if (end == w_str)
{
fprintf (stderr, "Usage: focus-window WINDOWID\n");
exit (1);
}
printf ("Setting input focus to 0x%lx\n", w);
XSetInputFocus (d, w, RevertToPointerRoot, CurrentTime);
XFlush (d);
return 0;
}