问题如标题:假设我有一个app。想一直置于顶层,那么我可以怎么做?

1.drm-master权限问题

  • 想办法拿掉weston或者说drm关于master权限的处理,然后自己基于libdrm画一个即可。

2.枚举出另一个/dev/dri/cardX

  • 可以想办法分出一个硬件的pipleline用来专门给这个显示用,同时枚举出另一个/dev/dri/cardX,然后自己写一个基于此card的绘图client即可。
  • 这个方法的问题就是,本质上和cma有点像,这个单独分出来的硬件,永远不会被weston看到。

    • 这个方法是不行的,因为不同card对应的connector也是不同的,那么就没办法显示到同一个屏幕上

3.for weston shell

  • 如果是ivi,那么这个不是问题,因为ivi支持layer z-order的设置。

    • https://blog.csdn.net/u012839187/article/details/95503449

    • 没有细看,看上去是ivi的做法是把所有的workspace-layer进行排序。不涉及其他layer
  • 如果是desktop,那么需要如下:

  • 1,surface大概率对应一个view
  • 2,view对应layer来处理z order关系

解决办法:

  • 我们的下手点有两个,一个是把对应的view放在其他layer下面,如,放在fade layer下面
  1. 查看desktop-shell的初始化,有一个“shell_fade_init”;直接参照这个函数去处理就可以了,主要的重中之重就是
  2. weston_layer_entry_insert(&compositor->fade_layer.view_list,  &view->layer_link);

效果如下图,左上角的1/16是一个永远浮于上方的显示。

  1. 优点,容易实现。
  2. 缺点明显,layer的order太高了,那么任何其他的图层都不可能覆盖他,包括鼠标。
    1. 争对这个缺点,可以使用优先级低一点的layer解决。

简单的改动如下:

