This is an automatically generated mail from the syncmail system. Do not reply directly to this email. Further discussion should take place on the hackers list: perl-win32-gui-hack...@lists.sourceforge.net
Update of /cvsroot/perl-win32-gui/Win32-GUI In directory vz-cvs-2.sog:/tmp/cvs-serv30632 Modified Files: CHANGELOG GUI.h GUI.xs GUI_Helpers.cpp GUI_Options.cpp Log Message: Fixed -background GDI object leak, added -newui option for BrowseForFolder Index: GUI_Options.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Options.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GUI_Options.cpp 8 Apr 2010 21:26:48 -0000 1.17 --- GUI_Options.cpp 16 Jul 2011 14:51:03 -0000 1.18 *************** *** 58,62 **** eventID = PERLWIN32GUI_NEM_TIMER; } else if(strcmp(name, "Paint") == 0) { ! eventID = PERLWIN32GUI_NEM_PAINT; } else if(strcmp(name, "Click") == 0) { eventID = PERLWIN32GUI_NEM_CLICK; --- 58,62 ---- eventID = PERLWIN32GUI_NEM_TIMER; } else if(strcmp(name, "Paint") == 0) { ! eventID = PERLWIN32GUI_NEM_PAINT; } else if(strcmp(name, "Click") == 0) { eventID = PERLWIN32GUI_NEM_CLICK; *************** *** 72,78 **** eventID = PERLWIN32GUI_NEM_LOSTFOCUS; } else if(strcmp(name, "DropFiles") == 0) { ! eventID = PERLWIN32GUI_NEM_DROPFILE; } else if(strcmp(name, "Char") == 0) { ! eventID = PERLWIN32GUI_NEM_CHAR; } else { W32G_WARN("Win32::GUI: Unrecognized event name '%s' in -names!", name); --- 72,78 ---- eventID = PERLWIN32GUI_NEM_LOSTFOCUS; } else if(strcmp(name, "DropFiles") == 0) { ! eventID = PERLWIN32GUI_NEM_DROPFILE; } else if(strcmp(name, "Char") == 0) { ! eventID = PERLWIN32GUI_NEM_CHAR; } else { W32G_WARN("Win32::GUI: Unrecognized event name '%s' in -names!", name); *************** *** 81,85 **** if(eventID != 0) { // Clear current event if necessary ! if ( hv_exists(perlcs->hvEvents, name, strlen(name)) ) hv_delete(perlcs->hvEvents, name, strlen(name),G_DISCARD); // Store event --- 81,85 ---- if(eventID != 0) { // Clear current event if necessary ! if ( hv_exists(perlcs->hvEvents, name, strlen(name)) ) hv_delete(perlcs->hvEvents, name, strlen(name),G_DISCARD); // Store event *************** *** 89,93 **** SwitchBit(perlcs->dwEventMask, eventID, 1); } else { ! SwitchBit(perlcs->dwEventMask, eventID, 0); } } --- 89,93 ---- SwitchBit(perlcs->dwEventMask, eventID, 1); } else { ! SwitchBit(perlcs->dwEventMask, eventID, 0); } } *************** *** 124,128 **** if(strcmp(option, "-class") == 0) { next_i = i + 1; ! perlcs->cs.lpszClass = (LPCTSTR) classname_From(NOTXSCALL ST(next_i)); } else if(strcmp(option, "-text") == 0 || strcmp(option, "-caption") == 0 --- 124,128 ---- if(strcmp(option, "-class") == 0) { next_i = i + 1; ! perlcs->cs.lpszClass = (LPCTSTR) classname_From(NOTXSCALL ST(next_i)); } else if(strcmp(option, "-text") == 0 || strcmp(option, "-caption") == 0 *************** *** 201,208 **** lb.lbStyle = BS_SOLID; lb.lbColor = perlcs->clrBackground; ! if(perlcs->hBackgroundBrush != NULL) { DeleteObject((HGDIOBJ) perlcs->hBackgroundBrush); } perlcs->hBackgroundBrush = CreateBrushIndirect(&lb); } storing = newSViv((IV) perlcs->clrBackground); --- 201,209 ---- lb.lbStyle = BS_SOLID; lb.lbColor = perlcs->clrBackground; ! if(perlcs->hBackgroundBrush != NULL && perlcs->bDeleteBackgroundBrush) { DeleteObject((HGDIOBJ) perlcs->hBackgroundBrush); } perlcs->hBackgroundBrush = CreateBrushIndirect(&lb); + perlcs->bDeleteBackgroundBrush = TRUE; } storing = newSViv((IV) perlcs->clrBackground); *************** *** 210,213 **** --- 211,223 ---- storing = newSViv((IV) perlcs->hBackgroundBrush); stored = hv_store_mg(NOTXSCALL perlcs->hvSelf, "-backgroundbrush", 16, storing, 0); + } else if(strcmp(option, "-backgroundbrush") == 0) { + next_i = i + 1; + if(perlcs->hBackgroundBrush != NULL && perlcs->bDeleteBackgroundBrush) { + DeleteObject((HGDIOBJ) perlcs->hBackgroundBrush); + } + perlcs->hBackgroundBrush = (HBRUSH) handle_From(NOTXSCALL ST(next_i));; + perlcs->bDeleteBackgroundBrush = FALSE; + storing = newSViv((IV) perlcs->hBackgroundBrush); + stored = hv_store_mg(NOTXSCALL perlcs->hvSelf, "-backgroundbrush", 16, storing, 0); } else if(strcmp(option, "-size") == 0) { next_i = i + 1; *************** *** 297,301 **** SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_NEM, 0); SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_OEM, 1); ! } else if(stricmp(SvPV_nolen(ST(next_i)), "byref") == 0) { SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_NEM, 1); SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_OEM, 0); --- 307,311 ---- SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_NEM, 0); SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_OEM, 1); ! } else if(stricmp(SvPV_nolen(ST(next_i)), "byref") == 0) { SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_NEM, 1); SwitchBit(perlcs->dwPlStyle, PERLWIN32GUI_OEM, 0); *************** *** 613,617 **** LPREBARBANDINFO rbbi, int * index) { ! int i, next_i; char * option; --- 623,627 ---- LPREBARBANDINFO rbbi, int * index) { ! int i, next_i; char * option; *************** *** 748,752 **** if(strcmp(option, "-text") == 0) { next_i = i + 1; ! if(SvPOK(ST(next_i))) ti->lpszText = SvPV_nolen(ST(next_i)); else if (SvIOK(ST(next_i))) --- 758,762 ---- if(strcmp(option, "-text") == 0) { next_i = i + 1; ! if(SvPOK(ST(next_i))) ti->lpszText = SvPV_nolen(ST(next_i)); else if (SvIOK(ST(next_i))) *************** *** 864,868 **** if(eventID != 0) { // Clear current event if necessary ! if ( hv_exists(hvEvents, name, strlen(name)) ) hv_delete(hvEvents, name, strlen(name),G_DISCARD); // Store event --- 874,878 ---- if(eventID != 0) { // Clear current event if necessary ! if ( hv_exists(hvEvents, name, strlen(name)) ) hv_delete(hvEvents, name, strlen(name),G_DISCARD); // Store event *************** *** 911,915 **** #endif } ! next_i = -1; for(i = from_i; i < items; i++) { --- 921,925 ---- #endif } ! next_i = -1; for(i = from_i; i < items; i++) { *************** *** 940,947 **** char* key; I32 keylen; ! if (hvEvents == NULL) hvEvents = newHV(); ! hash = (HV*) SvRV(ST(next_i)); hv_iterinit( hash ); --- 950,957 ---- char* key; I32 keylen; ! if (hvEvents == NULL) hvEvents = newHV(); ! hash = (HV*) SvRV(ST(next_i)); hv_iterinit( hash ); *************** *** 952,956 **** } else if(strncmp(option, "-on", 3) == 0 && (char) option[3] >= 'A' && (char) option[3] <= 'Z') { next_i = i + 1; ! if (hvEvents == NULL) hvEvents = newHV(); --- 962,966 ---- } else if(strncmp(option, "-on", 3) == 0 && (char) option[3] >= 'A' && (char) option[3] <= 'Z') { next_i = i + 1; ! if (hvEvents == NULL) hvEvents = newHV(); *************** *** 994,1001 **** } } ! // if we found events, store it into parent window. if (hvEvents != NULL) { ! SV* svParent = SV_SELF_FROM_WINDOW (nid->hWnd); if (svParent != NULL && nid->uID != 0) { --- 1004,1011 ---- } } ! // if we found events, store it into parent window. if (hvEvents != NULL) { ! SV* svParent = SV_SELF_FROM_WINDOW (nid->hWnd); if (svParent != NULL && nid->uID != 0) { *************** *** 1014,1018 **** // Get notifyicon object from parent SV** notifyicon = hv_fetch_mg(NOTXSCALL (HV*) SvRV(svParent), NotifyIconName, strlen(NotifyIconName), FALSE); ! if(notifyicon != NULL && SvROK(*notifyicon)) { // Get NEM Events Hash sv** events = hv_fetch_mg(NOTXSCALL (HV*) SvRV(*notifyicon), "-events", 7, FALSE); --- 1024,1028 ---- // Get notifyicon object from parent SV** notifyicon = hv_fetch_mg(NOTXSCALL (HV*) SvRV(svParent), NotifyIconName, strlen(NotifyIconName), FALSE); ! if(notifyicon != NULL && SvROK(*notifyicon)) { // Get NEM Events Hash sv** events = hv_fetch_mg(NOTXSCALL (HV*) SvRV(*notifyicon), "-events", 7, FALSE); *************** *** 1025,1029 **** while ( val = hv_iternextsv( hvEvents, &key, &keylen ) ) { if ( hv_exists((HV*) SvRV(*events), key, keylen) ) ! hv_delete((HV*) SvRV(*events), key, keylen, G_DISCARD); hv_store_mg(NOTXSCALL (HV*) SvRV(*events), key, keylen, newSVsv(val), 0); } --- 1035,1039 ---- while ( val = hv_iternextsv( hvEvents, &key, &keylen ) ) { if ( hv_exists((HV*) SvRV(*events), key, keylen) ) ! hv_delete((HV*) SvRV(*events), key, keylen, G_DISCARD); hv_store_mg(NOTXSCALL (HV*) SvRV(*events), key, keylen, newSVsv(val), 0); } Index: GUI.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.xs,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** GUI.xs 8 Apr 2010 21:26:48 -0000 1.68 --- GUI.xs 16 Jul 2011 14:51:03 -0000 1.69 *************** *** 731,734 **** --- 731,735 ---- perlud->clrBackground = perlcs.clrBackground; perlud->hBackgroundBrush = perlcs.hBackgroundBrush; + perlud->bDeleteBackgroundBrush = perlcs.bDeleteBackgroundBrush; perlud->hvEvents = perlcs.hvEvents; perlud->dwEventMask = perlcs.dwEventMask; *************** *** 927,930 **** --- 928,932 ---- perlcs.clrBackground = perlud->clrBackground; perlcs.hBackgroundBrush = perlud->hBackgroundBrush; + perlcs.bDeleteBackgroundBrush = perlud->bDeleteBackgroundBrush; perlcs.hvEvents = perlud->hvEvents; perlcs.dwEventMask = perlud->dwEventMask; *************** *** 944,947 **** --- 946,950 ---- printf("XS(Change): BEFORE clrBackground = 0x%x\n", perlcs.clrBackground); printf("XS(Change): BEFORE hBackgroundBrush = 0x%x\n", perlcs.hBackgroundBrush); + printf("XS(Change): BEFORE bDeleteBackgroundBrush = %d\n", perlcs.bDeleteBackgroundBrush); #endif // #### parse new window options *************** *** 970,973 **** --- 973,977 ---- printf("XS(Change): AFTER clrBackground = 0x%x\n", perlcs.clrBackground); printf("XS(Change): AFTER hBackgroundBrush = 0x%x\n", perlcs.hBackgroundBrush); + printf("XS(Change): AFTER bDeleteBackgroundBrush = %d\n", perlcs.bDeleteBackgroundBrush); #endif // #### Perform changes *************** *** 987,990 **** --- 991,995 ---- perlud->clrBackground = perlcs.clrBackground; perlud->hBackgroundBrush = perlcs.hBackgroundBrush; + perlud->bDeleteBackgroundBrush = perlcs.bDeleteBackgroundBrush; perlud->hvEvents = perlcs.hvEvents; perlud->dwEventMask = perlcs.dwEventMask; *************** *** 5166,5169 **** --- 5171,5178 ---- # -includefiles => 0/1 (default 0) # the list will include files as well folders + # -newui => 0/1 (default 0) + # use the "new" user interface (which has a "New folder" button) + # -nonewfolder => 0/1 (default 0) + # hides the "New folder" button (only meaningful with -newui => 1) # -owner => WINDOW # A Win32::GUI::Window or Win32::GUI::DialogBox object specifiying the *************** *** 5312,5315 **** --- 5321,5326 ---- } else BitmaskOption("-includefiles", bi.ulFlags, BIF_BROWSEINCLUDEFILES) } else BitmaskOption("-printeronly", bi.ulFlags, BIF_BROWSEFORPRINTER) + } else BitmaskOption("-newui", bi.ulFlags, BIF_NEWDIALOGSTYLE) + } else BitmaskOption("-nonewfolder", bi.ulFlags, BIF_NONEWFOLDERBUTTON) } else if(strcmp(option, "-directory") == 0) { next_i = i + 1; Index: GUI.h =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** GUI.h 8 Apr 2010 21:26:48 -0000 1.32 --- GUI.h 16 Jul 2011 14:51:03 -0000 1.33 *************** *** 271,274 **** --- 271,275 ---- COLORREF clrBackground; HBRUSH hBackgroundBrush; + BOOL bDeleteBackgroundBrush; HV* hvEvents; DWORD dwEventMask; *************** *** 296,299 **** --- 297,301 ---- COLORREF clrBackground; HBRUSH hBackgroundBrush; + BOOL bDeleteBackgroundBrush; WNDPROC WndProc; HV* hvEvents; Index: GUI_Helpers.cpp =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Helpers.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** GUI_Helpers.cpp 8 Apr 2010 21:26:48 -0000 1.27 --- GUI_Helpers.cpp 16 Jul 2011 14:51:03 -0000 1.28 *************** *** 124,128 **** perlud->userData = NULL; } ! // If we stored an original wndproc, then restore it so that // WM_NCDESTORY messages get there. --- 124,133 ---- perlud->userData = NULL; } ! ! // If we stored a brush, destroy it ! if (perlud->bDeleteBackgroundBrush && perlud->hBackgroundBrush != NULL) { ! DeleteObject((HGDIOBJ) perlud->hBackgroundBrush); ! } ! // If we stored an original wndproc, then restore it so that // WM_NCDESTORY messages get there. *************** *** 130,134 **** SetWindowLongPtr(hwnd_self, GWLP_WNDPROC, (IV)(perlud->WndProc)); } ! // Free perlpud safefree (perlud); --- 135,139 ---- SetWindowLongPtr(hwnd_self, GWLP_WNDPROC, (IV)(perlud->WndProc)); } ! // Free perlpud safefree (perlud); *************** *** 201,205 **** pHv = hv_fetch_mg(NOTXSCALL (HV*) SvRV(pSv), "-handle", 7, 0); if(pHv != NULL) { ! hReturn = INT2PTR(HWND,SvIV(*pHv)); //printf("hReturn(1) is %i \n",hReturn); --- 206,210 ---- pHv = hv_fetch_mg(NOTXSCALL (HV*) SvRV(pSv), "-handle", 7, 0); if(pHv != NULL) { ! hReturn = INT2PTR(HWND,SvIV(*pHv)); //printf("hReturn(1) is %i \n",hReturn); *************** *** 635,639 **** void DrawSplitter(NOTXSPROC HWND hwnd, int x, int y, int w, int h) { ! static WORD _dotPatternBmp[8] = { 0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055}; --- 640,644 ---- void DrawSplitter(NOTXSPROC HWND hwnd, int x, int y, int w, int h) { ! static WORD _dotPatternBmp[8] = { 0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055, 0x00aa, 0x0055}; *************** *** 758,762 **** if(ValidUserData(perlud)) { PERLUD_FETCH; /* fetch context */ ! //Tracker 1941264: Check if perlud->avHooks contains NULL. This was causing //a crash although it should not be possible that this is zero. It's likely --- 763,767 ---- if(ValidUserData(perlud)) { PERLUD_FETCH; /* fetch context */ ! //Tracker 1941264: Check if perlud->avHooks contains NULL. This was causing //a crash although it should not be possible that this is zero. It's likely Index: CHANGELOG =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** CHANGELOG 8 Apr 2010 21:26:48 -0000 1.149 --- CHANGELOG 16 Jul 2011 14:51:03 -0000 1.150 *************** *** 6,9 **** --- 6,15 ---- Win32-GUI ChangeLog =================== + + [Aldo Calpini] : 16 July 2011 - Fixed -background GDI object leak, added -newui option for BrowseForFolder + - GUI.h + - GUI.xs + - GUI_Helpers.cpp + - GUI_Options.cpp + + [Jeremy White] : 08 April 2010 - Initial change to build with a 64bit compiler - DC.xs ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Perl-win32-gui-cvscommit mailing list Perl-win32-gui-cvscommit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-cvscommit http://perl-win32-gui.sourceforge.net/