comparison android/dw.cpp @ 2532:457c91634881

Added dw_window_compare() to check if two window handles refer to the same object. Most platforms just compare the pointer or handle, but Android uses IsSameObject().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 11 May 2021 05:00:07 +0000
parents f45ebd96ebe5
children 7c863a3a125f
comparison
equal deleted inserted replaced
2531:f45ebd96ebe5 2532:457c91634881
3572 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); 3572 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
3573 // Get the method that you want to call 3573 // Get the method that you want to call
3574 jmethodID pixmapBitBlt = env->GetMethodID(clazz, "pixmapBitBlt", 3574 jmethodID pixmapBitBlt = env->GetMethodID(clazz, "pixmapBitBlt",
3575 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIILorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIII)I"); 3575 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIILorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIII)I");
3576 // Call the method on the object 3576 // Call the method on the object
3577 retval = env->CallIntMethod(_dw_obj, pixmapBitBlt, dest, destp->bitmap, xdest, ydest, width, height, src, srcp->bitmap, xsrc, ysrc, srcwidth, srcheight); 3577 retval = env->CallIntMethod(_dw_obj, pixmapBitBlt, dest, destp ? destp->bitmap : NULL, xdest, ydest, width, height, src, srcp ? srcp->bitmap : NULL, xsrc, ysrc, srcwidth, srcheight);
3578 } 3578 }
3579 return retval; 3579 return retval;
3580 } 3580 }
3581 3581
3582 /* 3582 /*
4789 "(Landroid/view/View;Ljava/lang/String;)J"); 4789 "(Landroid/view/View;Ljava/lang/String;)J");
4790 // Call the method on the object 4790 // Call the method on the object
4791 retval = (void *)env->CallLongMethod(_dw_obj, windowGetData, window, jstr); 4791 retval = (void *)env->CallLongMethod(_dw_obj, windowGetData, window, jstr);
4792 } 4792 }
4793 return retval; 4793 return retval;
4794 }
4795
4796 /*
4797 * Compare two window handles.
4798 * Parameters:
4799 * window1: First window handle to compare.
4800 * window2: Second window handle to compare.
4801 * Returns:
4802 * TRUE if the windows are the same object, FALSE if not.
4803 */
4804 int API dw_window_compare(HWND window1, HWND window2)
4805 {
4806 JNIEnv *env;
4807 void *retval = nullptr;
4808
4809 if(window1 && window2 && (env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
4810 {
4811 if(env->IsSameObject(window1, window2))
4812 return TRUE;
4813 }
4814 return FALSE;
4794 } 4815 }
4795 4816
4796 /* 4817 /*
4797 * Add a callback to a timer event. 4818 * Add a callback to a timer event.
4798 * Parameters: 4819 * Parameters: