Skip to content

Commit 7d4e438

Browse files
committed
Remove clipboard
1 parent 7fe8177 commit 7d4e438

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1
-8626
lines changed

CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ set(SDL2_SOURCES ${SDL2_SOURCES}
7676
${HERE}/src/audio/SDL_mixer.c
7777
${HERE}/src/audio/SDL_wave.c
7878
${HERE}/src/cpuinfo/SDL_cpuinfo.c
79-
${HERE}/src/events/SDL_clipboardevents.c
8079
${HERE}/src/events/SDL_displayevents.c
8180
${HERE}/src/events/SDL_events.c
8281
${HERE}/src/events/SDL_keyboard.c
@@ -120,7 +119,6 @@ if(APPLE)
120119
${HERE}/src/thread/pthread/SDL_systls.c
121120
${HERE}/src/timer/unix/SDL_systimer.c
122121
${HERE}/src/timer/unix/SDL_systimer.c
123-
${HERE}/src/video/cocoa/SDL_cocoaclipboard.m
124122
${HERE}/src/video/cocoa/SDL_cocoaevents.m
125123
${HERE}/src/video/cocoa/SDL_cocoakeyboard.m
126124
${HERE}/src/video/cocoa/SDL_cocoamessagebox.m

android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

-68
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.app.AlertDialog;
55
import android.app.Dialog;
66
import android.app.UiModeManager;
7-
import android.content.ClipboardManager;
87
import android.content.ClipData;
98
import android.content.Context;
109
import android.content.DialogInterface;
@@ -108,7 +107,6 @@ public enum NativeState {
108107
protected static View mTextEdit;
109108
protected static boolean mScreenKeyboardShown;
110109
protected static ViewGroup mLayout;
111-
protected static SDLClipboardHandler mClipboardHandler;
112110
protected static Hashtable<Integer, PointerIcon> mCursors;
113111
protected static int mLastCursorID;
114112
protected static SDLGenericMotionListener_API12 mMotionListener;
@@ -198,7 +196,6 @@ public static void initialize() {
198196
mSurface = null;
199197
mTextEdit = null;
200198
mLayout = null;
201-
mClipboardHandler = null;
202199
mCursors = new Hashtable<Integer, PointerIcon>();
203200
mLastCursorID = 0;
204201
mSDLThread = null;
@@ -270,8 +267,6 @@ public void onClick(DialogInterface dialog,int id) {
270267
mSingleton = this;
271268
SDL.setContext(this);
272269

273-
mClipboardHandler = new SDLClipboardHandler();
274-
275270
mHIDDeviceManager = HIDDeviceManager.acquire(this);
276271

277272
// Set up the surface
@@ -796,7 +791,6 @@ public static native void onNativeTouch(int touchDevId, int pointerFingerId,
796791
int action, float x,
797792
float y, float p);
798793
public static native void onNativeAccel(float x, float y, float z);
799-
public static native void onNativeClipboardChanged();
800794
public static native void onNativeSurfaceCreated();
801795
public static native void onNativeSurfaceChanged();
802796
public static native void onNativeSurfaceDestroyed();
@@ -1436,27 +1430,6 @@ public void onSystemUiVisibilityChange(int visibility) {
14361430
}
14371431
}
14381432

1439-
/**
1440-
* This method is called by SDL using JNI.
1441-
*/
1442-
public static boolean clipboardHasText() {
1443-
return mClipboardHandler.clipboardHasText();
1444-
}
1445-
1446-
/**
1447-
* This method is called by SDL using JNI.
1448-
*/
1449-
public static String clipboardGetText() {
1450-
return mClipboardHandler.clipboardGetText();
1451-
}
1452-
1453-
/**
1454-
* This method is called by SDL using JNI.
1455-
*/
1456-
public static void clipboardSetText(String string) {
1457-
mClipboardHandler.clipboardSetText(string);
1458-
}
1459-
14601433
/**
14611434
* This method is called by SDL using JNI.
14621435
*/
@@ -2269,44 +2242,3 @@ public boolean deleteSurroundingText(int beforeLength, int afterLength) {
22692242
}
22702243
}
22712244

2272-
class SDLClipboardHandler implements
2273-
ClipboardManager.OnPrimaryClipChangedListener {
2274-
2275-
protected ClipboardManager mClipMgr;
2276-
2277-
SDLClipboardHandler() {
2278-
mClipMgr = (ClipboardManager) SDL.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
2279-
mClipMgr.addPrimaryClipChangedListener(this);
2280-
}
2281-
2282-
public boolean clipboardHasText() {
2283-
return mClipMgr.hasPrimaryClip();
2284-
}
2285-
2286-
public String clipboardGetText() {
2287-
ClipData clip = mClipMgr.getPrimaryClip();
2288-
if (clip != null) {
2289-
ClipData.Item item = clip.getItemAt(0);
2290-
if (item != null) {
2291-
CharSequence text = item.getText();
2292-
if (text != null) {
2293-
return text.toString();
2294-
}
2295-
}
2296-
}
2297-
return null;
2298-
}
2299-
2300-
public void clipboardSetText(String string) {
2301-
mClipMgr.removePrimaryClipChangedListener(this);
2302-
ClipData clip = ClipData.newPlainText(null, string);
2303-
mClipMgr.setPrimaryClip(clip);
2304-
mClipMgr.addPrimaryClipChangedListener(this);
2305-
}
2306-
2307-
@Override
2308-
public void onPrimaryClipChanged() {
2309-
SDLActivity.onNativeClipboardChanged();
2310-
}
2311-
}
2312-

include/SDL.h

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "SDL_assert.h"
3535
#include "SDL_atomic.h"
3636
#include "SDL_audio.h"
37-
#include "SDL_clipboard.h"
3837
#include "SDL_cpuinfo.h"
3938
#include "SDL_endian.h"
4039
#include "SDL_error.h"

include/SDL_clipboard.h

-89
This file was deleted.

include/SDL_events.h

-9
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ typedef enum
140140
SDL_DOLLARRECORD,
141141
SDL_MULTIGESTURE,
142142

143-
/* Clipboard events */
144-
SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
145-
146-
/* Drag and drop events */
147-
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
148-
SDL_DROPTEXT, /**< text/plain drag-and-drop event */
149-
SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */
150-
SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */
151-
152143
/* Audio hotplug events */
153144
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
154145
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */

src/core/android/SDL_android.c

+1-56
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)(
120120
JNIEnv *env, jclass jcls,
121121
jfloat x, jfloat y, jfloat z);
122122

123-
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
124-
JNIEnv *env, jclass jcls);
125-
126123
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
127124
JNIEnv *env, jclass cls);
128125

