WO2023029747A1 - Method for implementing single instance function of application, and apparatus - Google Patents

Method for implementing single instance function of application, and apparatus Download PDF

Info

Publication number
WO2023029747A1
WO2023029747A1 PCT/CN2022/104470 CN2022104470W WO2023029747A1 WO 2023029747 A1 WO2023029747 A1 WO 2023029747A1 CN 2022104470 W CN2022104470 W CN 2022104470W WO 2023029747 A1 WO2023029747 A1 WO 2023029747A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
window
level window
level
activate
Prior art date
Application number
PCT/CN2022/104470
Other languages
French (fr)
Chinese (zh)
Inventor
杨国祥
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2023029747A1 publication Critical patent/WO2023029747A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • the invention relates to the technical field of application development, in particular to a method and device for realizing the function of an application singleton.
  • Embodiments of the present invention provide a method and device for realizing the application singleton function, which realizes that the application can quickly activate the previously launched application through the launcher without relying on the task navigation bar.
  • the embodiment of the present invention provides a method for realizing the application singleton function, the method includes:
  • the window manager is called to create and activate the top-level window of the application.
  • the judging whether the application has a running instance includes:
  • the application identified with the corresponding top-level window is determined to have a running instance.
  • the calling of the window manager to activate the top-level window of the application includes:
  • the window manager is called to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
  • the calling the window manager to create and activate the top-level window of the application includes:
  • the window manager after calling the window manager to create and activate the top-level window of the application, it also includes:
  • the method after activating the top-level window of the application, the method further includes:
  • the launcher continues to call the window manager to create a top-level window of the application and its corresponding top-level window identifier, and activate the newly created top-level window, wherein the The newly created top-level window of the application is stored in the window stack;
  • the launcher calls the window manager to update the top-level window of the application and the corresponding top-level window identifier, activate the updated top-level window, and update the updated top-level window
  • the identification is sent to the launcher, wherein the updating the top-level window of the application is updating the top-level window in the window stack;
  • the window stack of the application is searched to determine whether there is a window in the window stack of the application, and if there is a window in the window stack of the application, the The stack-top window ID of the application is sent to the launcher, and if there is no window in the window stack of the application, the top-level window ID of the application in the launcher is cleared.
  • the embodiment of the present invention provides a device for realizing the application singleton function, and the device includes: a judging module, a calling module and an activating module.
  • the judging module is used to judge whether the application has a running instance when receiving the start command of the application;
  • the calling module is used to call the window manager to activate the application when the application has a running instance.
  • an activation module configured to call the window manager to create and activate the top-level window of the application when there is no running instance of the application.
  • the judging whether the application has a running instance in the judging module includes:
  • the application identified with the corresponding top-level window is determined to have a running instance.
  • an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and operable on the processor.
  • the processor executes the program, any of the above-mentioned The steps of the implementation method of the application singleton function described in item.
  • an embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the realization of the application singleton function as described in any one of the above is realized steps of the method.
  • an embodiment of the present invention provides a computer program product, including a computer program stored on the non-transitory computer-readable storage medium, and the computer program is implemented by a processor. The steps of the method for realizing the function of the example.
  • an embodiment of the present invention provides a computer program, including program instructions.
  • the program instructions are executed by a computer, the steps of the method for implementing the application singleton function described in any one of the above items are implemented.
  • the launcher in the case of receiving the startup command of the application, it is judged through the launcher whether the application has a running instance; in the case of the application having a running instance, Activate the top-level window of the application by calling the window manager through the launcher, and then realize that the application corresponding to the top-level window is set as the current active application of the system, and realize the function of activating the application that was started before;
  • the manager calls the window manager to create and activate the application's top-level window.
  • FIG. 1 is a schematic flow diagram of a method for implementing an application singleton function provided by an embodiment of the present invention
  • Fig. 2 is a schematic diagram of three situations after activating the top-level window of the application provided by the embodiment of the present invention
  • Fig. 3 is a program flow chart of a method for implementing a multi-agent interaction application singleton function provided by an embodiment of the present invention
  • Fig. 4 is a schematic diagram of three situations of multi-agent interaction provided by an embodiment of the present invention.
  • Fig. 5 is a schematic diagram of a device for realizing the application singleton function provided by the embodiment of the present invention.
  • Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
  • the application singleton function means that when a component is created, and other people call the component, it will not be created repeatedly, but the instance of the already created component will be returned to the caller, which is equivalent to multiple callers Share the same component, saving time and memory for repeated creation.
  • the application singleton is a system implementation pattern. In its core structure contains only one special singleton that is executed. By applying a singleton, it can be guaranteed that in the system, only one instance of an application is running at the same time. In a mobile device, the entire system only needs one runnable instance, which is conducive to coordinating the overall behavior of the system.
  • the disclosed implementation method may be applicable to various mobile devices, terminal devices, and the like.
  • the mobile device and the terminal device are generally understood by those skilled in the art, and may be a tablet Pad, a smart phone, an intelligent personal digital assistant (Personal Digital Assistant, PDA), an e-book, and the like.
  • PDA Personal Digital Assistant
  • the method of the embodiment of the present invention can be applied to various desktop systems that do not have the application singleton function, such as Linux, Windows, Mac OS, etc., especially applicable to Linux.
  • so-called Linux includes various distributions based on the Linux kernel, such as Ubuntu, Debian, etc.
  • FIG. 1 it is a schematic flowchart of a method for implementing an application singleton function provided by an embodiment of the present invention.
  • the method includes:
  • an application refers to software installed on a mobile device, a quasi-mobile device, or a terminal device to implement specific functions, and can be used by a single user or multiple users.
  • different applications can be customized to add or delete according to the user's needs.
  • a running instance refers to a series of processes in the operating system and memory blocks allocated for these processes, and a process is defined as a running program.
  • the start command can be used for the user to perform a mouse single/double-click operation, a shortcut key operation, or a command line operation on the application.
  • the startup type may include a visual interface (Activity) startup method, a system service (Service) startup method, a broadcast startup method, a data provider (Content Provider) startup method, and the like.
  • the startup command received by the application can also be understood as whether the application process has the right to start in a certain startup type.
  • the window manager is the user's main graphics management module in the system.
  • a window manager is a program that controls the appearance, position, and hierarchy of windows and provides methods for users to operate these window programs.
  • the window manager When the window manager is started, the interaction between the server and the client is redirected to the window manager. Whenever a new window is to be displayed, the request is redirected to the window manager, which determines the initial position of the window and its window hierarchy.
  • the window manager is also responsible for handling the icon. When the user icons the window, the window manager will unmap the window and perform appropriate actions to change the window to an icon. Some window managers do not support icons.
  • the main goal of a window manager is to manage windows.
  • window managers provide additional functionality, such as handling mouse clicks on the root window, rendering panes and other visual elements, handling keystrokes, determining which application to execute at startup, and so on.
  • Implementation of common window managers for example, Desktop Window Manager (Desktop Window Manager, DWM) in Windows, X Window, Wayland in Linux, etc.
  • a window is the basic unit that an application sets up in a graphical user interface for working with data. Applications and data are integrated within the window. In the window, the user can operate the application program in the window to manage, generate and edit data. Usually there are menus and icons around the window, and the data is placed in the center.
  • the window interface refers to displaying the computer operation user interface in the form of a window.
  • the application creates and displays a window; when the user manipulates objects in the window, the program reacts accordingly.
  • the top-level window refers to the outermost window (Window) opened by the browser, which is displayed on the top, covers other windows, and is not blocked by other windows.
  • Window the outermost window opened by the browser
  • Activation refers to bringing the top-level window to the foreground, that is, setting it to the top of the application hierarchy.
  • the user has performed a single/double-click operation, shortcut key operation, or command line operation on the icon of the application, that is, the application has a running instance, and the window manager is invoked by the launcher to open the application
  • the top-level window of is displayed at the top of the application hierarchy.
  • creating a new top-level window can be understood as, if the user has not performed a single/double-click operation, shortcut key operation, or command line operation on the application icon, that is, if the application does not have a running instance, the application does not have a top-level window. Window, which creates a top-level window for such an application.
  • Activating the top-level window of the application can be understood as bringing the newly created top-level window to the foreground and setting it as the topmost of the application hierarchy.
  • the implementation method of the application singleton function provided by the embodiment of the present invention, in the case of receiving the start command of the application, judge whether the application has a running instance through the launcher;
  • the window manager calls the window manager to activate the top-level window of the application, and then realizes that the application corresponding to the top-level window is set as the current active application of the system, and realizes the function of activating the application started before;
  • the window manager creates and activates the application's top-level window.
  • the embodiment of the present invention provides a schematic flowchart of an instance of judging whether an application is running, specifically including:
  • the top-level window identifier refers to a mark used to identify the top-level window, for example, it can be realized through a process id.
  • the top-level window identifier of each application uniquely represents the identity or name of any top-level window in any application, which is different from other top-level windows.
  • the top-level window identifier can be used to identify which application the window belongs to.
  • the launcher uses the launcher to determine whether the user's application has a corresponding top-level window ID. If the application has a corresponding top-level window ID, it means that the application has been started before, that is, the application has a running instance; If the corresponding top-level window is identified, it means that the application has not been started before, that is, there is no running instance of the application.
  • the top-level window identifier of an application has the function of uniquely identifying which application the window is, it can be accurately determined whether the user's application has been opened by using the top-level window identifier.
  • calling the window manager to activate the top-level window of the application includes:
  • the window manager is invoked to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
  • the window stack refers to containers for storing different types of windows, for example, application windows, document type windows, etc.
  • the top-level window is located at the top of the window stack, and the user has performed a single/double-click operation, shortcut key operation, or command line operation on the tile or icon of the application, that is, if the application has a running instance, based on the
  • the top-level window identifier corresponding to the top-level window activates the top-level window stored in the window stack, and displays the top-level window at the top of the application hierarchy, that is, the user can open the previously started application at this time.
  • calling the window manager to create and activate the top-level window of the application includes:
  • the newly created top-level window is located at the top of the application window stack, and the user has not performed a single/double-click operation, shortcut key operation, or command line operation on the tile or icon of the application, that is, the application does not have a running instance.
  • create a new top-level window for the application correspondingly generate a top-level window identifier, and store the newly created top-level window of the application in the window stack.
  • the top-level window is activated, that is, the top-level window is set to the foreground as the top of the application hierarchy, and the user can also judge which application is opened through the top-level window ID.
  • a new top-level window is created for the application, and the corresponding top-level window identifier is generated, and the newly created top-level window is activated by using the window manager.
  • the application is positioned to achieve the function of quickly activating the launched application.
  • the method further includes: after calling the window manager to create and activate the top-level window of the application, it also includes:
  • the launcher includes a representation of the application or content (for example, an icon or a command line, etc.), and the representation is selectable to initiate execution and access to the represented application or content.
  • a representation of the application or content for example, an icon or a command line, etc.
  • Common launcher implementations such as Launchpad in Mac OS, Start in Windows, Unity in Linux, etc.
  • top-level window ID is sent to the launcher for saving.
  • FIG. 2 it is a schematic diagram of three situations after activating the top-level window of the application provided by the embodiment of the present invention, including:
  • this step execute the command to create a new top-level window, correspondingly generate a top-level window identifier, and store the newly-created top-level window of the application in the window stack, activate the top-level window based on the newly-created top-level window identifier, that is, bring the top-level window to the foreground Set to the top of the application hierarchy, the user can also determine which application is activated through the top-level window logo.
  • the top-level window of the update application is the top-level window in the update window stack.
  • updating refers to switching the top-level window of the application by means of clicking or touching, for example, after opening an application, switching between different interfaces in the application.
  • this step it is checked whether there are other windows in the window stack corresponding to the application. If there are other windows in the window stack, the top-level window except the closed window in the window stack is taken as the top-level window, and the top-level window corresponding to the new top-level window is The logo is saved to the launcher; if the application has no window, signal 0 is passed to the launcher to inform the launcher that the application has no window, and the next time the application is triggered to start, a new process will be started directly.
  • FIG. 3 shows a program flow chart of a method for realizing the application singleton function of multi-subject interaction, from the user end, the launcher end, the application end, and the window
  • the manager side explains the process of implementing the application singleton.
  • Step S1 the user clicks the application icon to start the application, or executes an application start command.
  • Step S2 Check whether the application has a corresponding top-level window through the launcher. If the application does not have a top-level window, perform step S3; if the application has a top-level window, perform step S7.
  • Step S3 start a new process for the application through the launcher.
  • Step S4 after the application process is started, the window manager is invoked through the launcher to create a new top-level window.
  • Step S5 adding the new top-level window to the window stack through the window manager, and activating the top-level window.
  • Step S6 saving the generated top-level window identifier corresponding to the top-level window into the launcher.
  • Step S7 using the top-level window identifier of the application through the launcher, calling the window manager to activate the top-level window (bringing the top-level window to the foreground means setting it as the top of the application hierarchy).
  • the new top-level window When the application receives an instruction from the user to create a new top-level window, the new top-level window generates a corresponding top-level window ID, calls the window manager to activate the newly created top-level window, and saves the top-level window ID to the launcher.
  • the user operates the application by clicking or touching, generates an instruction to update the top-level window, and the application executes the instruction to switch the interface.
  • the window manager activates the switched top-level window and maps the switched top-level window to the Save the switched top-level window ID to the launcher.
  • the device includes: a judging module 510 , a calling module 520 and an activating module 530 .
  • the judging module 510 is used to judge whether the application has a running instance through the launcher when receiving the start command of the application;
  • the calling module 520 is used to call the window manager through the launcher if the application has a running instance Activate the top-level window of the application;
  • the activation module 530 is used to call the window manager through the launcher to create and activate the top-level window of the application if there is no running instance of the application.
  • the implementation device of the application singleton function provided by the embodiment of the present invention, in the case of receiving the start command of the application, judges whether the application has a running instance through the launcher; if the application has a running instance, calls the window through the launcher
  • the manager activates the top-level window of the application, and then realizes setting the application corresponding to the top-level window as the current active application of the system, realizing the function of activating the application started before; if the application does not have a running instance, call the window manager to create and Activate the application's top-level window.
  • the judging module 510 is specifically configured to:
  • the application has a corresponding top-level window identifier, the application has a running instance
  • the application does not have a corresponding top-level window identifier, the application has no running instance.
  • the calling module 520 is specifically configured to:
  • the launcher Based on the top-level window identifier of the application, the launcher invokes the window manager to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
  • the activation module 530 is specifically configured to:
  • the launcher calls the window manager to create a top-level window of the application and its corresponding top-level window identifier, activate the top-level window, and store the newly created top-level window of the application in the window stack.
  • the device further includes:
  • a sending module configured to send the newly created top-level window identifier corresponding to the top-level window of the application to the launcher.
  • the device after activating the top-level window of the application, the device further includes:
  • the new module is configured to call the window manager to create the top-level window of the application and its corresponding top-level window identifier, and activate the newly-created top-level window when the instruction of creating a new top-level window is received, wherein the The newly created top-level window of the application is stored in the window stack;
  • An update module configured to call the window manager to update the top-level window of the application and its corresponding top-level window identifier, activate the updated top-level window, and set the updated top-level window
  • the identification is sent to the launcher, wherein the updating the top-level window of the application is updating the top-level window in the window stack;
  • the closing module is used to search the window stack of the application when receiving the command to close the top-level window, and judge whether there is a window in the window stack of the application. If there is a window in the window stack of the application, the The stack-top window identifier in the application window stack is sent to the launcher, and if there is no window in the application window stack, the top-level window identifier of the application in the launcher is cleared.
  • Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
  • the electronic device may include: a processor (Processor) 610, a communication interface (Communications Interface) 620, a memory (Memory) 630 and a communication bus 640 , where the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 .
  • the processor 610 can call the logic command in the memory 630 to execute the following method: when receiving the startup command of the application, judge whether the application has a running instance through the launcher; if the application has a running instance, calling the window manager through the launcher to activate the top-level window of the application; if the application has no running instance, calling the window manager through the launcher to create and activate the top-level window of the application.
  • the logic commands in the above-mentioned memory 630 can be implemented in the form of software function units and can be stored in a computer-readable storage medium when sold or used as an independent product.
  • the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several commands are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
  • An embodiment of the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored.
  • the methods provided in the above-mentioned embodiments are implemented, for example, including: receiving the application In the case of a startup command, judge whether the application has a running instance through the launcher; if the application has a running instance, call the window manager to activate the top-level window of the application through the launcher; if the application If there is no running instance, the launcher invokes the window manager to create and activate the top-level window of the application.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.
  • each implementation can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware.
  • the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic Disc, CD, etc., including several commands to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments.

