~hypodermia/ubuntu/oneiric/compiz/fix-for-bug-301174

« back to all changes in this revision

Viewing changes to src/event.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2011-04-11 13:25:14 UTC
  • mfrom: (0.168.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20110411132514-h13c20xw827l6ekl
Tags: 1:0.9.4+bzr20110411-0ubuntu1
* New upstream snapshot, including all 01_bzr* patch:
  - compiz crashed with SIGSEGV in PluginClassHandler<DecorWindow, CompWindow,
    0>::get() (LP: #743807)
  - Animation for Grid Previews is broken (LP: #754088)
  - Grid plugin: Maximizing a window from left or right edge loses original
    size (LP: #753051)
* add 00_remove_printf.patch: remove debug printf
* 02_add_debug_spewer_for_apport.patch:
  - refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1068
1068
             * manage it straight away - in reality we want
1069
1069
             * that to wait until the map request */
1070
1070
            if (failure || (wa.root == priv->root))
1071
 
            {
1072
 
                /* Our SubstructureRedirectMask doesn't work on OverrideRedirect
1073
 
                 * windows so we need to track them directly here */
1074
 
                if (!event->xcreatewindow.override_redirect)
1075
 
                    new CoreWindow (event->xcreatewindow.window);
1076
 
                else
1077
 
                {
1078
 
                    CoreWindow *cw = 
1079
 
                        new CoreWindow (event->xcreatewindow.window);
1080
 
                    
1081
 
                    if (cw)
1082
 
                    {
1083
 
                        w = cw->manage (priv->getTopWindow (), wa);
1084
 
                        priv->createdWindows.remove (cw);
1085
 
                        delete cw;
1086
 
                    }
1087
 
                }
1088
 
            }
 
1071
            {
 
1072
                CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);
 
1073
                cw->manage (priv->getTopWindow (), wa);
 
1074
 
 
1075
                priv->createdWindows.remove (cw);
 
1076
                delete cw;
 
1077
            }
1089
1078
            else
1090
1079
                XSelectInput (priv->dpy, event->xcreatewindow.window,
1091
1080
                              FocusChangeMask);
1099
1088
            w->moveInputFocusToOtherWindow ();
1100
1089
            w->destroy ();
1101
1090
        }
1102
 
        else
1103
 
        {
1104
 
            foreach (CoreWindow *cw, priv->createdWindows)
1105
 
            {
1106
 
                if (cw->priv->id == event->xdestroywindow.window)
1107
 
                {
1108
 
                    priv->createdWindows.remove (cw);
1109
 
                    delete cw;
1110
 
                    break;
1111
 
                }
1112
 
            }
1113
 
        }
1114
1091
        break;
1115
1092
    case MapNotify:
1116
1093
 
1117
 
        /* Some broken applications and toolkits (eg QT) will lie to
1118
 
         * us about their override-redirect mask - not setting it on
1119
 
         * the initial CreateNotify and then setting it later on
1120
 
         * just after creation. Unfortunately, this means that QT
1121
 
         * has successfully bypassed both of our window tracking
1122
 
         * mechanisms (eg, not override-redirect at CreateNotify time
1123
 
         * and then bypassing MapRequest because it *is* override-redirect
1124
 
         * at XMapWindow time, so we need to catch this case and make
1125
 
         * sure that windows are tracked here */
1126
 
 
1127
 
        foreach (CoreWindow *cw, priv->createdWindows)
1128
 
        {
1129
 
            if (cw->priv->id == event->xmap.window)
1130
 
            {
1131
 
                /* Failure means the window has been destroyed, but
1132
 
                 * still add it to the window list anyways since we
1133
 
                 * will soon handle the DestroyNotify event for it
1134
 
                 * and in between CreateNotify time and DestroyNotify
1135
 
                 * time there might be ConfigureRequests asking us
1136
 
                 * to stack windows relative to it
1137
 
                 */
1138
 
                if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
1139
 
                    priv->setDefaultWindowAttributes (&wa);
1140
 
 
1141
 
                w = cw->manage (priv->getTopWindow (), wa);
1142
 
                priv->createdWindows.remove (cw);
1143
 
                delete cw;
1144
 
                break;
1145
 
            }
1146
 
        }
1147
 
 
1148
1094
        /* Search in already-created windows for this window */
1149
1095
        if (!w)
1150
1096
            w = findWindow (event->xmap.window);
1233
1179
            if (!XGetWindowAttributes (priv->dpy, event->xcreatewindow.window, &wa))
1234
1180
                priv->setDefaultWindowAttributes (&wa);
1235
1181
 
1236
 
            CoreWindow *cw = new CoreWindow (event->xreparent.window);
1237
 
 
1238
 
            if (cw)
1239
 
            {
1240
 
                cw->manage (priv->getTopWindow (), wa);
1241
 
                priv->createdWindows.remove (cw);
1242
 
                delete cw;
1243
 
            }
 
1182
            CoreWindow *cw = new CoreWindow (event->xcreatewindow.window);
 
1183
            cw->manage (priv->getTopWindow (), wa);
 
1184
 
 
1185
            priv->createdWindows.remove (cw);
 
1186
            delete cw;
 
1187
 
1244
1188
        }
1245
1189
        else if (event->xreparent.parent != priv->root)
1246
1190
        {
1283
1227
                                         x, y);
1284
1228
                }
1285
1229
            }
1286
 
            else
1287
 
            {
1288
 
                foreach (CoreWindow *cw, screen->priv->createdWindows)
1289
 
                {
1290
 
                    if (cw->priv->id == event->xreparent.window)
1291
 
                    {
1292
 
                        screen->priv->createdWindows.remove (cw);
1293
 
                        delete cw;
1294
 
                        break;
1295
 
                    }
1296
 
                }
1297
 
            }
1298
1230
        }
1299
1231
        break;
1300
1232
    case CirculateNotify:
1711
1643
 
1712
1644
        w = NULL;
1713
1645
 
1714
 
        foreach (CoreWindow *cw, priv->createdWindows)
1715
 
        {
1716
 
            if (cw->priv->id == event->xmaprequest.window)
1717
 
            {
1718
 
                /* Failure means the window has been destroyed, but
1719
 
                 * still add it to the window list anyways since we
1720
 
                 * will soon handle the DestroyNotify event for it
1721
 
                 * and in between CreateNotify time and DestroyNotify
1722
 
                 * time there might be ConfigureRequests asking us
1723
 
                 * to stack windows relative to it
1724
 
                 */
1725
 
                if (!XGetWindowAttributes (screen->dpy (), cw->priv->id, &wa))
1726
 
                    priv->setDefaultWindowAttributes (&wa);
1727
 
 
1728
 
                w = cw->manage (priv->getTopWindow (), wa);
1729
 
                priv->createdWindows.remove (cw);
1730
 
                delete cw;
1731
 
                break;
1732
 
            }
1733
 
        }
1734
 
 
1735
1646
        if (!w)
1736
1647
            w = screen->findWindow (event->xmaprequest.window);
1737
1648