@@ -180,7 +177,6 @@ static JNINativeMethod SDLActivity_tab[] = {
180177
{ "onNativeTouch", "(IIIFFF)V", SDL_JAVA_INTERFACE(onNativeTouch) },
181178
{ "onNativeMouse", "(IIFFZ)V", SDL_JAVA_INTERFACE(onNativeMouse) },
182179
{ "onNativeAccel", "(FFF)V", SDL_JAVA_INTERFACE(onNativeAccel) },
183-
{ "onNativeClipboardChanged", "()V", SDL_JAVA_INTERFACE(onNativeClipboardChanged) },
184180
{ "nativeLowMemory", "()V", SDL_JAVA_INTERFACE(nativeLowMemory) },
185181
{ "onNativeLocaleChanged", "()V", SDL_JAVA_INTERFACE(onNativeLocaleChanged) },
186182
{ "nativeSendQuit", "()V", SDL_JAVA_INTERFACE(nativeSendQuit) },
@@ -294,9 +290,6 @@ static JavaVM *mJavaVM = NULL;
294290
static jclass mActivityClass;
295291

296292
/* method signatures */
297-
static jmethodID midClipboardGetText;
298-
static jmethodID midClipboardHasText;
299-
static jmethodID midClipboardSetText;
300293
static jmethodID midCreateCustomCursor;
301294
static jmethodID midGetContext;
302295
static jmethodID midGetDisplayDPI;
@@ -573,9 +566,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
573566

574567
mActivityClass = (jclass)((*env)->NewGlobalRef(env, cls));
575568

576-
midClipboardGetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardGetText", "()Ljava/lang/String;");
577-
midClipboardHasText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardHasText", "()Z");
578-
midClipboardSetText = (*env)->GetStaticMethodID(env, mActivityClass, "clipboardSetText", "(Ljava/lang/String;)V");
579569
midCreateCustomCursor = (*env)->GetStaticMethodID(env, mActivityClass, "createCustomCursor", "([IIIII)I");
580570
midGetContext = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;");
581571
midGetDisplayDPI = (*env)->GetStaticMethodID(env, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;");
@@ -603,10 +593,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl
603593
midShowTextInput = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z");
604594
midSupportsRelativeMouse = (*env)->GetStaticMethodID(env, mActivityClass, "supportsRelativeMouse", "()Z");
605595

606-
if (!midClipboardGetText ||
607-
!midClipboardHasText ||
608-
!midClipboardSetText ||
609-
!midCreateCustomCursor ||
596+
if (!midCreateCustomCursor ||
610597
!midGetContext ||
611598
!midGetDisplayDPI ||
612599
!midGetManifestEnvironmentVariables ||
@@ -1131,13 +1118,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)(
11311118
bHasNewData = SDL_TRUE;
11321119
}
11331120

1134-
/* Clipboard */
1135-
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)(
1136-
JNIEnv *env, jclass jcls)
1137-
{
1138-
SDL_SendClipboardUpdate();
1139-
}
1140-
11411121
/* Low memory */
11421122
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)(
11431123
JNIEnv *env, jclass cls)
@@ -1916,41 +1896,6 @@ int Android_JNI_FileClose(SDL_RWops *ctx)
19161896
return 0;
19171897
}
19181898