Abstract

Provided are a method for implementing a single instance function of an application, and an apparatus. The method comprises: when a startup command for an application is received, determining whether a running instance is present for said application; when a running instance is present for the application, invoking a window manager to activate a top level window of the application; and when a running instance is not present for the application, invoking the window manager to newly create and activate a top level window of the application. The present invention implements utilization of a launcher to be able to quickly activate an already running application without relying on a task navigation bar.

Description

一种应用单例功能的实现方法和装置Method and device for realizing application singleton function
相关申请交叉引用Related Application Cross Reference
本申请要求于2021年8月31日提交、申请号为202111008251.0、发明名称为“一种应用单例功能的实现方法和装置”的中国专利申请的优先权,其全部内容通过引用并入本文。This application claims the priority of the Chinese patent application filed on August 31, 2021, with the application number 202111008251.0, and the title of the invention is "A Method and Device for Realizing the Application Singleton Function", the entire content of which is incorporated herein by reference.
技术领域technical field
本发明涉及应用开发技术领域,尤其涉及一种应用单例功能的实现方法和装置。The invention relates to the technical field of application development, in particular to a method and device for realizing the function of an application singleton.
背景技术Background technique
与传统的个人计算机(Personal Computer,PC)、笔记本等设备相比,移动设备,如平板电脑、手机等,由于屏幕、处理器、内存等的限制以及用户操作设备的方式与电脑的显著差异,在移动设备上运行的iOS、Android等操作系统一般是应用单例的。Compared with traditional personal computers (Personal Computer, PC), notebooks and other devices, mobile devices, such as tablet computers, mobile phones, etc., due to the limitations of screens, processors, memory, etc., and the significant differences between the way users operate devices and computers, Operating systems such as iOS and Android running on mobile devices are generally application singletons.
发明内容Contents of the invention
本发明实施例提供一种应用单例功能的实现方法和装置,实现了在不依赖任务导航栏的情况下,应用可以通过启动器,快速激活之前启动的应用。Embodiments of the present invention provide a method and device for realizing the application singleton function, which realizes that the application can quickly activate the previously launched application through the launcher without relying on the task navigation bar.
第一方面,本发明实施例提供一种应用单例功能的实现方法,所述方法包括:In the first aspect, the embodiment of the present invention provides a method for realizing the application singleton function, the method includes:
在接收到应用的启动命令的情况下,判断所述应用是否有运行的实例;In the case of receiving an application startup command, determine whether the application has a running instance;
在所述应用有运行的实例的情况下,调用窗口管理器激活所述应用的顶层窗口;In the case that the application has a running instance, calling the window manager to activate the top-level window of the application;
在所述应用没有运行的实例的情况下,调用所述窗口管理器新建并激活所述应用的顶层窗口。In the case that the application has no running instance, the window manager is called to create and activate the top-level window of the application.
根据本发明提供的应用单例功能的实现方法,所述判断所述应用是否有运行的实例,包括:According to the implementation method of the application singleton function provided by the present invention, the judging whether the application has a running instance includes:
判断所述应用是否有对应的顶层窗口标识;Judging whether the application has a corresponding top-level window identifier;
在具有对应的顶层窗口标识的应用确定为有运行的实例。The application identified with the corresponding top-level window is determined to have a running instance.
根据本发明提供的应用单例功能的实现方法,所述调用窗口管理器激活所述应用的顶层窗口,包括:According to the implementation method of the application singleton function provided by the present invention, the calling of the window manager to activate the top-level window of the application includes:
基于所述应用的顶层窗口标识,调用所述窗口管理器激活存储于窗口栈中的顶层窗口;其中,所述顶层窗口与所述顶层窗口标识相对应。Based on the top-level window identifier of the application, the window manager is called to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
根据本发明提供的应用单例功能的实现方法,所述调用所述窗口管理器新建并激活所述应用的顶层窗口,包括:According to the implementation method of the application singleton function provided by the present invention, the calling the window manager to create and activate the top-level window of the application includes:
调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活所述顶层窗口,并将新建的所述应用的顶层窗口存储于所述窗口栈中。calling the window manager to create a top-level window of the application and its corresponding top-level window identifier, activating the top-level window, and storing the newly created top-level window of the application in the window stack.
根据本发明提供的应用单例功能的实现方法,所述调用所述窗口管理器新建并激活所述应用的顶层窗口之后,还包括:According to the implementation method of the application singleton function provided by the present invention, after calling the window manager to create and activate the top-level window of the application, it also includes:
将所述新建的所述应用的顶层窗口对应的顶层窗口标识发送至所述启动器中。Sending the newly created top-level window identifier corresponding to the top-level window of the application to the launcher.
根据本发明提供的应用单例功能的实现方法,所述在激活所述应用的顶层窗口之后,所述方法还包括:According to the implementation method of the application singleton function provided by the present invention, after activating the top-level window of the application, the method further includes:
在接收到新建顶层窗口指令的情况下,通过所述启动器继续调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活新建后的所述顶层窗口,其中,所述新建所述应用的顶层窗口存储于所述窗口栈中;In the case of receiving the command to create a new top-level window, the launcher continues to call the window manager to create a top-level window of the application and its corresponding top-level window identifier, and activate the newly created top-level window, wherein the The newly created top-level window of the application is stored in the window stack;
在接收到更新顶层窗口指令的情况下,通过所述启动器调用所述窗口管理器更新所述应用的顶层窗口及其对应的顶层窗口标识,激活更新后的顶层窗口,并将更新后顶层窗口标识发送至所述启动器中,其中,所述更新所述应用的顶层窗口为更新所述窗口栈中的顶层窗口;In the case of receiving the command to update the top-level window, the launcher calls the window manager to update the top-level window of the application and the corresponding top-level window identifier, activate the updated top-level window, and update the updated top-level window The identification is sent to the launcher, wherein the updating the top-level window of the application is updating the top-level window in the window stack;
在接收到关闭顶层窗口指令的情况下,查找所述应用的窗口栈,判断所述应用的窗口栈中是否存在窗口,若所述应用的窗口栈中存在窗口,将所述应用的窗口栈中的栈顶窗口标识发送至所述启动器中,若所述应用的窗口栈中不存在窗口,清空所述启动器中应用的顶层窗口标识。When the command to close the top-level window is received, the window stack of the application is searched to determine whether there is a window in the window stack of the application, and if there is a window in the window stack of the application, the The stack-top window ID of the application is sent to the launcher, and if there is no window in the window stack of the application, the top-level window ID of the application in the launcher is cleared.
第二方面,本发明实施例提供了一种应用单例功能的实现装置,所述装置包括:判断模块、调用模块和激活模块。其中,判断模块,用于在接收到应用的启动命令的情况下,判断所述应用是否有运行的实例;调用模块,用于在所述应用有运行的实例的情况下,调用窗口管理器激活所述应用的顶层窗口;激活模块,用于在所述应用没有运行的实例的情况下,调用所述窗口管理器新建并激活所述应用的顶层窗口。In the second aspect, the embodiment of the present invention provides a device for realizing the application singleton function, and the device includes: a judging module, a calling module and an activating module. Among them, the judging module is used to judge whether the application has a running instance when receiving the start command of the application; the calling module is used to call the window manager to activate the application when the application has a running instance. The top-level window of the application; an activation module, configured to call the window manager to create and activate the top-level window of the application when there is no running instance of the application.
根据本发明实施例提供的应用单例功能的实现装置,所述判断模块中的判断所述应用是否有运行的实例,包括:According to the implementation device of the application singleton function provided by the embodiment of the present invention, the judging whether the application has a running instance in the judging module includes:
通过所述启动器判断所述应用是否有对应的顶层窗口标识;judging by the launcher whether the application has a corresponding top-level window identifier;
在具有对应的顶层窗口标识的应用确定为有运行的实例。The application identified with the corresponding top-level window is determined to have a running instance.
第三方面,本发明实施例提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一项所述应用单例功能的实现方法的步骤。In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the program, any of the above-mentioned The steps of the implementation method of the application singleton function described in item.
第四方面,本发明实施例提供了一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一项所述应用单例功能的实现的方法的步骤。In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the realization of the application singleton function as described in any one of the above is realized steps of the method.
第五方面,本发明实施例提供了一种计算机程序产品,包括存储在所述非暂态计算机可读存储介质上的计算机程序,该计算机程序被处理器实现如上述任一项所述应用单例功能的实现的方法的步骤。In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program stored on the non-transitory computer-readable storage medium, and the computer program is implemented by a processor. The steps of the method for realizing the function of the example.
第六方面,本发明实施例提供了一种计算机程序,包括程序指令,该程序指令被计算机执行时实现如上述任一项所述应用单例功能的实现的方法的步骤。In a sixth aspect, an embodiment of the present invention provides a computer program, including program instructions. When the program instructions are executed by a computer, the steps of the method for implementing the application singleton function described in any one of the above items are implemented.
本发明实施例提供的一种应用单例功能的实现方法和装置,在接收到应用的启动命令的情况下,通过启动器判断应用是否有运行的实例;在应用有运行的实例的情况下,通过启动器调用窗口管理器激活应用的顶层窗口,进而实现该顶层窗口对应的应用设置为系统当前的活动应用,实现激活之前启动的应用的功能;在应用没有运行的实例的情况下,通过启动器调用窗口管理器新建并激活应用的顶层窗口。In the method and device for realizing the application singleton function provided by the embodiments of the present invention, in the case of receiving the startup command of the application, it is judged through the launcher whether the application has a running instance; in the case of the application having a running instance, Activate the top-level window of the application by calling the window manager through the launcher, and then realize that the application corresponding to the top-level window is set as the current active application of the system, and realize the function of activating the application that was started before; The manager calls the window manager to create and activate the application's top-level window.
附图说明Description of drawings
为了更清楚地说明本公开或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are the present invention For some disclosed embodiments, those skilled in the art can also obtain other drawings based on these drawings without any creative work.
图1是本发明实施例提供的一种应用单例功能的实现方法的流程示意图;FIG. 1 is a schematic flow diagram of a method for implementing an application singleton function provided by an embodiment of the present invention;
图2是本发明实施例提供的在激活应用的顶层窗口之后的三种情况的示意图;Fig. 2 is a schematic diagram of three situations after activating the top-level window of the application provided by the embodiment of the present invention;
图3是本发明实施例提供的多主体交互的应用单例功能的实现方法的程序流程图;Fig. 3 is a program flow chart of a method for implementing a multi-agent interaction application singleton function provided by an embodiment of the present invention;
图4是本发明实施例提供的多主体交互的三种情况的示意图;Fig. 4 is a schematic diagram of three situations of multi-agent interaction provided by an embodiment of the present invention;
图5是本发明实施例提供的一种应用单例功能的实现装置示意图;Fig. 5 is a schematic diagram of a device for realizing the application singleton function provided by the embodiment of the present invention;
图6是本发明实施例提供的电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开实施例一部分实施例,而不是全部的实施例。基于本公开实施例中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开实施例保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments It is a part of the embodiments of the present disclosure, but not all of them. Based on the embodiments in the embodiments of the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the embodiments of the present disclosure.
应用单例功能是指当某个组件被创建出来后,再有其它人调用该组件时,不再重复创建,而是将已经创建好的组件的实例返回给调用者,相当于多个调用者共享同一个组件,从而节省重复创建的时间和内存。The application singleton function means that when a component is created, and other people call the component, it will not be created repeatedly, but the instance of the already created component will be returned to the caller, which is equivalent to multiple callers Share the same component, saving time and memory for repeated creation.
应用单例,是一种系统实现模式。在它的核心结构中只包含一个被运行的特殊单例。通过应用单例可以保证系统中,一个应用在同一时刻,只有一个实例在运行。在移动设备中,整个系统只需要一个可运行的实例即可,有利于协调系统整体的行为。The application singleton is a system implementation pattern. In its core structure contains only one special singleton that is executed. By applying a singleton, it can be guaranteed that in the system, only one instance of an application is running at the same time. In a mobile device, the entire system only needs one runnable instance, which is conducive to coordinating the overall behavior of the system.
在发明人所知的技术中,有若干方式可以实现应用单例。一种方式是在系统层面上通过所限定的软件开发工具包(Software Development Kit,SDK)以及开发框架实现应用单例,如iOS、Android等。以Android为例,应用启动都由活动管理服务(Activity Manager Service,AMS)进行控制。另一种方式是在应用层面上实现,应用的开发者在开发应用(Application,App)时在代码逻辑中控制为应用单例模式。In the technology known to the inventor, there are several ways to realize application singleton. One way is to implement application singletons at the system level through defined software development kits (Software Development Kit, SDK) and development frameworks, such as iOS and Android. Taking Android as an example, application startup is controlled by the Activity Manager Service (AMS). Another way is to implement it at the application level. When developing an application (Application, App), the developer of the application controls the application singleton mode in the code logic.
传统的桌面系统,例如Windows、Linux等,都不具有实现应用单例的功能,这类系统在其运行在类移动端设备上时,隐藏掉任务导航栏后,很难实现移动端系统应用单例所提供的快速激活已启动应用的功能。Traditional desktop systems, such as Windows and Linux, do not have the function of implementing application singletons. When such systems run on similar mobile devices, after hiding the task navigation bar, it is difficult to implement mobile system application singletons. The function provided by the example to quickly activate the launched application.
在本发明实施例中,所公开的实现方法可以适用于各种移动设备、终端设备等。移动设备、终端设备,为本领域技术人员所普遍理解的,可以是平板Pad、智能手机、智能个人数字助理(Personal Digital Assistant,PDA)、电子书等。In the embodiment of the present invention, the disclosed implementation method may be applicable to various mobile devices, terminal devices, and the like. The mobile device and the terminal device are generally understood by those skilled in the art, and may be a tablet Pad, a smart phone, an intelligent personal digital assistant (Personal Digital Assistant, PDA), an e-book, and the like.
尽管没有明确描述的,本发明实施例的方法,可以应用于各种不具备应用单例功能的桌面系统,如Linux、Windows、Mac OS等,尤其的可以适用于Linux。Although not explicitly described, the method of the embodiment of the present invention can be applied to various desktop systems that do not have the application singleton function, such as Linux, Windows, Mac OS, etc., especially applicable to Linux.
在本发明的实施例中,所称的Linux包括各种以Linux kernel为基础实现的发行版,例如Ubuntu、Debian等。In an embodiment of the present invention, so-called Linux includes various distributions based on the Linux kernel, such as Ubuntu, Debian, etc.
参照图1,为本发明实施例提供的一种应用单例功能的实现方法的流程示意图,该方法包括:Referring to FIG. 1 , it is a schematic flowchart of a method for implementing an application singleton function provided by an embodiment of the present invention. The method includes:
110,在接收到应用的启动命令的情况下,判断应用是否有运行的实例。110. When an application startup command is received, determine whether the application has a running instance.
该步骤中,应用是指安装于移动设备、类移动设备或终端设备场景中实现特定功能的软件,可以供单用户或多用户使用。在使用操作系统时,根据用户的需求可以自己定制添加或删除不同的应用。In this step, an application refers to software installed on a mobile device, a quasi-mobile device, or a terminal device to implement specific functions, and can be used by a single user or multiple users. When using the operating system, different applications can be customized to add or delete according to the user's needs.
运行的实例是指操作系统中一系列的进程以及为这些进程所分配的内存块,而进程定义为正在运行的程序。A running instance refers to a series of processes in the operating system and memory blocks allocated for these processes, and a process is defined as a running program.
启动命令可以为用户对应用进行鼠标单/双击操作、通过快捷键操作、或通过命令行操作等。启动类型可以包括可视化界面(Activity)启动方式、系统服务(Service)启动方式、广播启动方式以及数据提供者(Content Provider)启动方式等。对应用接收到的启动命令也可以理解为该应用进程是否具有通过某种启动类型的方式进行启动的权限。The start command can be used for the user to perform a mouse single/double-click operation, a shortcut key operation, or a command line operation on the application. The startup type may include a visual interface (Activity) startup method, a system service (Service) startup method, a broadcast startup method, a data provider (Content Provider) startup method, and the like. The startup command received by the application can also be understood as whether the application process has the right to start in a certain startup type.
120,在应用有运行的实例的情况下,调用窗口管理器激活应用的顶层窗口。120. In the case that the application has a running instance, call the window manager to activate the top-level window of the application.
该步骤中,窗口管理器是用户在系统里的主要图形管理模块。窗口管理器是个程序,它控制窗口的外表、位置、窗口层级和提供用户去操作这些窗口程序的方法。当窗口管理器开始运作时,服务器和客户端之间的互动,会重新导向到窗口管理器。每当要显示一个新窗口时,这个请求便会被重新导向到窗口管理器,它会决定窗口的初始位置及其窗口层级。窗口管理器也负责处理图示,当使用者将窗口图示化时,窗口管理器会取消窗口的映射,并完成适当的动作,将窗口改显示成图示。某些窗口管理器并不支援图示功能。窗口管理器主要的目标,是用来管理窗口的。许多窗口管理器提供附加的功能,如处理鼠标在根窗口上的点击,呈现出窗格以及其它的视觉化元件,处理按键,判定哪一个应用程序在启动时执行等。常见的窗口管理器的实现,例如,Windows中的桌面窗口管理器(Desktop Window Manager,DWM)、Linux中的X Window、Wayland等。In this step, the window manager is the user's main graphics management module in the system. A window manager is a program that controls the appearance, position, and hierarchy of windows and provides methods for users to operate these window programs. When the window manager is started, the interaction between the server and the client is redirected to the window manager. Whenever a new window is to be displayed, the request is redirected to the window manager, which determines the initial position of the window and its window hierarchy. The window manager is also responsible for handling the icon. When the user icons the window, the window manager will unmap the window and perform appropriate actions to change the window to an icon. Some window managers do not support icons. The main goal of a window manager is to manage windows. Many window managers provide additional functionality, such as handling mouse clicks on the root window, rendering panes and other visual elements, handling keystrokes, determining which application to execute at startup, and so on. Implementation of common window managers, for example, Desktop Window Manager (Desktop Window Manager, DWM) in Windows, X Window, Wayland in Linux, etc.
窗口是指应用程序为使用数据而在图形用户界面中设置的基本单元。应用程序和数据在窗口内实现一体化。在窗口中,用户可以在窗口中操作应用程序,进行数据的管理、生成和编辑。通常在窗口四周设有菜单、图标,数据放在中央。窗口界面是指采用窗口形式显示计算机操作用户界面。A window is the basic unit that an application sets up in a graphical user interface for working with data. Applications and data are integrated within the window. In the window, the user can operate the application program in the window to manage, generate and edit data. Usually there are menus and icons around the window, and the data is placed in the center. The window interface refers to displaying the computer operation user interface in the form of a window.
每当用户开始运行一个应用程序时,应用程序就创建并显示一个窗口;当用户操作窗口中的对象时,程序会作出相应反应。用户通过关闭一个窗口来终止一个程序的运行;通过选择相应的应用程序窗口来选择相应的应用程序。Whenever the user starts to run an application, the application creates and displays a window; when the user manipulates objects in the window, the program reacts accordingly. The user terminates the operation of a program by closing a window; selects the corresponding application program by selecting the corresponding application program window.
对应地,顶层窗口指的是即浏览器打开的最外层的窗口(Window),显示在最上面,覆盖其他窗口,没有其他窗口挡住它。Correspondingly, the top-level window refers to the outermost window (Window) opened by the browser, which is displayed on the top, covers other windows, and is not blocked by other windows.
激活指的是将顶层窗口调到前台,即设置为应用层级的最上面。Activation refers to bringing the top-level window to the foreground, that is, setting it to the top of the application hierarchy.
具体地,在本发明具体实施例中,用户已经对应用的图标进行过单/双击操作、快捷键操作、或命令行操作,即该应用有运行的实例,通过启动器调用窗口管理器将应用的顶层窗口显示在应用层级的最上面。Specifically, in a specific embodiment of the present invention, the user has performed a single/double-click operation, shortcut key operation, or command line operation on the icon of the application, that is, the application has a running instance, and the window manager is invoked by the launcher to open the application The top-level window of is displayed at the top of the application hierarchy.
130,在应用没有运行的实例的情况下,调用窗口管理器新建并激活应用的顶层窗口。130. In the case that the application has no running instance, call the window manager to create and activate the top-level window of the application.
该步骤中,新建顶层窗口可以理解为,在用户没有对应用的图标进行过单/双击操作、快捷键操作、或命令行操作,即该应用没有运行的实例的情况下,该应用不存在顶层窗口,对这样的应用建立顶层窗口。In this step, creating a new top-level window can be understood as, if the user has not performed a single/double-click operation, shortcut key operation, or command line operation on the application icon, that is, if the application does not have a running instance, the application does not have a top-level window. Window, which creates a top-level window for such an application.
激活应用的顶层窗口可以理解为,将新建的顶层窗口调到前台,设置为应用层级的最上面。Activating the top-level window of the application can be understood as bringing the newly created top-level window to the foreground and setting it as the topmost of the application hierarchy.
本发明实施例提供的一种应用单例功能的实现方法,在接收到应用的启动命令的情况下,通过启动器判断应用是否有运行的实例;在应用有运行的实例的情况下,通过启动器调用窗口管理器激活应用的顶层窗口,进而实现该顶层窗口对应的应用设置为系统当前的活动应用,实现激活之前启动的应用的功能;在应用没有运行的实例的情况下,通过启动器调用窗口管理器新建并激活应用的顶层窗口。The implementation method of the application singleton function provided by the embodiment of the present invention, in the case of receiving the start command of the application, judge whether the application has a running instance through the launcher; The window manager calls the window manager to activate the top-level window of the application, and then realizes that the application corresponding to the top-level window is set as the current active application of the system, and realizes the function of activating the application started before; The window manager creates and activates the application's top-level window.
基于上述任一实施例,本发明实施例提供了判断应用是否有运行的实例的流程示意图,具体包括:Based on any of the above-mentioned embodiments, the embodiment of the present invention provides a schematic flowchart of an instance of judging whether an application is running, specifically including:
判断应用是否有对应的顶层窗口标识,在具有对应的顶层窗口标识的应用确定为有运行的实例。It is judged whether the application has a corresponding top-level window identifier, and the application with the corresponding top-level window identifier is determined to have a running instance.
具体地,顶层窗口标识指的是用来识别顶层窗口的记号,例如可以通过进程id实现。各应用的顶层窗口标识则是唯一的表示在任一个应用中的任一顶层窗口身份或名称,与其他的顶层窗口相区别。顶层窗口标识可以用来标识该窗口属于哪个应用。Specifically, the top-level window identifier refers to a mark used to identify the top-level window, for example, it can be realized through a process id. The top-level window identifier of each application uniquely represents the identity or name of any top-level window in any application, which is different from other top-level windows. The top-level window identifier can be used to identify which application the window belongs to.
对应地,利用启动器来判断用户的应用是否有对应的顶层窗口标识,在应用具有对应的顶层窗口标识的情况下,表示该应用之前已经启动过,即应用有运行的实例;在应用不具有对应的顶层窗口标识的情况下,表示该应用之前没有启动过,即应用没有运行的实例。Correspondingly, use the launcher to determine whether the user's application has a corresponding top-level window ID. If the application has a corresponding top-level window ID, it means that the application has been started before, that is, the application has a running instance; If the corresponding top-level window is identified, it means that the application has not been started before, that is, there is no running instance of the application.
由于应用的顶层窗口标识具有唯一识别该窗口是哪个应用的功能,因此利用顶层窗口标识能够准确判断用户的应用是否被打开过。Since the top-level window identifier of an application has the function of uniquely identifying which application the window is, it can be accurately determined whether the user's application has been opened by using the top-level window identifier.
基于上述任一实施例,调用窗口管理器激活应用的顶层窗口,包括:Based on any of the above embodiments, calling the window manager to activate the top-level window of the application includes:
基于应用的顶层窗口标识,调用窗口管理器激活存储于窗口栈中的顶层窗口;其中,顶层窗口与顶层窗口标识相对应。Based on the top-level window identifier of the application, the window manager is invoked to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
该步骤中,窗口栈指的是存放不同类型的窗口的容器,例如,应用程序窗口、文档类 型窗口等。In this step, the window stack refers to containers for storing different types of windows, for example, application windows, document type windows, etc.
具体地,顶层窗口位于窗口栈的最上层,用户已经对应用的图块或图标进行过单/双击操作、快捷键操作、或命令行操作,即该应用有运行的实例的情况下,基于与顶层窗口对应的顶层窗口标识,对存储在窗口栈中的顶层窗口进行激活,将该顶层窗口显示在应用层级的最上面,即用户此时能够打开之前已经启动的应用。Specifically, the top-level window is located at the top of the window stack, and the user has performed a single/double-click operation, shortcut key operation, or command line operation on the tile or icon of the application, that is, if the application has a running instance, based on the The top-level window identifier corresponding to the top-level window activates the top-level window stored in the window stack, and displays the top-level window at the top of the application hierarchy, that is, the user can open the previously started application at this time.
通过调用窗口管理器激活存储于窗口栈中的顶层窗口,能够实现对已经启动的应用进行定位,达到快速激活已启动应用的功能。By calling the window manager to activate the top-level window stored in the window stack, it is possible to locate the started application and achieve the function of quickly activating the started application.
基于上述任一实施例,调用窗口管理器新建并激活应用的顶层窗口,包括:Based on any of the above embodiments, calling the window manager to create and activate the top-level window of the application includes:
调用窗口管理器新建应用的顶层窗口及其对应的顶层窗口标识,激活顶层窗口,并将新建的应用的顶层窗口存储于窗口栈中。Call the window manager to create the top-level window of the application and its corresponding top-level window identifier, activate the top-level window, and store the newly created top-level window of the application in the window stack.
具体地,新建的顶层窗口位于应用窗口栈中的最上层,在用户没有对应用的图块或图标进行过单/双击操作、快捷键操作、或命令行操作,即该应用没有运行的实例的情况下,对该应用新建顶层窗口,对应生成顶层窗口标识,并将新建的应用的顶层窗口存储于窗口栈中。Specifically, the newly created top-level window is located at the top of the application window stack, and the user has not performed a single/double-click operation, shortcut key operation, or command line operation on the tile or icon of the application, that is, the application does not have a running instance. In this case, create a new top-level window for the application, correspondingly generate a top-level window identifier, and store the newly created top-level window of the application in the window stack.
基于新建的顶层窗口标识,对顶层窗口进行激活,即将顶层窗口调到前台设置为应用层级的最上面,用户也能够通过顶层窗口标识判断打开的是哪个应用。Based on the newly created top-level window ID, the top-level window is activated, that is, the top-level window is set to the foreground as the top of the application hierarchy, and the user can also judge which application is opened through the top-level window ID.
在用户没有打开过某个应用的场景下,即该应用不存在顶层窗口,此时对该应用新建顶层窗口,对应生成顶层窗口标识,利用窗口管理器对新建的顶层窗口进行激活,也能够实现对该应用进行定位,达到快速激活已启动应用的功能。In the scenario where the user has not opened an application, that is, the application does not have a top-level window, at this time, a new top-level window is created for the application, and the corresponding top-level window identifier is generated, and the newly created top-level window is activated by using the window manager. The application is positioned to achieve the function of quickly activating the launched application.
基于上述实施例,该方法中还包括:调用窗口管理器新建并激活应用的顶层窗口之后,还包括:Based on the above embodiment, the method further includes: after calling the window manager to create and activate the top-level window of the application, it also includes:
将新建的应用的顶层窗口对应的顶层窗口标识发送至启动器中。Send the top-level window identifier corresponding to the top-level window of the newly created application to the launcher.
该步骤中,启动器包括应用或者内容的表示(例如,图标或命令行等),表示是可选择以便启动对所表示的应用或者内容的执行和访问。常见的启动器实现,例如Mac OS中的Launchpad、Windows中的Start、Linux中的Unity等。In this step, the launcher includes a representation of the application or content (for example, an icon or a command line, etc.), and the representation is selectable to initiate execution and access to the represented application or content. Common launcher implementations, such as Launchpad in Mac OS, Start in Windows, Unity in Linux, etc.
具体地,在用户没有对应用的图标进行过单/双击操作、快捷键操作、或命令行操作,即该应用没有运行的实例的情况下,需要对该应用新建顶层窗口及顶层窗口标识,将顶层窗口标识发送至启动器中进行保存。Specifically, if the user has not performed a single/double-click operation, shortcut key operation, or command line operation on the application icon, that is, if the application does not have a running instance, it is necessary to create a new top-level window and a top-level window identifier for the application. The top-level window ID is sent to the launcher for saving.
基于上述任一实施例,参照图2,为本发明实施例提供的在激活应用的顶层窗口之后的三种情况的示意图,包括:Based on any of the above-mentioned embodiments, referring to FIG. 2 , it is a schematic diagram of three situations after activating the top-level window of the application provided by the embodiment of the present invention, including:
210,在接收到新建顶层窗口指令的情况下,通过启动器继续调用窗口管理器新建应用的顶层窗口及其对应的顶层窗口标识,激活新建后的顶层窗口,其中,新建应用的顶层窗口存储于窗口栈中。210. In the case of receiving the command to create a new top-level window, continue to call the window manager to create a top-level window of the application and its corresponding top-level window identifier through the launcher, and activate the newly created top-level window, wherein the newly created top-level window of the application is stored in in the window stack.
该步骤中,执行新建顶层窗口的指令,对应生成顶层窗口标识,并将新建的应用的顶层窗口存储于窗口栈中,基于新建的顶层窗口标识,对顶层窗口进行激活,即将顶层窗口调到前台设置为应用层级的最上面,用户也能够通过顶层窗口标识判断激活的是哪个应用。In this step, execute the command to create a new top-level window, correspondingly generate a top-level window identifier, and store the newly-created top-level window of the application in the window stack, activate the top-level window based on the newly-created top-level window identifier, that is, bring the top-level window to the foreground Set to the top of the application hierarchy, the user can also determine which application is activated through the top-level window logo.
220,在接收到更新顶层窗口指令的情况下,通过启动器调用窗口管理器更新应用的顶层窗口及其对应的顶层窗口标识,激活更新后的顶层窗口,并将更新后顶层窗口标识发送至启动器中,其中,更新应用的顶层窗口为更新窗口栈中的顶层窗口。220. In the case of receiving an instruction to update the top-level window, call the window manager through the launcher to update the top-level window of the application and its corresponding top-level window identifier, activate the updated top-level window, and send the updated top-level window identifier to the launcher In the browser, the top-level window of the update application is the top-level window in the update window stack.
该步骤中,更新指的是通过点击或触摸等方式,对应用的顶层窗口进行切换,例如,在打开一个应用后,对这个应用中不同的界面进行切换。In this step, updating refers to switching the top-level window of the application by means of clicking or touching, for example, after opening an application, switching between different interfaces in the application.
具体地,对应用中界面切换的过程中,调用窗口管理器更新应用的顶层窗口及其对应的顶层窗口标识,并对更新后的顶层窗口进行激活,将更新后顶层窗口标识发送至启动器中保存。Specifically, in the process of interface switching in the application, call the window manager to update the top-level window of the application and its corresponding top-level window ID, activate the updated top-level window, and send the updated top-level window ID to the launcher save.
230,在接收到关闭顶层窗口指令的情况下,查找应用的窗口栈,判断应用的窗口栈中是否存在窗口,若应用的窗口栈中存在窗口,将应用的窗口栈中的栈顶窗口标识发送至启动器中,若应用的窗口栈中不存在窗口,清空启动器中应用的顶层窗口标识。230. When the command to close the top-level window is received, search the window stack of the application, and determine whether there is a window in the window stack of the application. If there is a window in the window stack of the application, send the top window identifier in the window stack of the application In the launcher, if there is no window in the application's window stack, clear the top-level window identifier of the application in the launcher.
该步骤中,查找该应用对应的窗口栈中是否有其他窗口,若窗口栈中有其他窗口,将窗口栈中除去关闭窗口的最上层窗口作为顶层窗口,并将新的顶层窗口对应的顶层窗口标识保存至启动器中;若该应用已无窗口,将信号0传递给启动器,用于告知启动器该应用已无窗口,下次该应用触发启动时,直接启动新的进程。In this step, it is checked whether there are other windows in the window stack corresponding to the application. If there are other windows in the window stack, the top-level window except the closed window in the window stack is taken as the top-level window, and the top-level window corresponding to the new top-level window is The logo is saved to the launcher; if the application has no window, signal 0 is passed to the launcher to inform the launcher that the application has no window, and the next time the application is triggered to start, a new process will be started directly.
进一步地,对本公开的实施做进一步补充说明:具体参照图3所示,图3表示多主体交互的应用单例功能的实现方法的程序流程图,从用户端、启动器端、应用端以及窗口管理器端同时对应用单例实现的过程进行说明。Further, a further supplementary description is made for the implementation of the present disclosure: specifically refer to FIG. 3 , which shows a program flow chart of a method for realizing the application singleton function of multi-subject interaction, from the user end, the launcher end, the application end, and the window At the same time, the manager side explains the process of implementing the application singleton.
应用单例功能的实现的步骤:Steps to implement the application singleton function:
步骤S1、用户点击应用图标启动应用,或者执行应用启动命令。Step S1, the user clicks the application icon to start the application, or executes an application start command.
步骤S2、通过启动器查找该应用是否有对应的顶层窗口,如果应用没有顶层窗口,执行步骤S3;如果应用有顶层窗口,执行步骤S7。Step S2. Check whether the application has a corresponding top-level window through the launcher. If the application does not have a top-level window, perform step S3; if the application has a top-level window, perform step S7.
步骤S3、通过启动器为该应用启动新的进程。Step S3, start a new process for the application through the launcher.
步骤S4、应用的进程启动后,通过启动器调用窗口管理器新建顶层窗口。Step S4, after the application process is started, the window manager is invoked through the launcher to create a new top-level window.
步骤S5、通过窗口管理器将新建顶层窗口加入到窗口栈,激活该顶层窗口。Step S5, adding the new top-level window to the window stack through the window manager, and activating the top-level window.
步骤S6、将顶层窗口对应生成的顶层窗口标识保存至启动器中。Step S6, saving the generated top-level window identifier corresponding to the top-level window into the launcher.
步骤S7、通过启动器利用应用的顶层窗口标识,调用窗口管理器激活该顶层窗口(将该顶层窗口调到前台即设置为应用层级的最上面)。Step S7, using the top-level window identifier of the application through the launcher, calling the window manager to activate the top-level window (bringing the top-level window to the foreground means setting it as the top of the application hierarchy).
其中,在激活应用的顶层窗口之后存在三种情况的应用窗口的变化,分别为:新建顶层窗口、更新顶层窗口和关闭顶层窗口,参照图4所示,表示多主体交互的三种情况的示意图。Among them, after activating the top-level window of the application, there are three kinds of changes in the application window, namely: creating a new top-level window, updating the top-level window and closing the top-level window, as shown in Figure 4, which represents a schematic diagram of three situations of multi-agent interaction .
1、在应用接收到用户新建顶层窗口指令的情况下,新建的顶层窗口对应生成顶层窗口标识,调用窗口管理器激活新建后的顶层窗口,并将顶层窗口标识保存至启动器中。1. When the application receives an instruction from the user to create a new top-level window, the new top-level window generates a corresponding top-level window ID, calls the window manager to activate the newly created top-level window, and saves the top-level window ID to the launcher.
2、用户通过点击或触摸等方式对应用进行操作,生成更新顶层窗口的指令,应用执行指令,对界面进行切换,窗口管理器对切换后的顶层窗口进行激活,并将切换后的顶层窗口对应的切换后的顶层窗口标识保存至启动器中。2. The user operates the application by clicking or touching, generates an instruction to update the top-level window, and the application executes the instruction to switch the interface. The window manager activates the switched top-level window and maps the switched top-level window to the Save the switched top-level window ID to the launcher.
3、在接收到关闭顶层窗口指令的情况下,查找该应用对应的窗口栈中是否有其他窗口,若窗口栈中有其他窗口,将其他窗口中的栈顶窗口作为顶层窗口,并将新的顶层窗口对应的顶层窗口标识保存至启动器中;若该应用已无窗口,将信号0传递给启动器,告诉启动器,该应用已无窗口,下次该应用触发启动时,直接启动新的进程。3. When the command to close the top-level window is received, check whether there are other windows in the window stack corresponding to the application. If there are other windows in the window stack, use the stack top window in other windows as the top-level window, and set the new The top-level window identifier corresponding to the top-level window is saved in the launcher; if the application has no window, pass the signal 0 to the launcher to tell the launcher that the application has no window, and the next time the application is triggered to start, a new one will be launched directly process.
基于上述任一实施例,参照图5,为本发明实施例提供的一种应用单例功能的实现装置,该装置包括:判断模块510、调用模块520和激活模块530。其中,判断模块510,用于在接收到应用的启动命令的情况下,通过启动器判断应用是否有运行的实例;调用模块520,用于若应用有运行的实例,通过启动器调用窗口管理器激活应用的顶层窗口;激活模块530,用于若应用没有运行的实例,通过启动器调用窗口管理器新建并激活应用的顶层窗口。Based on any of the above embodiments, referring to FIG. 5 , it is an implementation device for application singleton function provided by the embodiment of the present invention, the device includes: a judging module 510 , a calling module 520 and an activating module 530 . Among them, the judging module 510 is used to judge whether the application has a running instance through the launcher when receiving the start command of the application; the calling module 520 is used to call the window manager through the launcher if the application has a running instance Activate the top-level window of the application; the activation module 530 is used to call the window manager through the launcher to create and activate the top-level window of the application if there is no running instance of the application.
本发明实施例提供的一种应用单例功能的实现装置,在接收到应用的启动命令的情况下,通过启动器判断应用是否有运行的实例;若应用有运行的实例,通过启动器调用窗口管理器激活应用的顶层窗口,进而实现将该顶层窗口对应的应用设置为系统当前的活动应用,实现激活之前启动的应用的功能;若应用没有运行的实例,通过启动器调用窗口管理器新建并激活应用的顶层窗口。The implementation device of the application singleton function provided by the embodiment of the present invention, in the case of receiving the start command of the application, judges whether the application has a running instance through the launcher; if the application has a running instance, calls the window through the launcher The manager activates the top-level window of the application, and then realizes setting the application corresponding to the top-level window as the current active application of the system, realizing the function of activating the application started before; if the application does not have a running instance, call the window manager to create and Activate the application's top-level window.
基于上述任一实施例,所述判断模块510具体用于:Based on any of the above embodiments, the judging module 510 is specifically configured to:
通过启动器判断应用是否有对应的顶层窗口标识;Use the launcher to determine whether the application has a corresponding top-level window identifier;
若应用具有对应的顶层窗口标识,应用有运行的实例;If the application has a corresponding top-level window identifier, the application has a running instance;
若应用不具有对应的顶层窗口标识,应用没有运行的实例。If the application does not have a corresponding top-level window identifier, the application has no running instance.
基于上述任一实施例,所述调用模块520,具体用于:Based on any of the above embodiments, the calling module 520 is specifically configured to:
通过所述启动器基于所述应用的顶层窗口标识,调用所述窗口管理器激活存储于窗口栈中的顶层窗口;其中,所述顶层窗口与所述顶层窗口标识相对应。Based on the top-level window identifier of the application, the launcher invokes the window manager to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
基于上述任一实施例,所述激活模块530,具体用于:Based on any of the above embodiments, the activation module 530 is specifically configured to:
通过所述启动器调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活所述顶层窗口,并将新建的所述应用的顶层窗口存储于所述窗口栈中。The launcher calls the window manager to create a top-level window of the application and its corresponding top-level window identifier, activate the top-level window, and store the newly created top-level window of the application in the window stack.
基于上述任一实施例,所述装置还包括:Based on any of the above-mentioned embodiments, the device further includes:
发送模块,用于将所述新建的所述应用的顶层窗口对应的顶层窗口标识发送至所述启动器中。A sending module, configured to send the newly created top-level window identifier corresponding to the top-level window of the application to the launcher.
基于上述任一实施例,所述在激活所述应用的顶层窗口之后,所述装置还包括:Based on any of the above embodiments, after activating the top-level window of the application, the device further includes:
新建模块,用于在接收到新建顶层窗口指令的情况下,调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活新建后的所述顶层窗口,其中,所述新建所述应用的顶层窗口存储于所述窗口栈中;The new module is configured to call the window manager to create the top-level window of the application and its corresponding top-level window identifier, and activate the newly-created top-level window when the instruction of creating a new top-level window is received, wherein the The newly created top-level window of the application is stored in the window stack;
更新模块,用于在接收到更新顶层窗口指令的情况下,调用所述窗口管理器更新所述应用的顶层窗口及其对应的顶层窗口标识,激活更新后的顶层窗口,并将更新后顶层窗口标识发送至所述启动器中,其中,所述更新所述应用的顶层窗口为更新所述窗口栈中的顶层窗口;An update module, configured to call the window manager to update the top-level window of the application and its corresponding top-level window identifier, activate the updated top-level window, and set the updated top-level window The identification is sent to the launcher, wherein the updating the top-level window of the application is updating the top-level window in the window stack;
关闭模块,用于在接收到关闭顶层窗口指令的情况下,查找所述应用的窗口栈,判断所述应用的窗口栈中是否存在窗口,若所述应用的窗口栈中存在窗口,将所述应用的窗口栈中的栈顶窗口标识发送至所述启动器中,若所述应用的窗口栈中不存在窗口,清空所述启动器中应用的顶层窗口标识。The closing module is used to search the window stack of the application when receiving the command to close the top-level window, and judge whether there is a window in the window stack of the application. If there is a window in the window stack of the application, the The stack-top window identifier in the application window stack is sent to the launcher, and if there is no window in the application window stack, the top-level window identifier of the application in the launcher is cleared.
图6为本发明实施例提供的电子设备的结构示意图,如图6所示,该电子设备可以包括:处理器(Processor)610、通信接口(Communications Interface)620、存储器(Memory)630和通信总线640,其中,处理器610,通信接口620,存储器630通过通信总线640完成相互间的通信。处理器610可以调用存储器630中的逻辑命令,以执行如下方法:在接收到应用的启动命令的情况下,通过启动器判断所述应用是否有运行的实例;若所述应用有运行的实例,通过所述启动器调用窗口管理器激活所述应用的顶层窗口;若所述应用没有运行的实例,通过所述启动器调用所述窗口管理器新建并激活所述应用的顶层窗口。Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. As shown in Fig. 6, the electronic device may include: a processor (Processor) 610, a communication interface (Communications Interface) 620, a memory (Memory) 630 and a communication bus 640 , where the processor 610 , the communication interface 620 , and the memory 630 communicate with each other through the communication bus 640 . The processor 610 can call the logic command in the memory 630 to execute the following method: when receiving the startup command of the application, judge whether the application has a running instance through the launcher; if the application has a running instance, calling the window manager through the launcher to activate the top-level window of the application; if the application has no running instance, calling the window manager through the launcher to create and activate the top-level window of the application.
此外,上述的存储器630中的逻辑命令可以通过软件功能单元的形式实现并作为独立 的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干命令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the logic commands in the above-mentioned memory 630 can be implemented in the form of software function units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several commands are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
本发明实施例还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各实施例提供的方法,例如包括:在接收到应用的启动命令的情况下,通过启动器判断所述应用是否有运行的实例;若所述应用有运行的实例,通过所述启动器调用窗口管理器激活所述应用的顶层窗口;若所述应用没有运行的实例,通过所述启动器调用所述窗口管理器新建并激活所述应用的顶层窗口。An embodiment of the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the methods provided in the above-mentioned embodiments are implemented, for example, including: receiving the application In the case of a startup command, judge whether the application has a running instance through the launcher; if the application has a running instance, call the window manager to activate the top-level window of the application through the launcher; if the application If there is no running instance, the launcher invokes the window manager to create and activate the top-level window of the application.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干命令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the implementations, those skilled in the art can clearly understand that each implementation can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic Disc, CD, etc., including several commands to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims (12)

  1. 一种应用单例功能的实现方法,应用于启动器,所述方法包括:A method for implementing the application singleton function, applied to a starter, the method includes:
    在接收到应用的启动命令的情况下,判断所述应用是否有运行的实例;In the case of receiving an application startup command, determine whether the application has a running instance;
    在所述应用有运行的实例的情况下,调用窗口管理器激活所述应用的顶层窗口;In the case that the application has a running instance, calling the window manager to activate the top-level window of the application;
    在所述应用没有运行的实例的情况下,调用所述窗口管理器新建并激活所述应用的顶层窗口。In the case that the application has no running instance, the window manager is called to create and activate the top-level window of the application.
  2. 根据权利要求1所述的应用单例功能的实现方法,所述判断所述应用是否有运行的实例,包括:According to the implementation method of application singleton function according to claim 1, said judging whether said application has a running instance comprises:
    判断所述应用是否有对应的顶层窗口标识;Judging whether the application has a corresponding top-level window identifier;
    在具有所述对应的顶层窗口标识的应用确定为有运行的实例。The application with the corresponding top-level window identifier is determined to have a running instance.
  3. 根据权利要求1或2所述的应用单例功能的实现方法,所述调用窗口管理器激活所述应用的顶层窗口,包括:According to the implementation method of the application singleton function according to claim 1 or 2, the calling window manager to activate the top-level window of the application includes:
    基于所述应用的顶层窗口标识,调用所述窗口管理器激活存储于窗口栈中的顶层窗口;其中,所述顶层窗口与所述顶层窗口标识相对应。Based on the top-level window identifier of the application, the window manager is called to activate the top-level window stored in the window stack; wherein, the top-level window corresponds to the top-level window identifier.
  4. 根据权利要求1至3任一项所述的应用单例功能的实现方法,所述调用所述窗口管理器新建并激活所述应用的顶层窗口,包括:According to the implementation method of the application singleton function according to any one of claims 1 to 3, the calling the window manager to create and activate the top-level window of the application includes:
    调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活所述顶层窗口,并将新建的所述应用的顶层窗口存储于所述窗口栈中。calling the window manager to create a top-level window of the application and its corresponding top-level window identifier, activating the top-level window, and storing the newly created top-level window of the application in the window stack.
  5. 根据权利要求1至4任一项所述的应用单例功能的实现方法,所述调用所述窗口管理器新建并激活所述应用的顶层窗口之后,还包括:According to the implementation method of the application singleton function according to any one of claims 1 to 4, after calling the window manager to create and activate the top-level window of the application, it also includes:
    将所述新建的所述应用的顶层窗口对应的顶层窗口标识发送至所述启动器中。Sending the newly created top-level window identifier corresponding to the top-level window of the application to the launcher.
  6. 根据权利要求1至5任一项所述的应用单例功能的实现方法,在所述激活所述应用的顶层窗口之后,所述方法还包括:According to the implementation method of the application singleton function according to any one of claims 1 to 5, after the activation of the top-level window of the application, the method further includes:
    在接收到新建顶层窗口指令的情况下,调用所述窗口管理器新建所述应用的顶层窗口及其对应的顶层窗口标识,激活新建后的所述顶层窗口,其中,所述新建所述应用的顶层窗口存储于所述窗口栈中;In the case of receiving the command to create a new top-level window, call the window manager to create a new top-level window of the application and its corresponding top-level window identifier, and activate the newly created top-level window, wherein the newly created top-level window of the application The top-level window is stored in the window stack;
    在接收到更新顶层窗口指令的情况下,调用所述窗口管理器更新所述应用的顶层窗口及其对应的顶层窗口标识,激活更新后的顶层窗口,并将更新后顶层窗口标识发送至所述启动器中,其中,所述更新所述应用的顶层窗口为更新所述窗口栈中的顶层窗口;In the case of receiving an instruction to update the top-level window, call the window manager to update the top-level window of the application and its corresponding top-level window identifier, activate the updated top-level window, and send the updated top-level window identifier to the In the launcher, wherein the updating the top-level window of the application is updating the top-level window in the window stack;
    在接收到关闭顶层窗口指令的情况下,查找所述应用的窗口栈,判断所述应用的窗口 栈中是否存在窗口,若所述应用的窗口栈中存在窗口,将所述应用的窗口栈中的栈顶窗口标识发送至所述启动器中,若所述应用的窗口栈中不存在窗口,清空所述启动器中应用的顶层窗口标识。When the command to close the top-level window is received, the window stack of the application is searched to determine whether there is a window in the window stack of the application, and if there is a window in the window stack of the application, the The stack-top window ID of the application is sent to the launcher, and if there is no window in the window stack of the application, the top-level window ID of the application in the launcher is cleared.
  7. 一种应用单例功能的实现装置,所述装置包括:A device for implementing a singleton function, the device comprising:
    判断模块,用于在接收到应用的启动命令的情况下,判断所述应用是否有运行的实例;A judging module, configured to judge whether the application has a running instance in the case of receiving the start command of the application;
    调用模块,用于在所述应用有运行的实例的情况下,调用窗口管理器激活所述应用的顶层窗口;The calling module is used to call the window manager to activate the top-level window of the application when the application has a running instance;
    激活模块,用于在所述应用没有运行的实例的情况下,调用所述窗口管理器新建并激活所述应用的顶层窗口。An activation module, configured to call the window manager to create and activate a top-level window of the application when there is no running instance of the application.
  8. 根据权利要求7所述的应用单例功能的实现装置,所述判断模块具体用于:According to the device for realizing the application singleton function according to claim 7, the judgment module is specifically used for:
    判断所述应用是否有对应的顶层窗口标识;Judging whether the application has a corresponding top-level window identifier;
    在具有对应的顶层窗口标识的应用确定为有运行的实例。The application identified with the corresponding top-level window is determined to have a running instance.
  9. 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如权利要求1至6任一项所述应用单例功能的实现方法的步骤。An electronic device, comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, when the processor executes the program, the application single instance described in any one of claims 1 to 6 is realized The steps of the realization method of the function.
  10. 一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如权利要求1至6任一项所述应用单例功能的实现的方法的步骤。A non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for realizing the function of the application singleton as described in any one of claims 1 to 6 are implemented.
  11. 一种计算机程序产品,包括存储在所述非暂态计算机可读存储介质上的计算机程序,所述计算机程序被处理器执行时实现如权利要求1至6任一项所述的图形渲染方法的步骤。A computer program product, comprising a computer program stored on the non-transitory computer-readable storage medium, when the computer program is executed by a processor, it implements the graphics rendering method according to any one of claims 1 to 6 step.
  12. 一种计算机程序,包括程序指令,所述程序指令被计算机执行时实现如权利要求1至6任一项所述图形渲染方法的步骤。A computer program, including program instructions, when the program instructions are executed by a computer, the steps of the graphics rendering method according to any one of claims 1 to 6 are implemented.
