? current.patch
? src/current.patch
Index: src/display.c
===================================================================
RCS file: /cvs/gnome/metacity/src/display.c,v
retrieving revision 1.215
diff -u -r1.215 display.c
--- src/display.c	16 Apr 2004 03:38:19 -0000	1.215
+++ src/display.c	14 Jun 2004 03:34:22 -0000
@@ -209,7 +209,6 @@
     "_NET_WM_STATE_MAXIMIZED_VERT",
     "_NET_WM_DESKTOP",
     "_NET_NUMBER_OF_DESKTOPS",
-    "WM_CHANGE_STATE",
     "SM_CLIENT_ID",
     "WM_CLIENT_LEADER",
     "WM_WINDOW_ROLE",
@@ -281,6 +280,7 @@
     "_NET_WM_ACTION_MINIMIZE",
     "_NET_FRAME_EXTENTS",
     "_NET_REQUEST_FRAME_EXTENTS",
+    "_NET_WM_STATE_MINIMIZED",
   };
   Atom atoms[G_N_ELEMENTS(atom_names)];
   
@@ -355,78 +355,78 @@
   display->atom_net_wm_state_maximized_vert = atoms[10];
   display->atom_net_wm_desktop = atoms[11];
   display->atom_net_number_of_desktops = atoms[12];