1919-
int Android_JNI_SetClipboardText(const char *text)
1920-
{
1921-
JNIEnv *env = Android_JNI_GetEnv();
1922-
jstring string = (*env)->NewStringUTF(env, text);
1923-
(*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string);
1924-
(*env)->DeleteLocalRef(env, string);
1925-
return 0;
1926-
}
1927-
1928-
char* Android_JNI_GetClipboardText(void)
1929-
{
1930-
JNIEnv *env = Android_JNI_GetEnv();
1931-
char *text = NULL;
1932-
jstring string;
1933-
1934-
string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText);
1935-
if (string) {
1936-
const char *utf = (*env)->GetStringUTFChars(env, string, 0);
1937-
if (utf) {
1938-
text = SDL_strdup(utf);
1939-
(*env)->ReleaseStringUTFChars(env, string, utf);
1940-
}
1941-
(*env)->DeleteLocalRef(env, string);
1942-
}
1943-
1944-
return (text == NULL) ? SDL_strdup("") : text;
1945-
}
1946-
1947-
SDL_bool Android_JNI_HasClipboardText(void)
1948-
{
1949-
JNIEnv *env = Android_JNI_GetEnv();
1950-
jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText);
1951-
return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE;
1952-
}
1953-
19541899
/* returns 0 on success or -1 on error (others undefined then)
19551900
* returns truthy or falsy value in plugged, charged and battery
19561901
* returns the value in seconds and percent or -1 if not available

src/core/android/SDL_android.h

-5
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ int Android_JNI_FileClose(SDL_RWops* ctx);
7676
/* Environment support */
7777
void Android_JNI_GetManifestEnvironmentVariables(void);
7878

79-
/* Clipboard support */
80-
int Android_JNI_SetClipboardText(const char* text);
81-
char* Android_JNI_GetClipboardText(void);
82-
SDL_bool Android_JNI_HasClipboardText(void);
83-
8479
/* Power support */
8580
int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent);
8681

src/core/winrt/SDL_winrtapp_direct3d.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,6 @@ void SDL_WinRTApp::OnWindowActivated(CoreWindow^ sender, WindowActivatedEventArg
633633
/* TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) */
634634
//WIN_CheckAsyncMouseRelease(data);
635635

636-
/* TODO, WinRT: implement clipboard support, if possible */
637-
///*
638-
// * FIXME: Update keyboard state
639-
// */
640-
//WIN_CheckClipboardUpdate(data->videodata);
641-
642636
// HACK: Resetting the mouse-cursor here seems to fix
643637
// https://bugzilla.libsdl.org/show_bug.cgi?id=3217, whereby a
644638
// WinRT app's mouse cursor may switch to Windows' 'wait' cursor,

src/dynapi/SDL_dynapi_overrides.h

-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@
9595
#define SDL_UnlockAudioDevice SDL_UnlockAudioDevice_REAL
9696
#define SDL_CloseAudio SDL_CloseAudio_REAL
9797
#define SDL_CloseAudioDevice SDL_CloseAudioDevice_REAL
98-
#define SDL_SetClipboardText SDL_SetClipboardText_REAL
99-
#define SDL_GetClipboardText SDL_GetClipboardText_REAL
100-
#define SDL_HasClipboardText SDL_HasClipboardText_REAL
10198
#define SDL_GetCPUCount SDL_GetCPUCount_REAL
10299
#define SDL_GetCPUCacheLineSize SDL_GetCPUCacheLineSize_REAL
103100
#define SDL_HasRDTSC SDL_HasRDTSC_REAL

src/dynapi/SDL_dynapi_procs.h

-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ SDL_DYNAPI_PROC(void,SDL_UnlockAudio,(void),(),)
126126
SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),)
127127
SDL_DYNAPI_PROC(void,SDL_CloseAudio,(void),(),)
128128
SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),)
129-
SDL_DYNAPI_PROC(int,SDL_SetClipboardText,(const char *a),(a),return)
130-
SDL_DYNAPI_PROC(char*,SDL_GetClipboardText,(void),(),return)
131-
SDL_DYNAPI_PROC(SDL_bool,SDL_HasClipboardText,(void),(),return)
132129
SDL_DYNAPI_PROC(int,SDL_GetCPUCount,(void),(),return)
133130
SDL_DYNAPI_PROC(int,SDL_GetCPUCacheLineSize,(void),(),return)
134131
SDL_DYNAPI_PROC(SDL_bool,SDL_HasRDTSC,(void),(),return)

0 commit comments

Comments
 (0)