PCT/CN2022/104470 2021-08-31 2022-07-07 Method for implementing single instance function of application, and apparatus WO2023029747A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111008251.0A CN113448651B (en) 2021-08-31 2021-08-31 Method and device for realizing application singleton function
CN202111008251.0 2021-08-31

Publications (1)

Publication Number Publication Date
WO2023029747A1 true WO2023029747A1 (en) 2023-03-09

Family

ID=77819103

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104470 WO2023029747A1 (en) 2021-08-31 2022-07-07 Method for implementing single instance function of application, and apparatus

Country Status (2)

Country Link
CN (1) CN113448651B (en)
WO (1) WO2023029747A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113448651B (en) * 2021-08-31 2021-12-14 北京鲸鲮信息系统技术有限公司 Method and device for realizing application singleton function
CN115567733B (en) * 2022-11-15 2023-02-07 易方信息科技股份有限公司 SDK-based live broadcast room switching method, device, terminal and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090235200A1 (en) * 2008-03-13 2009-09-17 Microsoft Corporation Unifying application launchers and switchers
CN104461242A (en) * 2014-12-08 2015-03-25 深圳市嘉乐派科技有限公司 Multiwindow interface realization method based on Android operating system
CN105528257A (en) * 2016-01-08 2016-04-27 腾讯科技(深圳)有限公司 Single process data processing method and device
CN108205417A (en) * 2017-10-27 2018-06-26 珠海市魅族科技有限公司 Switching method and device, the computer installation and readable storage medium storing program for executing of foreground application
CN109725950A (en) * 2018-12-29 2019-05-07 武汉斗鱼网络科技有限公司 A kind of method, apparatus and storage medium for realizing the operation of client list example
CN113448651A (en) * 2021-08-31 2021-09-28 北京鲸鲮信息系统技术有限公司 Method and device for realizing application singleton function

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9880861B2 (en) * 2013-06-05 2018-01-30 Tencent Technology (Shenzhen) Company Limited Method and apparatus for page view switching
CN106598572B (en) * 2016-11-17 2018-08-03 武汉斗鱼网络科技有限公司 Method and device is exited in a kind of application
CN108958830B (en) * 2018-06-06 2021-09-17 Oppo广东移动通信有限公司 Application program starting method and device, storage medium and terminal
CN109828804A (en) * 2018-12-11 2019-05-31 中新金桥数字科技(北京)有限公司 Preservation and restoration methods and its system based on multiwindow in Android Pad program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090235200A1 (en) * 2008-03-13 2009-09-17 Microsoft Corporation Unifying application launchers and switchers
CN104461242A (en) * 2014-12-08 2015-03-25 深圳市嘉乐派科技有限公司 Multiwindow interface realization method based on Android operating system
CN105528257A (en) * 2016-01-08 2016-04-27 腾讯科技(深圳)有限公司 Single process data processing method and device
CN108205417A (en) * 2017-10-27 2018-06-26 珠海市魅族科技有限公司 Switching method and device, the computer installation and readable storage medium storing program for executing of foreground application
CN109725950A (en) * 2018-12-29 2019-05-07 武汉斗鱼网络科技有限公司 A kind of method, apparatus and storage medium for realizing the operation of client list example
CN113448651A (en) * 2021-08-31 2021-09-28 北京鲸鲮信息系统技术有限公司 Method and device for realizing application singleton function