-  display->atom_wm_change_state = atoms[13];
-  display->atom_sm_client_id = atoms[14];
-  display->atom_wm_client_leader = atoms[15];
-  display->atom_wm_window_role = atoms[16];
-  display->atom_net_current_desktop = atoms[17];
-  display->atom_net_supporting_wm_check = atoms[18];
-  display->atom_net_supported = atoms[19];
-  display->atom_net_wm_window_type = atoms[20];
-  display->atom_net_wm_window_type_desktop = atoms[21];
-  display->atom_net_wm_window_type_dock = atoms[22];
-  display->atom_net_wm_window_type_toolbar = atoms[23];
-  display->atom_net_wm_window_type_menu = atoms[24];
-  display->atom_net_wm_window_type_dialog = atoms[25];
-  display->atom_net_wm_window_type_normal = atoms[26];
-  display->atom_net_wm_state_modal = atoms[27];
-  display->atom_net_client_list = atoms[28];
-  display->atom_net_client_list_stacking = atoms[29];
-  display->atom_net_wm_state_skip_taskbar = atoms[30];
-  display->atom_net_wm_state_skip_pager = atoms[31];
-  display->atom_net_wm_icon_name = atoms[32];
-  display->atom_net_wm_icon = atoms[33];
-  display->atom_net_wm_icon_geometry = atoms[34];
-  display->atom_utf8_string = atoms[35];
-  display->atom_wm_icon_size = atoms[36];
-  display->atom_kwm_win_icon = atoms[37];
-  display->atom_net_wm_moveresize = atoms[38];
-  display->atom_net_active_window = atoms[39];
-  display->atom_metacity_restart_message = atoms[40];
-  display->atom_net_wm_strut = atoms[41];
-  display->atom_metacity_reload_theme_message = atoms[42];
-  display->atom_metacity_set_keybindings_message = atoms[43];
-  display->atom_net_wm_state_hidden = atoms[44];
-  display->atom_net_wm_window_type_utility = atoms[45];
-  display->atom_net_wm_window_type_splash = atoms[46];
-  display->atom_net_wm_state_fullscreen = atoms[47];
-  display->atom_net_wm_ping = atoms[48];
-  display->atom_net_wm_pid = atoms[49];
-  display->atom_wm_client_machine = atoms[50];
-  display->atom_net_workarea = atoms[51];
-  display->atom_net_showing_desktop = atoms[52];
-  display->atom_net_desktop_layout = atoms[53];
-  display->atom_manager = atoms[54];
-  display->atom_targets = atoms[55];
-  display->atom_multiple = atoms[56];
-  display->atom_timestamp = atoms[57];
-  display->atom_version = atoms[58];
-  display->atom_atom_pair = atoms[59];
-  display->atom_net_desktop_names = atoms[60];
-  display->atom_net_wm_allowed_actions = atoms[61];
-  display->atom_net_wm_action_move = atoms[62];
-  display->atom_net_wm_action_resize = atoms[63];
-  display->atom_net_wm_action_shade = atoms[64];
-  display->atom_net_wm_action_stick = atoms[65];
-  display->atom_net_wm_action_maximize_horz = atoms[66];
-  display->atom_net_wm_action_maximize_vert = atoms[67];
-  display->atom_net_wm_action_change_desktop = atoms[68];
-  display->atom_net_wm_action_close = atoms[69];
-  display->atom_net_wm_state_above = atoms[70];
-  display->atom_net_wm_state_below = atoms[71];
-  display->atom_net_startup_id = atoms[72];
-  display->atom_metacity_toggle_verbose = atoms[73];
-  display->atom_metacity_update_counter = atoms[74];
-  display->atom_sync_counter = atoms[75];
-  display->atom_gnome_panel_action = atoms[76];
-  display->atom_gnome_panel_action_main_menu = atoms[77];
-  display->atom_gnome_panel_action_run_dialog = atoms[78];
-  display->atom_metacity_sentinel = atoms[79];
-  display->atom_net_wm_strut_partial = atoms[80];
-  display->atom_net_wm_action_fullscreen = atoms[81];
-  display->atom_net_wm_action_minimize = atoms[82];
-  display->atom_net_frame_extents = atoms[83];
-  display->atom_net_request_frame_extents = atoms[84];
+  display->atom_sm_client_id = atoms[13];
+  display->atom_wm_client_leader = atoms[14];
+  display->atom_wm_window_role = atoms[15];
+  display->atom_net_current_desktop = atoms[16];
+  display->atom_net_supporting_wm_check = atoms[17];
+  display->atom_net_supported = atoms[18];
+  display->atom_net_wm_window_type = atoms[19];
+  display->atom_net_wm_window_type_desktop = atoms[20];
+  display->atom_net_wm_window_type_dock = atoms[21];
+  display->atom_net_wm_window_type_toolbar = atoms[22];
+  display->atom_net_wm_window_type_menu = atoms[23];
+  display->atom_net_wm_window_type_dialog = atoms[24];
+  display->atom_net_wm_window_type_normal = atoms[25];
+  display->atom_net_wm_state_modal = atoms[26];
+  display->atom_net_client_list = atoms[27];
+  display->atom_net_client_list_stacking = atoms[28];
+  display->atom_net_wm_state_skip_taskbar = atoms[29];
+  display->atom_net_wm_state_skip_pager = atoms[30];
+  display->atom_net_wm_icon_name = atoms[31];
+  display->atom_net_wm_icon = atoms[32];
+  display->atom_net_wm_icon_geometry = atoms[33];
+  display->atom_utf8_string = atoms[34];
+  display->atom_wm_icon_size = atoms[35];
+  display->atom_kwm_win_icon = atoms[36];
+  display->atom_net_wm_moveresize = atoms[37];
+  display->atom_net_active_window = atoms[38];
+  display->atom_metacity_restart_message = atoms[39];
+  display->atom_net_wm_strut = atoms[40];
+  display->atom_metacity_reload_theme_message = atoms[41];
+  display->atom_metacity_set_keybindings_message = atoms[42];
+  display->atom_net_wm_state_hidden = atoms[43];
+  display->atom_net_wm_window_type_utility = atoms[44];
+  display->atom_net_wm_window_type_splash = atoms[45];
+  display->atom_net_wm_state_fullscreen = atoms[46];
+  display->atom_net_wm_ping = atoms[47];
+  display->atom_net_wm_pid = atoms[48];
+  display->atom_wm_client_machine = atoms[49];
+  display->atom_net_workarea = atoms[50];
+  display->atom_net_showing_desktop = atoms[51];
+  display->atom_net_desktop_layout = atoms[52];
+  display->atom_manager = atoms[53];
+  display->atom_targets = atoms[54];
+  display->atom_multiple = atoms[55];
+  display->atom_timestamp = atoms[56];
+  display->atom_version = atoms[57];
+  display->atom_atom_pair = atoms[58];
+  display->atom_net_desktop_names = atoms[59];
+  display->atom_net_wm_allowed_actions = atoms[60];
+  display->atom_net_wm_action_move = atoms[61];
+  display->atom_net_wm_action_resize = atoms[62];
+  display->atom_net_wm_action_shade = atoms[63];
+  display->atom_net_wm_action_stick = atoms[64];
+  display->atom_net_wm_action_maximize_horz = atoms[65];
+  display->atom_net_wm_action_maximize_vert = atoms[66];
+  display->atom_net_wm_action_change_desktop = atoms[67];
+  display->atom_net_wm_action_close = atoms[68];
+  display->atom_net_wm_state_above = atoms[69];
+  display->atom_net_wm_state_below = atoms[70];
+  display->atom_net_startup_id = atoms[71];
+  display->atom_metacity_toggle_verbose = atoms[72];
+  display->atom_metacity_update_counter = atoms[73];
+  display->atom_sync_counter = atoms[74];
+  display->atom_gnome_panel_action = atoms[75];
+  display->atom_gnome_panel_action_main_menu = atoms[76];
+  display->atom_gnome_panel_action_run_dialog = atoms[77];
+  display->atom_metacity_sentinel = atoms[78];
+  display->atom_net_wm_strut_partial = atoms[79];
+  display->atom_net_wm_action_fullscreen = atoms[80];
+  display->atom_net_wm_action_minimize = atoms[81];
+  display->atom_net_frame_extents = atoms[82];
+  display->atom_net_request_frame_extents = atoms[83];
+  display->atom_net_wm_state_minimized = atoms[84];
 
   display->prop_hooks = NULL;
   meta_display_init_window_prop_hooks (display);
Index: src/display.h
===================================================================
RCS file: /cvs/gnome/metacity/src/display.h,v
retrieving revision 1.116
diff -u -r1.116 display.h
--- src/display.h	23 Feb 2004 01:48:29 -0000	1.116
+++ src/display.h	14 Jun 2004 03:34:23 -0000
@@ -103,7 +103,6 @@
   Atom atom_net_wm_state_maximized_vert;
   Atom atom_net_wm_desktop;
   Atom atom_net_number_of_desktops;
-  Atom atom_wm_change_state;
   Atom atom_sm_client_id;
   Atom atom_wm_client_leader;
   Atom atom_wm_window_role;
@@ -175,6 +174,7 @@
   Atom atom_net_wm_strut_partial;
   Atom atom_net_frame_extents;
   Atom atom_net_request_frame_extents;
+  Atom atom_net_wm_state_minimized;
 
   /* This is the actual window from focus events,
    * not the one we last set
Index: src/screen.c
===================================================================
RCS file: /cvs/gnome/metacity/src/screen.c,v
retrieving revision 1.123
diff -u -r1.123 screen.c
--- src/screen.c	21 Jan 2004 17:33:56 -0000	1.123
+++ src/screen.c	14 Jun 2004 03:34:27 -0000
@@ -82,7 +82,7 @@
 static int
 set_supported_hint (MetaScreen *screen)
 {
-#define N_SUPPORTED 54
+#define N_SUPPORTED 55
   Atom atoms[N_SUPPORTED];
   
   atoms[0] = screen->display->atom_net_wm_name;
@@ -139,6 +139,7 @@
   atoms[51] = screen->display->atom_net_wm_action_minimize;
   atoms[52] = screen->display->atom_net_frame_extents;
   atoms[53] = screen->display->atom_net_request_frame_extents;
+  atoms[54] = screen->display->atom_net_wm_state_minimized;
   
   XChangeProperty (screen->display->xdisplay, screen->xroot,
                    screen->display->atom_net_supported,
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.325
diff -u -r1.325 window.c
--- src/window.c	28 Feb 2004 02:53:55 -0000	1.325
+++ src/window.c	14 Jun 2004 03:34:37 -0000
@@ -1153,6 +1153,11 @@
       data[i] = window->display->atom_net_wm_state_below;
       ++i;
     }
+  if (window->minimized)
+    {
+      data[i] = window->display->atom_net_wm_state_minimized;
+      ++i;
+    }
   
   meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);
   
@@ -1816,7 +1821,7 @@
           meta_topic (META_DEBUG_FOCUS,
                       "Focusing top window due to minimization of focus window %s\n",
                       window->desc);
-          meta_workspace_focus_mru_window (window->screen->active_workspace, window);
+          meta_workspace_focus_default_window (window->screen->active_workspace, window);
         }
       else
         {
@@ -3652,10 +3657,6 @@
   if (event->xclient.message_type ==
       display->atom_net_close_window)
     {
-      /* I think the wm spec should maybe put a time
-       * in this message, CurrentTime here is sort of
-       * bogus. But it rarely matters most likely.
-       */
       meta_window_delete (window, meta_display_get_current_time (window->display));
 
       return TRUE;
@@ -3826,16 +3827,18 @@
           set_net_wm_state (window);
         }
       
-      return TRUE;
-    }
-  else if (event->xclient.message_type ==
-           display->atom_wm_change_state)
-    {
-      meta_verbose ("WM_CHANGE_STATE client message, state: %ld\n",
-                    event->xclient.data.l[0]);
-      if (event->xclient.data.l[0] == IconicState &&
-          window->has_minimize_func)
-        meta_window_minimize (window);
+      if (first == display->atom_net_wm_state_minimized ||
+          second == display->atom_net_wm_state_minimized)
+        {
+          gboolean minimize;
+
+          minimize = (action == _NET_WM_STATE_ADD ||
+                     (action == _NET_WM_STATE_TOGGLE && !window->minimized));
+          if (minimize && window->has_minimize_func)
+            meta_window_minimize (window);
+          else
+            meta_window_unminimize (window);
+        }
 
       return TRUE;
     }
@@ -4458,6 +4461,8 @@
             window->wm_state_above = TRUE;
           else if (atoms[i] == window->display->atom_net_wm_state_below)
             window->wm_state_below = TRUE;
+          else if (atoms[i] == window->display->atom_net_wm_state_minimized)
+            window->minimized = TRUE;
           
           ++i;
         }
