Changeset 194:3afcd4ddcf90

Show
Ignore:
Timestamp:
03/19/08 16:48:31 (5 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Update to SWT 3.3.2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/custom/CCombo.d

    r155 r194  
    10881088            break; 
    10891089        case DWT.Deactivate: 
    1090             dropDown (false); 
     1090            /* 
     1091             * Bug in GTK. When the arrow button is pressed the popup control receives a 
     1092             * deactivate event and then the arrow button receives a selection event. If 
     1093             * we hide the popup in the deactivate event, the selection event will show 
     1094             * it again. To prevent the popup from showing again, we will let the selection 
     1095             * event of the arrow button hide the popup. 
     1096             */ 
     1097            if ("gtk".equals(DWT.getPlatform())) { 
     1098                Point point = arrow.toControl(getDisplay().getCursorLocation()); 
     1099                Point size = arrow.getSize(); 
     1100                Rectangle rect = new Rectangle(0, 0, size.x, size.y); 
     1101                if (!rect.contains(point)) dropDown (false); 
     1102            } else { 
     1103                dropDown(false); 
     1104            } 
    10911105            break; 
    10921106        default: 
  • dwt/dnd/DragSource.d

    r136 r194  
    132132    DragSourceEffect dragEffect; 
    133133    Composite topControl; 
     134    HWND hwndDrag; 
    134135 
    135136    // ole interfaces 
     
    144145    static const char[] DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ 
    145146    static const int CFSTR_PERFORMEDDROPEFFECT; 
     147    static final TCHAR[] WindowClass = "#32770\0"; 
    146148    static this(){ 
    147149        CFSTR_PERFORMEDDROPEFFECT  = Transfer.registerType("Performed DropEffect");     //$NON-NLS-1$ 
     
    299301    int operations = opToOs(getStyle()); 
    300302    Display display = control.getDisplay(); 
    301     char[] key = "org.eclipse.swt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$ 
     303    char[] key = "dwt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$ 
    302304    Object oldValue = display.getData(key); 
    303305    display.setData(key, new ValueWrapperBool(true)); 
    304306    ImageList imagelist = null; 
    305307    Image image = event.image; 
     308    hwndDrag = null; 
     309    topControl = null; 
    306310    if (image !is null) { 
    307311        imagelist = new ImageList(DWT.NONE); 
    308312        imagelist.add(image); 
    309313        topControl = control.getShell(); 
    310         OS.ImageList_BeginDrag(imagelist.getHandle(), 0, 0, 0); 
    311         Point location = topControl.getLocation(); 
     314        /* 
     315         * Bug in Windows. The image is inverted if the shell is RIGHT_TO_LEFT. 
     316         * The fix is to create a transparent window that covers the shell client 
     317         * area and use it during the drag to prevent the image from being inverted. 
     318         * On XP if the shell is RTL, the image is not displayed. 
     319         */ 
     320        int offset = 0; 
     321        hwndDrag = topControl.handle; 
     322        if ((topControl.getStyle() & DWT.RIGHT_TO_LEFT) !is 0) { 
     323            offset = image.getBounds().width; 
     324            RECT rect; 
     325            OS.GetClientRect (topControl.handle, &rect); 
     326            hwndDrag = OS.CreateWindowEx ( 
     327                OS.WS_EX_TRANSPARENT | OS.WS_EX_NOINHERITLAYOUT, 
     328                WindowClass.ptr, 
     329                null, 
     330                OS.WS_CHILD | OS.WS_CLIPSIBLINGS, 
     331                0, 0, 
     332                rect.right - rect.left, rect.bottom - rect.top, 
     333                topControl.handle, 
     334                null, 
     335                OS.GetModuleHandle (null), 
     336                null); 
     337            OS.ShowWindow (hwndDrag, OS.SW_SHOW); 
     338        } 
     339        OS.ImageList_BeginDrag(imagelist.getHandle(), 0, offset, 0); 
    312340        /* 
    313341        * Feature in Windows. When ImageList_DragEnter() is called, 
     
    324352            OS.RedrawWindow (topControl.handle, null, null, flags); 
    325353        } 
    326         OS.ImageList_DragEnter(topControl.handle, dragEvent.x - location.x, dragEvent.y - location.y); 
    327     } 
    328     int result = COM.DoDragDrop(iDataObject, iDropSource, operations, pdwEffect.ptr); 
    329     if (imagelist !is null) { 
    330         OS.ImageList_DragLeave(topControl.handle); 
    331         OS.ImageList_EndDrag(); 
    332         imagelist.dispose(); 
    333         topControl = null; 
    334     } 
    335     display.setData(key, oldValue); 
     354        POINT pt; 
     355        pt.x = dragEvent.x; 
     356        pt.y = dragEvent.y; 
     357        OS.MapWindowPoints (control.handle, null, &pt, 1); 
     358        RECT rect; 
     359        OS.GetWindowRect (hwndDrag, &rect); 
     360        OS.ImageList_DragEnter(hwndDrag, pt.x - rect.left, pt.y - rect.top); 
     361    } 
     362    int result = COM.DRAGDROP_S_CANCEL; 
     363    try { 
     364        result = COM.DoDragDrop(iDataObject, iDropSource, operations, pdwEffect.ptr); 
     365    } finally { 
     366        // ensure that we don't leave transparent window around 
     367        if (hwndDrag !is null) { 
     368            OS.ImageList_DragLeave(hwndDrag); 
     369            OS.ImageList_EndDrag(); 
     370            imagelist.dispose(); 
     371            if (hwndDrag !is topControl.handle) OS.DestroyWindow(hwndDrag); 
     372            hwndDrag = null; 
     373            topControl = null; 
     374        } 
     375        display.setData(key, oldValue); 
     376    } 
    336377    int operation = osToOp(pdwEffect[0]); 
    337378    if (dataEffect is DND.DROP_MOVE) { 
     
    460501 
    461502package .LRESULT QueryContinueDrag(int fEscapePressed, DWORD grfKeyState) { 
     503    if (topControl !is null && topControl.isDisposed()) return COM.DRAGDROP_S_CANCEL; 
    462504    if (fEscapePressed !is 0){ 
    463         if (topControl !is null) OS.ImageList_DragLeave(topControl.handle); 
     505        if (hwndDrag !is null) OS.ImageList_DragLeave(hwndDrag); 
    464506        return COM.DRAGDROP_S_CANCEL; 
    465507    } 
     
    473515//  if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2; 
    474516    if ((grfKeyState & mask) is 0) { 
    475         if (topControl !is null) OS.ImageList_DragLeave(topControl.handle); 
     517        if (hwndDrag !is null) OS.ImageList_DragLeave(hwndDrag); 
    476518        return COM.DRAGDROP_S_DROP; 
    477519    } 
    478520 
    479     if (topControl !is null) { 
    480         Display display = getDisplay(); 
    481         Point pt = display.getCursorLocation(); 
    482         Point location = topControl.getLocation(); 
    483         OS.ImageList_DragMove(pt.x - location.x, pt.y - location.y); 
     521    if (hwndDrag !is null) { 
     522        POINT pt; 
     523        OS.GetCursorPos (&pt); 
     524        RECT rect; 
     525        OS.GetWindowRect (hwndDrag, &rect); 
     526        OS.ImageList_DragMove (pt.x - rect.left, pt.y - rect.top); 
    484527    } 
    485528    return COM.S_OK; 
  • dwt/dnd/TableDragSourceEffect.d

    r146 r194  
    100100            auto hDC = OS.GetDC(null); 
    101101            auto hDC1 = OS.CreateCompatibleDC(hDC); 
     102            if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) { 
     103                if ((table.getStyle() & DWT.RIGHT_TO_LEFT) !is 0) { 
     104                    OS.SetLayout(hDC1, OS.LAYOUT_RTL | OS.LAYOUT_BITMAPORIENTATIONPRESERVED); 
     105                } 
     106            } 
    102107            auto bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height); 
    103108            auto hOldBitmap = OS.SelectObject(hDC1, bitmap); 
  • dwt/dnd/TreeDragSourceEffect.d

    r143 r194  
    9797                bounds = bounds.makeUnion(selection[i].getBounds(0)); 
    9898            } 
    99             auto hDC = OS.GetDC(null); 
     99            auto hDC = OS.GetDC(tree.handle); 
    100100            auto hDC1 = OS.CreateCompatibleDC(hDC); 
    101101            auto bitmap = OS.CreateCompatibleBitmap(hDC, bounds.width, bounds.height); 
     
    115115            OS.SelectObject(hDC1, hOldBitmap); 
    116116            OS.DeleteDC (hDC1); 
    117             OS.ReleaseDC (null, hDC); 
     117            OS.ReleaseDC (tree.handle, hDC); 
    118118            Display display = tree.getDisplay(); 
    119119            dragSourceImage = Image.win32_new(display, DWT.BITMAP, bitmap); 
  • dwt/dwthelper/utils.d

    r190 r194  
    1111import tango.io.Stdout; 
    1212import tango.stdc.stringz; 
    13 import tango.text.Util; 
     13static import tango.text.Util; 
    1414import tango.text.Unicode; 
    1515import tango.text.convert.Utf; 
  • dwt/graphics/GC.d

    r117 r194  
    37153715    data.state &= ~(NULL_BRUSH | NULL_PEN); 
    37163716    auto hFont = data.hFont; 
    3717     if (hFont !is null) { 
     3717    if (hFont !is null && hFont !is cast(HFONT)-1 ) { 
    37183718        data.state &= ~FONT; 
    37193719    } else { 
    3720         hFont = OS.GetCurrentObject(hDC, OS.OBJ_FONT); 
     3720        data.hFont = OS.GetCurrentObject(hDC, OS.OBJ_FONT); 
    37213721    } 
    37223722    auto hPalette = data.device.hPalette; 
  • dwt/internal/Library.d

    r4 r194  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    3434     * DWT Minor version number (must be in the range 0..999) 
    3535     */ 
    36     static const int MINOR_VERSION = 346
     36    static const int MINOR_VERSION = 349
    3737 
    3838    /** 
  • dwt/internal/win32/OS.d

    r190 r194  
    10411041    public static const int LANG_USER_DEFAULT = 1 << 10; 
    10421042    public static const int LAYOUT_RTL = 0x1; 
     1043    public static const int LAYOUT_BITMAPORIENTATIONPRESERVED = 0x8; 
    10431044    public static const int LBN_DBLCLK = 0x2; 
    10441045    public static const int LBN_SELCHANGE = 0x1; 
  • dwt/widgets/Decorations.d

    r117 r194  
    446446        setSystemMenu (); 
    447447    } 
    448     /* 
    449     * Set the default icon for the shell to IDI_APPLICATION. 
    450     * This is not necessary for native applications but later 
    451     * versions of Java set the icon in javaw.exe instead of 
    452     * leaving the default. 
    453     * 
    454     * NOTE:  The icon is not leaked.  It is shared within 
    455     * the process by all threads and is released when the 
    456     * process exits. 
    457     */ 
    458     if ((state & FOREIGN_HANDLE) is 0) { 
    459         static if (!OS.IsWinCE) { 
    460             auto hIcon = OS.LoadIcon (null, cast(wchar*)OS.IDI_APPLICATION); 
    461             OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hIcon); 
    462         } 
    463     } 
    464448} 
    465449 
     
    10291013            default: 
    10301014        } 
    1031     } else { 
    1032         /* 
    1033         * Set the default icon for the shell to IDI_APPLICATION. 
    1034         * This is not necessary for native applications but later 
    1035         * versions of Java set the icon in javaw.exe instead of 
    1036         * leaving the default. 
    1037         * 
    1038         * NOTE:  The icon is not leaked.  It is shared within 
    1039         * the process by all threads and is released when the 
    1040         * process exits. 
    1041         */ 
    1042         if ((state & FOREIGN_HANDLE) is 0) { 
    1043             hSmallIcon = OS.LoadIcon (null, cast(wchar*)OS.IDI_APPLICATION); 
    1044         } 
    10451015    } 
    10461016    OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hSmallIcon); 
  • dwt/widgets/Synchronizer.d

    r57 r194  
    4747    Thread syncThread; 
    4848 
     49    //TEMPORARY CODE 
     50    static final bool IS_CARBON = false;//"carbon".equals (DWT.getPlatform ()); 
     51 
    4952/** 
    5053 * Constructs a new instance of this class. 
     
    8588public void asyncExec (Runnable runnable) { 
    8689    if (runnable is null) { 
    87         display.wake (); 
    88         return; 
     90        //TEMPORARY CODE 
     91        if (!IS_CARBON) { 
     92            display.wake (); 
     93            return; 
     94        } 
    8995    } 
    9096    addLast (new RunnableLock (runnable)); 
  • dwt/widgets/TableColumn.d

    r162 r194  
    562562    auto hwnd = parent.handle; 
    563563    LVCOLUMN lvColumn; 
    564     lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE
     564    lvColumn.mask = OS.LVCF_FMT
    565565    OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, &lvColumn); 
    566566    lvColumn.fmt &= ~OS.LVCFMT_JUSTIFYMASK;