diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index fff2e7cb8dcc1e0abe4bc0b72eb189aa7e306700..cf9d192ca31923759566e8c7d4acef901e88c4de 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -286,6 +286,7 @@
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Sun, 12 Oct 2003 18:17:05 GMT"/>
   <signal name="focus_in_event" handler="on_focus" last_modification_time="Fri, 11 Jun 2004 03:14:21 GMT"/>
+  <signal name="key_press_event" handler="on_chat_key_press_event" last_modification_time="Thu, 06 Jan 2005 12:53:45 GMT"/>
 
   <child>
     <widget class="GtkVBox" id="vbox2">
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index f3e4c0103b1d46b91188ddd58aa64380f20b1bc3..5435ddf72f9ad2486598cd91fcc14122f5d0c797 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -255,6 +255,10 @@ class message_Window:
 			if len(self.plugin.roster.contacts[self.account][self.user.jid]) == 1:
 				self.plugin.roster.remove_user(self.user, self.account)
 
+	def on_chat_key_press_event(self, widget, event):
+		if event.keyval == gtk.keysyms.Escape:
+			widget.get_toplevel().destroy()
+
 	def on_msg_key_press_event(self, widget, event):
 		"""When a key is pressed :
 		if enter is pressed without the shit key, message (if not empty) is sent
@@ -328,6 +332,8 @@ class message_Window:
 		self.xml.signal_connect('on_history_clicked', self.on_history)
 		self.xml.signal_connect('on_msg_key_press_event', \
 			self.on_msg_key_press_event)
+		self.xml.signal_connect('on_chat_key_press_event', \
+			self.on_chat_key_press_event)
 		self.tagIn = buffer.create_tag("incoming")
 		color = self.plugin.config['inmsgcolor']
 		self.tagIn.set_property("foreground", color)