display: Make focus info persistent

It must not be freed (at least meanwhile the device pair
exists), so ensure it's kept around, and we don't create
info for a same keyboard twice.
This commit is contained in:
Carlos Garnacho 2011-07-20 01:17:15 +02:00
parent f6d9b29ad0
commit e6ba5ec298

View File

@ -561,8 +561,7 @@ meta_display_open (void)
the_display->current_grabs = g_hash_table_new_full (NULL, NULL, NULL, the_display->current_grabs = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
the_display->focus_info = g_hash_table_new_full (NULL, NULL, NULL, the_display->focus_info = g_hash_table_new (NULL, NULL);
(GDestroyNotify) g_free);
the_display->edge_resistance_info = g_hash_table_new (NULL, NULL); the_display->edge_resistance_info = g_hash_table_new (NULL, NULL);
#ifdef HAVE_XSYNC #ifdef HAVE_XSYNC
@ -5958,13 +5957,13 @@ meta_display_get_focus_info (MetaDisplay *display,
if (!device) if (!device)
return NULL; return NULL;
if (!META_IS_DEVICE_KEYBOARD (device))
device = meta_device_get_paired_device (device);
info = g_hash_table_lookup (display->focus_info, device); info = g_hash_table_lookup (display->focus_info, device);
if (!info) if (!info)
{ {
if (!META_IS_DEVICE_KEYBOARD (device))
device = meta_device_get_paired_device (device);
info = g_slice_new0 (MetaFocusInfo); info = g_slice_new0 (MetaFocusInfo);
info->last_focus_time = display->current_time; info->last_focus_time = display->current_time;