1
0
Fork 0

fix for bugzilla bug #72314, filter out LeaveNotify caused by grabs when

2002-05-23  Jayaraj Rajappan <jayaraj.rajappan@wipro.com>

	* src/display.c (event_callback): fix for bugzilla bug #72314,
	filter out LeaveNotify caused by grabs when in mouse focus mode.
This commit is contained in:
Jayaraj Rajappan 2002-05-24 02:55:54 +00:00 committed by Havoc Pennington
parent 4e9ac83b15
commit 49fe8f0399
9 changed files with 67 additions and 118 deletions

View file

@ -1,3 +1,8 @@
2002-05-23 Jayaraj Rajappan <jayaraj.rajappan@wipro.com>
* src/display.c (event_callback): fix for bugzilla bug #72314,
filter out LeaveNotify caused by grabs when in mouse focus mode.
2002-05-23 Havoc Pennington <hp@pobox.com>
* src/metacity.schemas: clean up the font preference

View file

@ -1158,7 +1158,9 @@ event_callback (XEvent *event,
* is probably right. Anyway, unfocus the
* focused window.
*/
if (window->has_focus)
if (window->has_focus &&
event->xcrossing.mode != NotifyGrab &&
event->xcrossing.mode != NotifyUngrab)
{
meta_verbose ("Unsetting focus from %s due to LeaveNotify\n",
window->desc);

View file

@ -26,6 +26,7 @@
#include "menu.h"
#include "fixedtip.h"
#include "theme.h"
#include "prefs.h"
#define DEFAULT_INNER_BUTTON_BORDER 3
@ -68,6 +69,7 @@ static void meta_frames_ensure_layout (MetaFrames *frames,
static MetaUIFrame* meta_frames_lookup_window (MetaFrames *frames,
Window xwindow);
static void meta_frames_font_changed (MetaFrames *frames);
static GdkRectangle* control_rect (MetaFrameControl control,
MetaFrameGeometry *fgeom);
@ -154,6 +156,16 @@ unsigned_long_hash (gconstpointer v)
#endif
}
static void
font_changed_callback (MetaPreference pref,
void *data)
{
if (pref == META_PREF_TITLEBAR_FONT)
{
meta_frames_font_changed (META_FRAMES (data));
}
}
static void
meta_frames_init (MetaFrames *frames)
{
@ -168,6 +180,8 @@ meta_frames_init (MetaFrames *frames)
frames->expose_delay_count = 0;
gtk_widget_set_double_buffered (GTK_WIDGET (frames), FALSE);
meta_prefs_add_listener (font_changed_callback, frames);
}
static void
@ -188,6 +202,8 @@ meta_frames_destroy (GtkObject *object)
frames = META_FRAMES (object);
meta_prefs_remove_listener (font_changed_callback, frames);
clear_tip (frames);
winlist = NULL;
@ -258,13 +274,8 @@ queue_recalc_func (gpointer key, gpointer value, gpointer data)
}
static void
meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style)
meta_frames_font_changed (MetaFrames *frames)
{
MetaFrames *frames;
frames = META_FRAMES (widget);
if (g_hash_table_size (frames->text_heights) > 0)
{
g_hash_table_destroy (frames->text_heights);
@ -275,6 +286,18 @@ meta_frames_style_set (GtkWidget *widget,
g_hash_table_foreach (frames->frames,
queue_recalc_func, frames);
}
static void
meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
MetaFrames *frames;
frames = META_FRAMES (widget);
meta_frames_font_changed (frames);
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
}
@ -326,7 +349,8 @@ meta_frames_ensure_layout (MetaFrames *frames,
frame->layout = gtk_widget_create_pango_layout (widget, frame->title);
font_desc = meta_gtk_widget_get_font_desc (widget, scale);
font_desc = meta_gtk_widget_get_font_desc (widget, scale,
meta_prefs_get_titlebar_font ());
size = pango_font_description_get_size (font_desc);
@ -346,25 +370,9 @@ meta_frames_ensure_layout (MetaFrames *frames,
&size,
GINT_TO_POINTER (frame->text_height));
}
if (pango_font_description_get_size (font_desc) !=
pango_font_description_get_size (widget->style->font_desc))
{
PangoAttrList *attrs;
PangoAttribute *attr;
attrs = pango_attr_list_new ();
attr = pango_attr_size_new (pango_font_description_get_size (font_desc));
attr->start_index = 0;
attr->end_index = G_MAXINT;
pango_attr_list_insert (attrs, attr);
pango_layout_set_attributes (frame->layout, attrs);
pango_attr_list_unref (attrs);
}
pango_layout_set_font_description (frame->layout,
font_desc);
pango_font_description_free (font_desc);

View file

@ -69,16 +69,16 @@
</schema>
<schema>
<key>/schemas/apps/metacity/general/titlebar_uses_desktop_font</key>
<applyto>/apps/metacity/general/titlebar_uses_desktop_font</applyto>
<key>/schemas/apps/metacity/general/titlebar_uses_system_font</key>
<applyto>/apps/metacity/general/titlebar_uses_system_font</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Use standard desktop font in window titles</short>
<short>Use standard system font in window titles</short>
<long>
If true, ignore the titlebar_font and titlebar_font_size
options, and use the standard application font for window
If true, ignore the titlebar_font
option, and use the standard application font for window
titles.
</long>
</locale>
@ -105,23 +105,6 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/titlebar_font_size</key>
<applyto>/apps/metacity/general/titlebar_font_size</applyto>
<owner>metacity</owner>
<type>int</type>
<default>0</default>
<locale name="C">
<short>Window title font size</short>
<long>
The size of the font used in window titlebars, in points.
If set to 0, the size comes from the titlebar_font option
or from the desktop-wide default. If set to nonzero,
overrides those sizes.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/num_workspaces</key>
<applyto>/apps/metacity/general/num_workspaces</applyto>

View file

@ -33,9 +33,8 @@
#define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
#define KEY_AUTO_RAISE_DELAY "/apps/metacity/general/auto_raise_delay"
#define KEY_THEME "/apps/metacity/general/theme"
#define KEY_USE_DESKTOP_FONT "/apps/metacity/general/titlebar_uses_desktop_font"
#define KEY_USE_SYSTEM_FONT "/apps/metacity/general/titlebar_uses_system_font"
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
#define KEY_TITLEBAR_FONT_SIZE "/apps/metacity/general/titlebar_font_size"
#define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces"
#define KEY_APPLICATION_BASED "/apps/metacity/general/application_based"
#define KEY_DISABLE_WORKAROUNDS "/apps/metacity/general/disable_workarounds"
@ -47,9 +46,8 @@ static GConfClient *default_client = NULL;
static GList *listeners = NULL;
static GList *changes = NULL;
static guint changed_idle;
static gboolean use_desktop_font = TRUE;
static gboolean use_system_font = TRUE;
static PangoFontDescription *titlebar_font = NULL;
static int titlebar_font_size = 0;
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
static char* current_theme = NULL;
static int num_workspaces = 4;
@ -58,9 +56,8 @@ static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE;
static gboolean auto_raise_delay = 500;
static gboolean update_use_desktop_font (gboolean value);
static gboolean update_use_system_font (gboolean value);
static gboolean update_titlebar_font (const char *value);
static gboolean update_titlebar_font_size (int value);
static gboolean update_focus_mode (const char *value);
static gboolean update_theme (const char *value);
static gboolean update_num_workspaces (int value);
@ -259,15 +256,10 @@ meta_prefs_init (void)
* just lazy. But they keys ought to be set, anyhow.
*/
bool_val = gconf_client_get_bool (default_client, KEY_USE_DESKTOP_FONT,
bool_val = gconf_client_get_bool (default_client, KEY_USE_SYSTEM_FONT,
&err);
cleanup_error (&err);
update_use_desktop_font (bool_val);
int_val = gconf_client_get_int (default_client, KEY_TITLEBAR_FONT_SIZE,
&err);
cleanup_error (&err);
update_titlebar_font_size (int_val);
update_use_system_font (bool_val);
str_val = gconf_client_get_string (default_client, KEY_TITLEBAR_FONT,
&err);
@ -382,30 +374,14 @@ change_notify (GConfClient *client,
if (update_titlebar_font (str))
queue_changed (META_PREF_TITLEBAR_FONT);
}
else if (strcmp (key, KEY_TITLEBAR_FONT_SIZE) == 0)
{
int d;
if (value && value->type != GCONF_VALUE_INT)
{
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
KEY_TITLEBAR_FONT_SIZE);
goto out;
}
d = value ? gconf_value_get_int (value) : 0;
if (update_titlebar_font_size (d))
queue_changed (META_PREF_TITLEBAR_FONT_SIZE);
}
else if (strcmp (key, KEY_USE_DESKTOP_FONT) == 0)
else if (strcmp (key, KEY_USE_SYSTEM_FONT) == 0)
{
gboolean b;
if (value && value->type != GCONF_VALUE_BOOL)
{
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
KEY_USE_DESKTOP_FONT);
KEY_USE_SYSTEM_FONT);
goto out;
}
@ -415,7 +391,7 @@ change_notify (GConfClient *client,
* get_titlebar_font returns NULL, so that's what we queue
* the change on
*/
if (update_use_desktop_font (b))
if (update_use_system_font (b))
queue_changed (META_PREF_TITLEBAR_FONT);
}
else if (strcmp (key, KEY_NUM_WORKSPACES) == 0)
@ -606,11 +582,11 @@ meta_prefs_get_theme (void)
}
static gboolean
update_use_desktop_font (gboolean value)
update_use_system_font (gboolean value)
{
gboolean old = use_desktop_font;
gboolean old = use_system_font;
use_desktop_font = value;
use_system_font = value;
return old != value;
}
@ -650,36 +626,12 @@ update_titlebar_font (const char *value)
const PangoFontDescription*
meta_prefs_get_titlebar_font (void)
{
if (use_desktop_font)
if (use_system_font)
return NULL;
else
return titlebar_font;
}
static gboolean
update_titlebar_font_size (int value)
{
int old = titlebar_font_size;
if (value < 0)
{
meta_warning (_("%d stored in GConf key %s is not a valid font size\n"),
value, KEY_TITLEBAR_FONT_SIZE);
value = 0;
}
titlebar_font_size = value;
return old != titlebar_font_size;
}
int
meta_prefs_get_titlebar_font_size (void)
{
return titlebar_font_size;
}
#define MAX_REASONABLE_WORKSPACES 32
static gboolean
@ -795,9 +747,6 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_TITLEBAR_FONT:
return "TITLEBAR_FONT";
case META_PREF_TITLEBAR_FONT_SIZE:
return "TITLEBAR_FONT_SIZE";
case META_PREF_NUM_WORKSPACES:
return "NUM_WORKSPACES";

View file

@ -33,7 +33,6 @@ typedef enum
META_PREF_AUTO_RAISE_DELAY,
META_PREF_THEME,
META_PREF_TITLEBAR_FONT,
META_PREF_TITLEBAR_FONT_SIZE,
META_PREF_NUM_WORKSPACES,
META_PREF_APPLICATION_BASED,
META_PREF_WINDOW_KEYBINDINGS,
@ -56,8 +55,6 @@ MetaFocusMode meta_prefs_get_focus_mode (void);
const char* meta_prefs_get_theme (void);
/* returns NULL if GTK default should be used */
const PangoFontDescription* meta_prefs_get_titlebar_font (void);
/* returns 0 if default should be used */
int meta_prefs_get_titlebar_font_size (void);
int meta_prefs_get_num_workspaces (void);
gboolean meta_prefs_get_application_based (void);
gboolean meta_prefs_get_disable_workarounds (void);

View file

@ -143,7 +143,7 @@ ensure_info (MetaPreview *preview)
preview->layout = gtk_widget_create_pango_layout (widget,
preview->title);
font_desc = meta_gtk_widget_get_font_desc (widget, scale);
font_desc = meta_gtk_widget_get_font_desc (widget, scale, NULL);
preview->text_height =
meta_pango_font_desc_get_text_height (font_desc,

View file

@ -4671,7 +4671,8 @@ meta_theme_lookup_float_constant (MetaTheme *theme,
PangoFontDescription*
meta_gtk_widget_get_font_desc (GtkWidget *widget,
double scale)
double scale,
const PangoFontDescription *override)
{
PangoFontDescription *font_desc;
@ -4679,6 +4680,9 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
font_desc = pango_font_description_copy (widget->style->font_desc);
if (override)
pango_font_description_merge (font_desc, override, TRUE);
pango_font_description_set_size (font_desc,
MAX (pango_font_description_get_size (font_desc) * scale, 1));

View file

@ -742,7 +742,8 @@ char* meta_theme_replace_constants (MetaTheme *theme,
/* random stuff */
PangoFontDescription* meta_gtk_widget_get_font_desc (GtkWidget *widget,
double scale);
double scale,
const PangoFontDescription *override);
int meta_pango_font_desc_get_text_height (PangoFontDescription *font_desc,
PangoContext *context);