Dragging the window icon

Listen to this.

A user writes:

At the moment i’m trying to make a theme for metacity but I have no idea how I can make the document icon drag-able and to interact with the desktop environment i.e. drag to the desktop to save or to the trash to delete.

Firstly, let me thank you for being willing to work on developing the desktop.

To begin with, this idea was based on “Window Experiments”.  desrt developed this idea into a program called icanhasedit back in August, which worked by taking over the responsibility of drawing window decorations from the window manager.  That’s certainly one way of going about solving the problem, but it brings a whole raft of problems of its own.  So let’s assume we want to keep the decorator in the window manager here.

Secondly, there is nothing in Metacity corresponding to “the document icon” as such.  It happens that most themes draw the icon of the current window on the menu button– the button which shows the window menu when you click it.  Some themes do it other ways, though: for example, Atlanta draws the icon on the titlebar next to the window’s name.  But let’s assume what we want is for the menu button to be draggable.

So you need to implement drag-and-drop from the widget representing that button.  Once that’s done, you need to have a way to tell what should actually happen when the button is dragged somewhere.  The trouble is that Metacity doesn’t know much about what’s actually in the window: it knows the name and the icon and a few other things, but the actual content is the business of the application.  So you need to invent a way for the WM to tell the application that a drag is happening, and for the application to tell the WM what the data being dragged is, and what its type is.  Then you need to argue it out on wm-spec-list and then you need to get applications actually to implement it so it’s useful.

So: this is possible, but it’s complicated and probably not an ideal first project.  If you want to try solving it, please go ahead and I’ll give you what help I can.  If you’d rather do something easier first and ramp up to this, I can help you with that too.