Skip to content

Commit

Permalink
Float View: fix some bug when use float view perform X window outside…
Browse files Browse the repository at this point in the history
… of activity
  • Loading branch information
foryoung2018 committed Aug 23, 2024
1 parent 18ef828 commit 309f7a0
Show file tree
Hide file tree
Showing 15 changed files with 762 additions and 996 deletions.
2 changes: 2 additions & 0 deletions app/src/main/aidl/com/termux/x11/ICmdEntryInterface.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ interface ICmdEntryInterface {

void raiseWindow(long window);

void circulaSubWindows(long window, boolean lowest);

void sendClipText(String cliptext);
}
2 changes: 1 addition & 1 deletion app/src/main/cpp/lorie/InitOutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ from The Open Group.
#define unwrap(priv, real, mem) { real->mem = priv->mem; }
#define USAGE (AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN | AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN)

#define PRINT_LOG 1
#define PRINT_LOG 0
#define log(prio, ...) if(PRINT_LOG){\
__android_log_print(ANDROID_LOG_ ## prio, "huyang_InitOutput", __VA_ARGS__);\
} \
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/cpp/lorie/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void android_update_texture_1(Window window) {
}

void android_update_widget_texture(Widget *widget) {
log(ERROR, "android_update_widget_texture window:%x", widget->window);
// log(ERROR, "android_update_widget_texture window:%x", widget->window);
PixmapPtr pixmap = (PixmapPtr) (*pScreenPtr->GetWindowPixmap)(widget->pWin);
renderer_update_widget_texture(pixmap->screen_x, pixmap->screen_y, pixmap->drawable.width,
pixmap->drawable.height, pixmap->devPrivate.ptr, 0, widget);
Expand Down Expand Up @@ -301,12 +301,16 @@ void xserver_get_window_property(WindowPtr pWin, WindProperty *pProperty) {
pProperty->window_type = _NET_WM_WINDOW_TYPE_DIALOG;
} else if (STRING_EQUAL(NameForAtom(atoms[i]), WINDOW_TYPE_UTILITY)){
pProperty->window_type = _NET_WM_WINDOW_TYPE_UTILITY;
break;
} else if (STRING_EQUAL(NameForAtom(atoms[i]), WINDOW_TYPE_POPUP)){
pProperty->window_type = _NET_WM_WINDOW_TYPE_POPUP_MENU;
break;
} else if (STRING_EQUAL(NameForAtom(atoms[i]), WINDOW_TYPE_MENU)){
pProperty->window_type = _NET_WM_WINDOW_TYPE_MENU;
break;
} else if (STRING_EQUAL(NameForAtom(atoms[i]), WINDOW_TYPE_TOOLTIP)){
pProperty->window_type = _NET_WM_WINDOW_TYPE_TOOLTIP;
break;
}

const char *atomValue = NameForAtom(atoms[i]);
Expand All @@ -318,15 +322,15 @@ void xserver_get_window_property(WindowPtr pWin, WindProperty *pProperty) {
} else if (STRING_EQUAL(NameForAtom(name), NET_WINDOW_NAME)) {
STRCPY;
pProperty->net_wm_name = atom_value;
log(DEBUG, "%s:%s size:%d", NET_WINDOW_NAME, atom_value, pProper->size);
// log(DEBUG, "%s:%s size:%d", NET_WINDOW_NAME, atom_value, pProper->size);
} else if (STRING_EQUAL(NameForAtom(name), WINDOW_CLASS)){
STRCPY;
pProperty->wm_class = atom_value;
log(DEBUG, "%s:%s size:%d", WINDOW_CLASS, atom_value, pProper->size);
// log(DEBUG, "%s:%s size:%d", WINDOW_CLASS, atom_value, pProper->size);
} else if (STRING_EQUAL(NameForAtom(name), WINDOW_NAME)) {
STRCPY;
pProperty->wm_name = atom_value;
log(DEBUG, "%s:%s size:%d", WINDOW_NAME, atom_value, pProper->size);
// log(DEBUG, "%s:%s size:%d", WINDOW_NAME, atom_value, pProper->size);
} else if (STRING_EQUAL(NameForAtom(name), WINDOW_ICON)) {
int *icon_data = (int *)propData;
int width = *icon_data;
Expand All @@ -349,6 +353,9 @@ void xserver_get_window_property(WindowPtr pWin, WindProperty *pProperty) {
}

bool check_bounds(int x, int y, int w, int h, int x1, int y1, int w1, int h1) {
if(w < 30 || h < 30 ){
return TRUE;
}
log(DEBUG, "check_bounds x:%d y:%d w:%d h:%d x1:%d y1:%d w1:%d h1:%d ",
x, y, w, h, x1, y1, w1, h1);
if (x < x1 || y < y1 || (x + w) > (x1 + w1) || (y + h) > (y1 + h1)) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/lorie/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <globals.h>
#include "c_interface.h"
#include <android/log.h>
#define PRINT_LOG 1
#define PRINT_LOG 0
#define log(...) if(PRINT_LOG){\
__android_log_print(ANDROID_LOG_DEBUG, "huyang_renderer", __VA_ARGS__);\
} \
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/lorie/surface_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <sstream>
#include <iomanip>
#include <android/log.h>
#define PRINT_LOG 1
#define PRINT_LOG 0
#define log(...) if(PRINT_LOG){\
__android_log_print(ANDROID_LOG_DEBUG, "huyang_sm", __VA_ARGS__);\
} \
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/termux/x11/AppListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void onGlobalLayout() {
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
AppUtils.set("fde.click_as_touch", "false");
// AppUtils.set("fde.click_as_touch", "false");
Log.d(TAG, "onWindowFocusChanged: hasFocus:" + hasFocus + "");
if(hasFocus){
mayGetApps();
Expand Down
Loading

0 comments on commit 309f7a0

Please sign in to comment.