*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
{
TTTOOL_INFO *toolPtr;
- RECT rect, wndrect;
+ HMONITOR monitor;
+ MONITORINFO mon_info;
+ RECT rect;
SIZE size;
NMHDR hdr;
int ptfx = 0;
TRACE("%s\n", debugstr_w(infoPtr->szTipText));
TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
- TRACE("size %ld x %ld\n", size.cx, size.cy);
+ TRACE("size %d x %d\n", size.cx, size.cy);
if (toolPtr->uFlags & TTF_CENTERTIP) {
RECT rc;
}
}
- TRACE("pos %ld - %ld\n", rect.left, rect.top);
+ TRACE("pos %d - %d\n", rect.left, rect.top);
rect.right = rect.left + size.cx;
rect.bottom = rect.top + size.cy;
/* check position */
- wndrect.right = GetSystemMetrics( SM_CXSCREEN );
- if( rect.right > wndrect.right ) {
- rect.left -= rect.right - wndrect.right + 2;
- rect.right = wndrect.right - 2;
+
+ monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
+ mon_info.cbSize = sizeof(mon_info);
+ GetMonitorInfoW( monitor, &mon_info );
+
+ if( rect.right > mon_info.rcWork.right ) {
+ rect.left -= rect.right - mon_info.rcWork.right + 2;
+ rect.right = mon_info.rcWork.right - 2;
}
- wndrect.bottom = GetSystemMetrics( SM_CYSCREEN );
- if( rect.bottom > wndrect.bottom ) {
+ if (rect.left < mon_info.rcWork.left) rect.left = mon_info.rcWork.left;
+
+ if( rect.bottom > mon_info.rcWork.bottom ) {
RECT rc;
if (toolPtr->uFlags & TTF_IDISHWND)
TRACE("%s\n", debugstr_w(infoPtr->szTipText));
TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
- TRACE("size %ld x %ld\n", size.cx, size.cy);
+ TRACE("size %d x %d\n", size.cx, size.cy);
if (toolPtr->uFlags & TTF_ABSOLUTE) {
rect.left = infoPtr->xTrackPos;
rect.left = rcTool.right;
}
- TRACE("pos %ld - %ld\n", rect.left, rect.top);
+ TRACE("pos %d - %d\n", rect.left, rect.top);
rect.right = rect.left + size.cx;
rect.bottom = rect.top + size.cy;
TRACE("tool %d\n", nTool);
TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
- TRACE("size %ld x %ld\n", size.cx, size.cy);
+ TRACE("size %d x %d\n", size.cx, size.cy);
return MAKELRESULT(size.cx, size.cy);
}
LPTTTOOLINFOA lpToolInfo = (LPTTTOOLINFOA)lParam;
TTTOOL_INFO *toolPtr;
- if (lpToolInfo == NULL)
- return FALSE;
- if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
- return FALSE;
-
if (lpToolInfo) {
+ if (lpToolInfo->cbSize < TTTOOLINFOA_V1_SIZE)
+ return FALSE;
+
if (infoPtr->nCurrentTool > -1) {
toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
LPTTTOOLINFOW lpToolInfo = (LPTTTOOLINFOW)lParam;
TTTOOL_INFO *toolPtr;
- if (lpToolInfo == NULL)
- return FALSE;
- if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
- return FALSE;
-
if (lpToolInfo) {
+ if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
+ return FALSE;
+
if (infoPtr->nCurrentTool > -1) {
toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
break;
case WM_MOUSEMOVE:
- pt.x = LOWORD(lpMsg->lParam);
- pt.y = HIWORD(lpMsg->lParam);
+ pt.x = (short)LOWORD(lpMsg->lParam);
+ pt.y = (short)HIWORD(lpMsg->lParam);
nOldTool = infoPtr->nTool;
infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr, lpMsg->hwnd,
&pt);
TRACE("tool (%p) %d %d %d\n", hwnd, nOldTool,
infoPtr->nTool, infoPtr->nCurrentTool);
- TRACE("WM_MOUSEMOVE (%p %ld %ld)\n", hwnd, pt.x, pt.y);
+ TRACE("WM_MOUSEMOVE (%p %d %d)\n", hwnd, pt.x, pt.y);
if (infoPtr->nTool != nOldTool) {
if(infoPtr->nTool == -1) { /* Moved out of all tools */
else {
if ( (toolPtr->lpszText) &&
!IS_INTRESOURCE(toolPtr->lpszText) ) {
- Free (toolPtr->lpszText);
+ if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
+ Free (toolPtr->lpszText);
toolPtr->lpszText = NULL;
}
if (lpToolInfo->lpszText) {
else {
if ( (toolPtr->lpszText) &&
!IS_INTRESOURCE(toolPtr->lpszText) ) {
- Free (toolPtr->lpszText);
+ if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
+ Free (toolPtr->lpszText);
toolPtr->lpszText = NULL;
}
if (lpToolInfo->lpszText) {
else {
if ( (toolPtr->lpszText) &&
!IS_INTRESOURCE(toolPtr->lpszText) ) {
- Free (toolPtr->lpszText);
+ if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
+ Free (toolPtr->lpszText);
toolPtr->lpszText = NULL;
}
if (lpToolInfo->lpszText) {
else {
if ( (toolPtr->lpszText) &&
!IS_INTRESOURCE(toolPtr->lpszText) ) {
- Free (toolPtr->lpszText);
+ if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
+ Free (toolPtr->lpszText);
toolPtr->lpszText = NULL;
}
if (lpToolInfo->lpszText) {
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
- dwStyle &= 0x0000FFFF;
+ dwStyle &= ~(WS_CHILD | /*WS_MAXIMIZE |*/ WS_BORDER | WS_DLGFRAME);
dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
/* WS_BORDER only draws a border round the window rect, not the