28
28
#endif
29
29
30
30
#include <dlfcn.h>
31
- #include "jni_util.h"
32
- #include "awt.h"
33
31
#include "screencast_pipewire.h"
34
32
#include "fp_pipewire.h"
35
33
#include <stdio.h>
36
34
37
- #include "gtk_interface.h"
38
- #include "gtk3_interface.h"
35
+ extern JNIEnv * mainEnv ;
39
36
40
37
int DEBUG_SCREENCAST_ENABLED = FALSE;
41
38
@@ -675,7 +672,6 @@ static gboolean isAllDataReady() {
675
672
676
673
677
674
static void * pipewire_libhandle = NULL ;
678
- //glib_version_2_68 false for gtk2, as it comes from gtk3_interface.c
679
675
680
676
extern gboolean glib_version_2_68 ;
681
677
@@ -689,13 +685,7 @@ extern gboolean glib_version_2_68;
689
685
} while(0);
690
686
691
687
static gboolean loadSymbols () {
692
- if (!glib_version_2_68 ) {
693
- DEBUG_SCREENCAST ("glib version 2.68+ required\n" , NULL );
694
- return FALSE;
695
- }
696
-
697
- pipewire_libhandle = dlopen (VERSIONED_JNI_LIB_NAME ("pipewire-0.3" , "0" ),
698
- RTLD_LAZY | RTLD_LOCAL );
688
+ pipewire_libhandle = dlopen ("libpipewire-0.3.so.0" , RTLD_LAZY | RTLD_LOCAL );
699
689
700
690
if (!pipewire_libhandle ) {
701
691
DEBUG_SCREENCAST ("could not load pipewire library\n" , NULL );
@@ -738,7 +728,8 @@ static gboolean loadSymbols() {
738
728
739
729
void storeRestoreToken (const gchar * oldToken , const gchar * newToken ) {
740
730
741
- JNIEnv * env = (JNIEnv * ) JNU_GetEnv (jvm , JNI_VERSION_1_2 );
731
+ JNIEnv * env = mainEnv ;
732
+
742
733
DEBUG_SCREENCAST ("saving token, old: |%s| > new: |%s|\n" , oldToken , newToken );
743
734
if (env ) {
744
735
jstring jOldToken = NULL ;
@@ -793,11 +784,11 @@ void storeRestoreToken(const gchar* oldToken, const gchar* newToken) {
793
784
}
794
785
795
786
/*
796
- * Class: sun_awt_UNIXToolkit
797
- * Method: load_gtk
798
- * Signature: (IZ )Z
787
+ * Class: com_sun_glass_ui_gtk_screencast_ScreencastHelper
788
+ * Method: loadPipewire
789
+ * Signature: (Z )Z
799
790
*/
800
- JNIEXPORT jboolean JNICALL Java_sun_awt_screencast_ScreencastHelper_loadPipewire (
791
+ JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_screencast_ScreencastHelper_loadPipewire (
801
792
JNIEnv * env , jclass cls , jboolean screencastDebug
802
793
) {
803
794
DEBUG_SCREENCAST_ENABLED = screencastDebug ;
@@ -806,7 +797,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_screencast_ScreencastHelper_loadPipewire
806
797
return JNI_FALSE ;
807
798
}
808
799
809
- tokenStorageClass = (* env )-> FindClass (env , "sun/awt /screencast/TokenStorage" );
800
+ tokenStorageClass = (* env )-> FindClass (env , "com/ sun/glass/ui/gtk /screencast/TokenStorage" );
810
801
if (!tokenStorageClass ) {
811
802
return JNI_FALSE ;
812
803
}
@@ -896,22 +887,21 @@ static int makeScreencast(
896
887
}
897
888
898
889
/*
899
- * Class: sun_awt_screencast_ScreencastHelper
890
+ * Class: com_sun_glass_ui_gtk_screencast_ScreencastHelper
900
891
* Method: closeSession
901
892
* Signature: ()V
902
893
*/
903
- JNIEXPORT void JNICALL
904
- Java_sun_awt_screencast_ScreencastHelper_closeSession (JNIEnv * env , jclass cls ) {
894
+ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_screencast_ScreencastHelper_closeSession (JNIEnv * env , jclass cls ) {
905
895
DEBUG_SCREENCAST ("closing screencast session\n\n" , NULL );
906
896
doCleanup ();
907
897
}
908
898
909
899
/*
910
- * Class: sun_awt_screencast_ScreencastHelper
900
+ * Class: com_sun_glass_ui_gtk_screencast_ScreencastHelper
911
901
* Method: getRGBPixelsImpl
912
902
* Signature: (IIII[I[ILjava/lang/String;)I
913
903
*/
914
- JNIEXPORT jint JNICALL Java_sun_awt_screencast_ScreencastHelper_getRGBPixelsImpl (
904
+ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_screencast_ScreencastHelper_getRGBPixelsImpl (
915
905
JNIEnv * env ,
916
906
jclass cls ,
917
907
jint jx ,
0 commit comments