Also Published As

Publication number Publication date
CN113448651A (en) 2021-09-28
CN113448651B (en) 2021-12-14

Similar Documents

Publication Publication Date Title
WO2023029747A1 (en) Method for implementing single instance function of application, and apparatus
US11281360B2 (en) Display management for native user experiences
KR101716802B1 (en) Client-server input method editor architecture
US9588657B1 (en) Seamless integration of non-native windows with dynamically scalable resolution into host operating system
US9317195B1 (en) Seamless integration of non-native windows with dynamically scalable resolution into host operating system
US7346908B2 (en) Changing user identities without closing applications
CA2600503C (en) Method and system for executing a container-managed application on a processing device
US7594192B2 (en) Method and apparatus for identifying hotkey conflicts
EP4206883A1 (en) Permission setting method and apparatus and electronic device
CN107832113A (en) A kind of interface display method and device of android system application program
US6335745B1 (en) Method and system for invoking a function of a graphical object in a graphical user interface
JP2021504826A (en) How to launch application programs, launchers and computer-readable storage media
US20240077998A1 (en) Application compatibility on a computing device
US8225328B2 (en) Access to a target object with desired functionality
WO2018112772A1 (en) Method and apparatus for operating another operating system and electronic device
US11010212B2 (en) System and method for supporting and negotiating multiple API versions across multiple products
US11487559B2 (en) Dynamically switching between pointer modes
US11240293B2 (en) System for supporting remote accesses to a host computer from a mobile computing device
CN109408336A (en) A kind of startup item monitoring method, device, terminal and computer-readable medium
CN108363582A (en) A kind of method and apparatus of intelligent terminal homepage upgrading
CN116126270A (en) Display method and electronic equipment
CN115344352A (en) Virtualization system operation method, device, equipment and medium
WO2006085883A1 (en) Access to a target object with desired functionality
CN111176774A (en) UI (user interface) architecture system based on quantum measurement and control system and application method
Akasaka et al. Providing an efficient way to make desktop icons visible

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22862888

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE