fix some MinGW compiling errors
This commit is contained in:
		
							parent
							
								
									766b9a1e24
								
							
						
					
					
						commit
						ad0dcc0bcf
					
				@ -550,7 +550,7 @@ namespace detail
 | 
				
			|||||||
		::ScreenToClient(reinterpret_cast<HWND>(wd->root), &point);
 | 
							::ScreenToClient(reinterpret_cast<HWND>(wd->root), &point);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		arg.upwards = (pmdec.mouse.button.wheel_delta >= 0);
 | 
							arg.upwards = (pmdec.mouse.button.wheel_delta >= 0);
 | 
				
			||||||
		arg.distance = std::abs(pmdec.mouse.button.wheel_delta);
 | 
							arg.distance = static_cast<unsigned>(arg.upwards ? pmdec.mouse.button.wheel_delta : -pmdec.mouse.button.wheel_delta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		arg.pos.x = static_cast<int>(point.x) - wd->pos_root.x;
 | 
							arg.pos.x = static_cast<int>(point.x) - wd->pos_root.x;
 | 
				
			||||||
		arg.pos.y = static_cast<int>(point.y) - wd->pos_root.y;
 | 
							arg.pos.y = static_cast<int>(point.y) - wd->pos_root.y;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,7 @@
 | 
				
			|||||||
#include <nana/internationalization.hpp>
 | 
					#include <nana/internationalization.hpp>
 | 
				
			||||||
#include <nana/gui/filebox.hpp>
 | 
					#include <nana/gui/filebox.hpp>
 | 
				
			||||||
#include <functional>
 | 
					#include <functional>
 | 
				
			||||||
 | 
					#include <cstdlib>  //include std::abs
 | 
				
			||||||
#if defined(NANA_WINDOWS)
 | 
					#if defined(NANA_WINDOWS)
 | 
				
			||||||
	#include <windows.h>
 | 
						#include <windows.h>
 | 
				
			||||||
#elif defined(NANA_X11)
 | 
					#elif defined(NANA_X11)
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,6 @@ namespace nana{ namespace system{
 | 
				
			|||||||
			HDC hDC = ::GetDC(NULL);
 | 
								HDC hDC = ::GetDC(NULL);
 | 
				
			||||||
			if (::GetDIBits(hDC, (HBITMAP)g.pixmap(), 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS) == 0) {
 | 
								if (::GetDIBits(hDC, (HBITMAP)g.pixmap(), 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS) == 0) {
 | 
				
			||||||
				assert(false);
 | 
									assert(false);
 | 
				
			||||||
				int err = ::GetLastError();
 | 
					 | 
				
			||||||
				::ReleaseDC(NULL, hDC);
 | 
									::ReleaseDC(NULL, hDC);
 | 
				
			||||||
				return false;
 | 
									return false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -72,10 +71,7 @@ namespace nana{ namespace system{
 | 
				
			|||||||
			// Bitmaps are huge, so to avoid unnegligible extra copy, this routine does not use private _m_set method.
 | 
								// Bitmaps are huge, so to avoid unnegligible extra copy, this routine does not use private _m_set method.
 | 
				
			||||||
			HGLOBAL h_gmem = ::GlobalAlloc(GHND | GMEM_SHARE, header_size + bitmap_bytes);
 | 
								HGLOBAL h_gmem = ::GlobalAlloc(GHND | GMEM_SHARE, header_size + bitmap_bytes);
 | 
				
			||||||
			void * gmem = ::GlobalLock(h_gmem);
 | 
								void * gmem = ::GlobalLock(h_gmem);
 | 
				
			||||||
			if (!gmem) {
 | 
								if (gmem) {
 | 
				
			||||||
				assert(false);
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
                char* p = (char*)gmem;
 | 
					                char* p = (char*)gmem;
 | 
				
			||||||
                // Fix BITMAPINFOHEADER obtained from GetDIBits WinAPI
 | 
					                // Fix BITMAPINFOHEADER obtained from GetDIBits WinAPI
 | 
				
			||||||
                bmi.bmiHeader.biCompression = BI_RGB;
 | 
					                bmi.bmiHeader.biCompression = BI_RGB;
 | 
				
			||||||
@ -87,26 +83,14 @@ namespace nana{ namespace system{
 | 
				
			|||||||
                    memcpy(p, pbuffer.raw_ptr(bmi.bmiHeader.biHeight - 1 - y), bytes_per_line);
 | 
					                    memcpy(p, pbuffer.raw_ptr(bmi.bmiHeader.biHeight - 1 - y), bytes_per_line);
 | 
				
			||||||
                    p += bytes_per_line;
 | 
					                    p += bytes_per_line;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
			if (!::GlobalUnlock(h_gmem) && GetLastError() != NO_ERROR) {
 | 
					                if (::GlobalUnlock(h_gmem) || GetLastError() == NO_ERROR)
 | 
				
			||||||
				assert(false);
 | 
					                    if (::OpenClipboard(::GetFocus()))
 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					                        if (::EmptyClipboard())
 | 
				
			||||||
			}
 | 
					                            if (::SetClipboardData(CF_DIB, h_gmem))
 | 
				
			||||||
			if (!::OpenClipboard(::GetFocus())) {
 | 
					                                if (::CloseClipboard())
 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::EmptyClipboard()) {
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::SetClipboardData(CF_DIB, h_gmem)) {
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::CloseClipboard()) {
 | 
					 | 
				
			||||||
				// really?
 | 
					 | 
				
			||||||
				return false;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
                                    return true;
 | 
					                                    return true;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		Label_GlobalFree:
 | 
							    assert(false);
 | 
				
			||||||
			::GlobalFree(h_gmem);
 | 
								::GlobalFree(h_gmem);
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user