diff --git a/src/chat_control.py b/src/chat_control.py
index d9690cecf5dfb1b9774ac3af1e2ed0d635494bc8..25cce3eac5ce3afd76d465485efc532c8cb55a49 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -2309,9 +2309,9 @@ class ChatControl(ChatControlBase):
 
     def _on_authentication_button_clicked(self, widget):
         if self.gpg_is_active:
-            dialogs.GPGInfoWindow(self)
+            dialogs.GPGInfoWindow(self, self.parent_win.window)
         elif self.session and self.session.enable_encryption:
-            dialogs.ESessionInfoWindow(self.session)
+            dialogs.ESessionInfoWindow(self.session, self.parent_win.window)
 
     def send_message(self, message, keyID='', chatstate=None, xhtml=None,
     process_commands=True, attention=False):
diff --git a/src/dialogs.py b/src/dialogs.py
index 0aab9be6672fd41ed135ebfdd00bc726fa563bf8..da52b0feeccbcc5610322c42b88d753232b63444 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -5097,7 +5097,7 @@ class ESessionInfoWindow:
     """
     Class for displaying information about a XEP-0116 encrypted session
     """
-    def __init__(self, session):
+    def __init__(self, session, transient_for=None):
         self.session = session
 
         self.xml = gtkgui_helpers.get_gtk_builder('esession_info_window.ui')
@@ -5108,7 +5108,7 @@ class ESessionInfoWindow:
         self.button_label = self.xml.get_object('button_label')
         self.window = self.xml.get_object('esession_info_window')
         self.update_info()
-
+        self.window.set_transient_for(transient_for)
 
         self.window.show_all()
 
@@ -5219,6 +5219,7 @@ class GPGInfoWindow:
         path = gtkgui_helpers.get_icon_path(image, 32)
         security_image.set_from_file(path)
 
+        self.window.set_transient_for(transient_for)
         xml.connect_signals(self)
         self.window.show_all()
 
diff --git a/src/message_window.py b/src/message_window.py
index ad2a2b50b59e9b52223687f7b6fa64f4b4981638..17ba02ff78a772dacd4f5b695ed06dd305c4de01 100644
--- a/src/message_window.py
+++ b/src/message_window.py
@@ -219,7 +219,8 @@ class MessageWindow(object):
             dialogs.YesNoDialog(
                 _('You are going to close several tabs'),
                 _('Do you really want to close them all?'),
-                checktext=_('_Do not ask me again'), on_response_yes=on_yes1)
+                checktext=_('_Do not ask me again'), on_response_yes=on_yes1,
+                transient_for=self.window)
             return True
 
         def on_yes(ctrl):