View | Details | Raw Unified | Return to bug 355374
Collapse All | Expand All

(-)kdeui/qxembed.h (+1 lines)
Lines 226-231 Link Here
226
    QXEmbedData* d;
226
    QXEmbedData* d;
227
    void checkGrab();
227
    void checkGrab();
228
    void sendSyntheticConfigureNotifyEvent();
228
    void sendSyntheticConfigureNotifyEvent();
229
    void handleEmbed();
229
};
230
};
230
231
231
232
(-)kdeui/qxembed.cpp (-34 / +49 lines)
Lines 1013-1018 Link Here
1013
    }
1013
    }
1014
}
1014
}
1015
1015
1016
// When a window is reparented into QXEmbed (or created inside of it), this function
1017
// sets up the actual embedding.
1018
void QXEmbed::handleEmbed()
1019
{
1020
    // only XEMBED apps can survive crash,
1021
    // see http://lists.kde.org/?l=kfm-devel&m=106752026501968&w=2
1022
    if( !d->xplain )
1023
        XAddToSaveSet( qt_xdisplay(), window );
1024
    XResizeWindow(qt_xdisplay(), window, width(), height());
1025
    XMapRaised(qt_xdisplay(), window);
1026
    // L2024: see L2900.
1027
    sendSyntheticConfigureNotifyEvent();
1028
    // L2025: ??? [any idea about drag&drop?] 
1029
    extraData()->xDndProxy = window;
1030
    if ( parent() ) {
1031
        // L2030: embedded window might have new size requirements.
1032
        //        see L2500, L2520, L2550.
1033
        QEvent * layoutHint = new QEvent( QEvent::LayoutHint );
1034
        QApplication::postEvent( parent(), layoutHint );
1035
    }
1036
    windowChanged( window );
1037
    if (d->xplain) {
1038
        // L2040: Activation has changed. Grab state might change. See L2800.
1039
        checkGrab();
1040
        if ( hasFocus() )
1041
            // L2041: Send fake focus message to inform the client. See L1521.
1042
            sendFocusMessage(window, XFocusIn, NotifyNormal, NotifyPointer );
1043
    } else {
1044
        // L2050: Send XEMBED messages (see L0670, L1312, L1322, L1530)
1045
        sendXEmbedMessage( window, XEMBED_EMBEDDED_NOTIFY, 0, (long) winId() );
1046
        if (isActiveWindow())
1047
            sendXEmbedMessage( window, XEMBED_WINDOW_ACTIVATE);
1048
        else
1049
            sendXEmbedMessage( window, XEMBED_WINDOW_DEACTIVATE);
1050
        if ( hasFocus() )
1051
            sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT );
1052
    }
1053
}
1016
1054
1017
// L1800: Returns the window identifier of the embedded window
1055
// L1800: Returns the window identifier of the embedded window
1018
WId QXEmbed::embeddedWinId() const
1056
WId QXEmbed::embeddedWinId() const
Lines 1051-1056 Link Here
1051
            emit embeddedWindowDestroyed();
1089
            emit embeddedWindowDestroyed();
1052
        }
1090
        }
1053
        break;
1091
        break;
1092
    case CreateNotify:
1093
        // A window was created inside of QXEmbed, handle it as embedded
1094
        if( window == 0 ) { // only one window
1095
            window = e->xcreatewindow.window;
1096
            handleEmbed();
1097
        }
1098
        break;
1054
    case ReparentNotify:
1099
    case ReparentNotify:
1055
        if ( e->xreparent.window == d->focusProxy->winId() )
1100
        if ( e->xreparent.window == d->focusProxy->winId() )
1056
            break; // ignore proxy
1101
            break; // ignore proxy
Lines 1066-1106 Link Here
1066
            if( !d->xplain )
1111
            if( !d->xplain )
1067
                XRemoveFromSaveSet( qt_xdisplay(), window );
1112
                XRemoveFromSaveSet( qt_xdisplay(), window );
1068
        } else if ( e->xreparent.parent == winId()){
1113
        } else if ( e->xreparent.parent == winId()){
1114
            if( window == 0 ) // something started embedding from the outside
1115
                window = e->xreparent.window;
1069
            // L2020: We got a window. Complete the embedding process.
1116
            // L2020: We got a window. Complete the embedding process.
1070
            window = e->xreparent.window;
1117
            if( e->xreparent.window == window )
1071
            // only XEMBED apps can survive crash,
1118
                handleEmbed();
1072
            // see http://lists.kde.org/?l=kfm-devel&m=106752026501968&w=2
1073
            if( !d->xplain )
1074
                XAddToSaveSet( qt_xdisplay(), window );
1075
            XResizeWindow(qt_xdisplay(), window, width(), height());
1076
            XMapRaised(qt_xdisplay(), window);
1077
            // L2024: see L2900.
1078
            sendSyntheticConfigureNotifyEvent();
1079
            // L2025: ??? [any idea about drag&drop?] 
1080
            extraData()->xDndProxy = window;
1081
            if ( parent() ) {
1082
                // L2030: embedded window might have new size requirements.
1083
                //        see L2500, L2520, L2550.
1084
                QEvent * layoutHint = new QEvent( QEvent::LayoutHint );
1085
                QApplication::postEvent( parent(), layoutHint );
1086
            }
1087
            windowChanged( window );
1088
            if (d->xplain) {
1089
                // L2040: Activation has changed. Grab state might change. See L2800.
1090
                checkGrab();
1091
                if ( hasFocus() )
1092
                    // L2041: Send fake focus message to inform the client. See L1521.
1093
                    sendFocusMessage(window, XFocusIn, NotifyNormal, NotifyPointer );
1094
            } else {
1095
                // L2050: Send XEMBED messages (see L0670, L1312, L1322, L1530)
1096
                sendXEmbedMessage( window, XEMBED_EMBEDDED_NOTIFY, 0, (long) winId() );
1097
                if (isActiveWindow())
1098
                    sendXEmbedMessage( window, XEMBED_WINDOW_ACTIVATE);
1099
                else
1100
                    sendXEmbedMessage( window, XEMBED_WINDOW_DEACTIVATE);
1101
                if ( hasFocus() )
1102
                    sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT );
1103
            }
1104
        }
1119
        }
1105
        break;
1120
        break;
1106
    case ButtonPress:
1121
    case ButtonPress:

Return to bug 355374