## Drag&drop not really working properly in ImageTweak

When I released ImageTweak 0.19 I wrote in the changelog that the main change was the support for proper image drag&drop.

It actually works correctly but this change had the side effect of changing the normal mouse pointer used by ImageTweak to indicate that you’re moving an image around the window. I noticed this before releasing the update, but it seemed like a minor annoyance worth the additional functionality. I actually tried to fix it but found no way, and since there were a lot of people writing negative reviews on AMO for the lack of drag&drop support I decided to release it without fixing it.

Fast forward some weeks, and it turns out that actually the new behaviour is quite confusing and many are complaining about the mouse pointer showing the “forbidden” shape while moving the image. Fewer than they were complaining before about the lack of drag&drop, but still…

So I set out to find a solution for this problem but apparently there’s no way to freely control the mouse pointer shape during a drap&drop operation. The only thing that comes closer is setting the mozCursor property of the DOMDataTransfer interface to “default”, but that works only on win32 and simply switch the cursor from “forbidden” to the default arrow.

I’m therefore pretty much stuck in a fix: I have to fix this problem but I have no idea of how. If you know how to do this, or know somebody that might help me in fixing this, please let me know.

## ImageTweak 0.19: proper drag&drop

A few months and a complete change of location (I’m in Helsinki right now!) later, ImageTweak is going to reach version 0.19.

I had to scrape all the work I already did for 0.19 because I hit a few roadblocks, and so I had to start over with a minor but longstanding bug: proper drag&drop support. What it means is that you won’t have to hold CTRL anymore when performing drag&drop. The price is that I had to drop support for firefox 2.x and 3.0.x.

I just added it on AMO. As soon as it gets reviewed it will be available for download.

p.s. I also enabled donations on AMO, so if you feel like it please support the development of ImageTweak.

## HTML5 Web Sockets API reloaded

One of the most exciting upcoming features of HTML5 is the ability to open persistent bidirectional sockets to a remote host.

As far as I know, one of the early proposals was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly like a typical network daemon/server, but this proposal was later scraped because of security implications.

Fast forward to today and the Web Sockets API, even if still under development, are starting to get a stable shape and they will probably be implemented soon by the most forward-looking browser vendors.

The problem is, though, that the original proposal got crampled along the way and therefore there won’t be any means to create peer-to-peer connections between users, something that could enable all kinds of cool distributed systems.

That is, unless someone does something: what I’m thinking about right now is a kind of wrapper/extension around the Web Sockets API that does simply a few things:

1. allows a web application to register for incoming connections
2. opens up the required ports on the firewall/NAT
3. when a connection arrives, perform the handshaking required by the ws:// protocol and forwards a WebSocket object representing the connection to the application

Talking IDL, that would mean (the WebSocket interface is the current WHATWG proposal, while WebSocketListener is my addition):

[Constructor(in DOMString url, optional in DOMString protocol)]
interface WebSocket {

const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSED = 2;

// networking
attribute Function onopen;
attribute Function onmessage;
attribute Function onclose;
boolean send(in DOMString data);
void close();
};

[Constructor(optional in short port, optional in DOMString protocol)]
interface WebSocketListener {

const unsigned short OPENING = 0;
const unsigned short LISTENING = 1;
const unsigned short CLOSED = 2;

// networking
attribute Function onconnection;
void close();
};

Talking about the Mozilla platform, points 1 and 3 are straightforward (once the Web Sockets API has been implemented), whereas point 2 will be platform-dependent and, therefore, trickier. Nevertheless, I think that all of this can be handled (with some work) by a Firefox extension.

Once Firefox will gain Web Sockets support I’ll definitely try to see if it is possible to add it.

I just noticed that ImageTweak passed the 2M downloads mark and is steadily above 200K active daily users. That’s quite something! A big thanks to all my users (well, maybe not really all of them).
Just in case someone is wondering: I’m open to new contributors for ImageTweak. It really isn’t a big codebase, but it needs maintenance and further development… if you know javascript (and possibly a little about developing Firefox extensions) and you’re willing to contribute please leave a comment here.

## A DHT for Mozilla?

I’ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like:

• a distributed version of Weave (for Firefox)
• a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, be it because of server downtime or because of censorship policies)
• a file sharing platform (for Songbird: imagine being able to see in your library not only your songs, but also everyone else’s)
• a distributed computing platform (more on this in a later post)
• the Next Big Thing™

BTW, much of this is partly already implemented in any bittorrent client (and the rest is already on track), what’s needed is just glueing the pieces together. As soon as my exams are over I’ll give it a try…