mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
1999-06-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c (set_icon_wmclass): New function to set the wmclass and wmname for desktop icons. This lets them be managed correctly by WMs who try to manage X11R5 clients decently. (text_changed): Call set_icon_wmclass(). (desktop_icon_info_new): Call set_icon_wmclass(). * gdesktop-icon.c (desktop_icon_realize): Do not clear the WM_CLIENT_LEADER property.
This commit is contained in:
parent
4e24fdb8e7
commit
7a22a993e7
@ -1,3 +1,14 @@
|
||||
1999-06-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdesktop.c (set_icon_wmclass): New function to set the wmclass
|
||||
and wmname for desktop icons. This lets them be managed correctly
|
||||
by WMs who try to manage X11R5 clients decently.
|
||||
(text_changed): Call set_icon_wmclass().
|
||||
(desktop_icon_info_new): Call set_icon_wmclass().
|
||||
|
||||
* gdesktop-icon.c (desktop_icon_realize): Do not clear the
|
||||
WM_CLIENT_LEADER property.
|
||||
|
||||
1999-06-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdesktop.c (icon_is_in_area): Fixed off-by-one error in
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include <config.h>
|
||||
#include <gnome.h>
|
||||
#include <sys/stat.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gdesktop-icon.h"
|
||||
#include "dir.h"
|
||||
#include "gdesktop.h"
|
||||
@ -104,7 +107,7 @@ desktop_icon_init (DesktopIcon *dicon)
|
||||
/* Set the window policy */
|
||||
|
||||
gtk_window_set_policy (GTK_WINDOW (dicon), TRUE, TRUE, TRUE);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (dicon), "desktop_icon", "gmc");
|
||||
|
||||
/* Create the canvas */
|
||||
|
||||
dicon->canvas = gnome_canvas_new ();
|
||||
@ -160,12 +163,6 @@ desktop_icon_realize (GtkWidget *widget)
|
||||
gdk_window_set_decorations (widget->window, 0);
|
||||
gdk_window_set_functions (widget->window, 0);
|
||||
|
||||
/* Remove the client leader property so that the window manager will not
|
||||
* save SM information for icons.
|
||||
*/
|
||||
|
||||
gdk_property_delete (widget->window, gdk_atom_intern ("WM_CLIENT_LEADER", FALSE));
|
||||
|
||||
/* Set the proper GNOME hints */
|
||||
|
||||
gnome_win_hints_init ();
|
||||
|
@ -783,6 +783,27 @@ file_entry_free (file_entry *fe)
|
||||
g_free (fe);
|
||||
}
|
||||
|
||||
/* Sets the wmclass and name of a desktop icon to an unique value */
|
||||
static void
|
||||
set_icon_wmclass (DesktopIconInfo *dii)
|
||||
{
|
||||
XClassHint *h;
|
||||
|
||||
g_assert (GTK_WIDGET_REALIZED (dii->dicon));
|
||||
|
||||
h = XAllocClassHint ();
|
||||
if (!h) {
|
||||
g_warning ("XAllocClassHint() failed!");
|
||||
return; /* eek */
|
||||
}
|
||||
|
||||
h->res_name = dii->filename;
|
||||
h->res_class = "gmc-desktop-icon";
|
||||
|
||||
XSetClassHint (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (GTK_WIDGET (dii->dicon)->window), h);
|
||||
XFree (h);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback used when an icon's text changes. We must validate the
|
||||
* rename and return the appropriate value. The desktop icon info
|
||||
@ -812,8 +833,11 @@ text_changed (GnomeIconTextItem *iti, gpointer data)
|
||||
if (mc_rename (source, dest) == 0) {
|
||||
gnome_metadata_delete (dest);
|
||||
gnome_metadata_rename (source, dest);
|
||||
|
||||
g_free (dii->filename);
|
||||
dii->filename = g_strdup (new_name);
|
||||
set_icon_wmclass (dii);
|
||||
|
||||
desktop_reload_icons (FALSE, 0, 0);
|
||||
retval = TRUE;
|
||||
} else
|
||||
@ -2003,6 +2027,11 @@ desktop_icon_info_new (char *filename, char *url, char *caption, int xpos, int y
|
||||
(GtkSignalFunc) selection_stopped,
|
||||
dii);
|
||||
|
||||
/* We must set the icon's wmclass and name. It is already realized (it
|
||||
* comes out realized from desktop_icon_new()).
|
||||
*/
|
||||
set_icon_wmclass (dii);
|
||||
|
||||
/* Prepare the DnD functionality for this icon */
|
||||
|
||||
setup_icon_dnd_source (dii);
|
||||
|
Loading…
Reference in New Issue
Block a user