maze@maze-VirtualBox:~/Wayland/weston$ git diff ./
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index c1c126e8..b951a755 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4064,9 +4064,9 @@ shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_oreturn NULL;}-       weston_surface_set_size(surface, shell_output->output->width, shell_output->output->height);
+       weston_surface_set_size(surface, shell_output->output->width/4, shell_output->output->height/4);weston_view_set_position(view, shell_output->output->x, shell_output->output->y);
-       weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
+       weston_surface_set_color(surface, 0.0, 255.0, 0.0, 1.0);  //weston_surface_attach如果attch了buffer。是否就能显示自己的图呢?weston_layer_entry_insert(&compositor->fade_layer.view_list,&view->layer_link);pixman_region32_init(&surface->input);
@@ -4079,6 +4079,7 @@ shell_fade_create_surface_for_output(struct desktop_shell *shell, struct shell_ostatic voidshell_fade(struct desktop_shell *shell, enum fade_type type){
+#if 0float tint;struct shell_output *shell_output;@@ -4124,6 +4125,8 @@ shell_fade(struct desktop_shell *shell, enum fade_type type)shell_fade_done_for_output, shell_output);}}
+#endif
+    printf("%s do nothing\n", __func__);}

另外一种改动方法,想办法把view的顺序提前

  1. weston_compositor_build_view_list

    1. 这个地方就是weston在准备渲染逻辑的时候讲对应的view排序的地方,也就是上图最右边一列
    2. 但是该如何调整顺序?
      1. 想到一种比较烂的方法,把所有的view提前做一次遍历,找到自己的view,然后塞在最上面。

对应的代码改动去查看这块逻辑:

  1. 将view的add过程进行两次拆分,可以同样实现。

    1. 但是就是对view的判定还有所不足,不知道应该怎么做。
    2. 遍历所花时间增加。
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2681,10 +2681,12 @@ weston_compositor_build_view_list(struct weston_compositor *compositor)wl_list_for_each_safe(view, tmp, &compositor->view_list, link)wl_list_init(&view->link);wl_list_init(&compositor->view_list);
-
//提前遍历,找到view,然后view_list_add
+       int i =0;wl_list_for_each(layer, &compositor->layer_list, link) {              //把所有layer里面的所有的view,重新按序塞入compositor的view列表里面wl_list_for_each(view, &layer->view_list.link, layer_link.link) {view_list_add(compositor, view);
+                       printf("index %d %s view  x:%f y:%f  w%d h%d\n", i, __func__, view->geometry.x, view->geometry.y, view->surface->width, view->surface->height);
+                       i++;}}///
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2681,10 +2681,23 @@ weston_compositor_build_view_list(struct weston_compositor *compositor)wl_list_for_each_safe(view, tmp, &compositor->view_list, link)wl_list_init(&view->link);wl_list_init(&compositor->view_list);
-
+
+       wl_list_for_each(layer, &compositor->layer_list, link) {
+               wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
+                       if(layer->position > WESTON_LAYER_POSITION_NORMAL)
+                               view_list_add(compositor, view);
+                        if(layer->position == WESTON_LAYER_POSITION_NORMAL &&view->surface->width==250&&view->surface->height==250)
+                                view_list_add(compositor, view);
+                        if(layer->position < WESTON_LAYER_POSITION_NORMAL)break;
+               }
+       }
+       int i =0;wl_list_for_each(layer, &compositor->layer_list, link) {wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
-                       view_list_add(compositor, view);
+                       if(layer->position <=  WESTON_LAYER_POSITION_NORMAL &&(view->surface->width!=250||view->surface->height!=250))
+                               view_list_add(compositor, view);
+//                     printf("index %d %s view  x:%f y:%f  w%d h%d\n", i, __func__, view->geometry.x, view->geometry.y, view->surface->width, view->surface->height);
+//                     printf("%lld\n", layer->position);
+//                     i++;}}

是否可以通过container_of想办法得到weston_desktop_surface->app_id or add_title之类的实现?

log:

index 0 weston_compositor_build_view_list view  x:340.000000 y:382.000000  w32 h32
index 1 weston_compositor_build_view_list view  x:0.000000 y:0.000000  w1024 h32
index 2 weston_compositor_build_view_list view  x:209.000000 y:17.000000  w806 h491
index 3 weston_compositor_build_view_list view  x:531.000000 y:345.000000  w250 h250
index 4 weston_compositor_build_view_list view  x:0.000000 y:0.000000  w1024 h600

可以知道index越小的,浮于最上层。

display:Weston:怎么让某个surface永远置于顶层相关推荐

  1. display:weston渲染流程:commit

    接上一篇 display:weston渲染流程:buffer+attach+damage+frame display:weston渲染流程:buffer+attach+damage+frame_maz ...

  2. display:weston:weston-simple-egl

    写在前面: 客户端渲染 在Wayland架构中,客户端UI的所有呈现均由客户端代码执行,通常由客户端使用的图形工具包执行. 图形工具箱可以使用其希望呈现UI元素的任何方法:在CPU上进行软件呈现,使用 ...

  3. display:weston的client端绘画[subsurface,fullscreen]

    weston的源代码里面有关于client的绘画例子 建议追踪https://github.com/wayland-project/weston/blob/master/clients/ 增加一种功能 ...

  4. display: weston: opaque region笔记

    client的设置方法: region = wl_compositor_create_region(window->display->compositor); wl_region_add( ...

  5. display:weston:weston-simple-egl: server端

    接上篇:https://blog.csdn.net/u012839187/article/details/112415876 surface_attch以及surface_damage相关就不讲了,参 ...

  6. unity技美33——给游戏场景设置一个永远置于底层的UI背景

    我们有时候在做赛车相关的游戏的时候,经常会有分镜视角. 但是对于小游戏来说,可能并不需要制作天空盒子,或者多余的背景盒子.因为考虑到包体资源,大小问题,问们采用一个UI摄像机置于底层,照射一个背景图片 ...

  7. android按钮置于顶层,如何把按键显示在最顶层窗口上(屏幕最顶上)

    [Delphi] 纯文本查看 复制代码unit Unit2; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, Syst ...

  8. python3基础知识复习 --TKinter GUI的终极选择(2)

    文章目录 事件绑定 Message Tkinter布局管理 Tkinter使用多线程 Tkinter多线程暂停和继续 Tkinter文件之间的调用 事件绑定 一个 Tkinter 应用程序大部分时间花 ...

  9. Pygame详解(十二):Surface 对象

    pygame.Surface Pygame 中用于表示图像的对象. Surface((width, height), flags=0, depth=0, masks=None) -> Surfa ...

最新文章

  1. 2020高速公路shp文件_全国按轴收费方案最终版!今天起,高速公路就按照这个标准收费...
  2. 1017 Queueing at Bank (25 分) 【未完成】【难度: 中 / 知识点: 模拟】
  3. python多线程与GIL
  4. AQS理解之一,基础知识——LockSupport
  5. Microsoft Azure Tutorial: Build your first movie inventory web app with just a few lines of code
  6. 香港理工大学人工智能设计实验室 博士后 招聘
  7. python编程软件哪个好-python IDE有哪些?哪个好用?
  8. matlab求smith标准型
  9. 导入oracle 904,江湖救急..ora-904怎么处理?
  10. php连接外卖打印机,javaScript 连接打印机,打印小票实例分享
  11. html5 span 点击选择,设置span标签不可点击技术分享
  12. 【转帖】用友和金蝶应避免重蹈Oracle覆辙
  13. 深入理解JS的delete
  14. 【07月24日】预分红股息率最高排名
  15. 用Python给娃送上一份猪年春节礼物。文末源码!
  16. [转载]tensorflow二次开发
  17. 新款H3C服务器R4900配置raid
  18. linux系统下下载jenkins
  19. 《Kubernetes权威指南:从Docker到Kubernetes实践全接触》读书笔记
  20. 惠普打印机HP 1010在WIN7(64位系统)下面的网络安装

热门文章

  1. 不停的往android手机串口写数据
  2. 【Multisim仿真】光耦隔离电路
  3. mybatis xml转义问题
  4. vue 高阶面试题_15个 Vue.js 高级面试题,必收藏
  5. javaweb课程设计手机商城
  6. Solr(二)-Solrj操作Solr
  7. PPT演讲的准备工作
  8. 浅谈paxos协议与zookeeper
  9. AAC 编码基本说明
  10. 浏览器http自动跳转https