User-defined method and device of mouse right key operation function, terminal equipment and storage medium
By listening to mouse click events and generating a custom right-click menu, the problem that the right-click operation function of the mouse in the existing technology cannot meet the diverse needs, and an efficient and simple custom right-click operation function is achieved.
Patent Information
- Application Number
- CN202411927764.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-29
AI Technical Summary
In the prior art, the right mouse button operation function cannot meet diverse needs, and users need to complete specific operations through cumbersome menu navigation and other keys, resulting in low operation efficiency.
By listening to the mouse click event, determine whether the button type is right-click, and disable the original right-click operation function. Generate a custom right-click command based on the click location, obtain a custom configuration file, generate a right-click menu frame, and generate a custom right-click menu page on the target window.
It realizes the function of custom right-click operation to meet the diverse needs of specific platforms or applications, improves operation efficiency, and simplifies the menu navigation process.
Smart Images

Figure CN119902634A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, terminal equipment and storage medium for customizing a right-button operation function of a mouse. Background Art
[0002] With the rapid development of information technology, various platforms and application systems are becoming increasingly rich, and users' demand for operational convenience and personalization is also growing. In many platforms, the importance of right-click operation as a method of quickly accessing commonly used functions is self-evident. However, the system's built-in right-click function is often limited to some basic operations, such as copying, pasting, deleting, etc., and cannot meet the diverse needs of specific platforms or applications. For example, when users perform daily operations, they need to frequently use a series of customized functions such as sending emails, following, and listing and unlisting. These functions are usually closely related to the business logic of the platform. The system's built-in right-click function obviously cannot meet these specific needs. Users often need to complete related operations through cumbersome menu navigation and other buttons, which cannot meet the diverse needs of specific platforms or applications, and the operation efficiency is low. Summary of the invention
[0003] The embodiments of the present invention provide a method, an apparatus, a terminal device and a storage medium for customizing a right-button operation function of a mouse, which can effectively solve the problem that the right-button operation function of a mouse in the prior art cannot meet diverse needs.
[0004] An embodiment of the present invention provides a method for customizing a right-button operation function of a mouse, comprising:
[0005] When a mouse click event is detected, determine whether the button type corresponding to the mouse click event is a right button;
[0006] When it is determined that the button type corresponding to the mouse click event is the right button, the original right button operation function of the mouse is disabled;
[0007] Obtaining the click position corresponding to the mouse click event, and generating a custom right-click command according to the click position;
[0008] Obtaining a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size;
[0009] Generate a mouse right-button menu frame according to the click position and the right-button menu size;
[0010] A right-click menu page is generated on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
[0011] Furthermore, when it is determined that the button type corresponding to the mouse click event is a right button, disabling the original right button operation function of the mouse includes:
[0012] When it is determined that the button type corresponding to the mouse click event is a right button, an instruction to prevent the default behavior of the right button is generated;
[0013] According to the instruction to prevent the default behavior of the right button, the original right button operation function of the mouse is disabled.
[0014] Further, obtaining a custom configuration file according to the custom right-click command includes:
[0015] According to the custom right-key command, determine the corresponding custom right-key type;
[0016] Determining a corresponding configuration file type from a preset configuration file database according to the custom right-click type;
[0017] According to the configuration file type, the corresponding custom configuration file is obtained.
[0018] Further, generating a mouse right-click menu frame according to the click position and the right-click menu size includes:
[0019] Get the page coordinates of the current page;
[0020] Calculate the right-click menu width and the right-click menu height according to the click position and the right-click menu size;
[0021] Calculate the margins between the click position and the current page according to the click position and the page coordinates to obtain the top margin, bottom margin, left margin and right margin of the page;
[0022] Compare the right-click menu width with the left margin of the page and the right margin of the page to obtain a width comparison result;
[0023] Compare the right-click menu height with the upper margin of the page and the lower margin of the page to obtain a height comparison result;
[0024] A right-click menu frame is generated according to the width comparison result, the height comparison result and the right-click menu size.
[0025] Furthermore, it also includes: when the width of the right-click menu is not less than the left margin of the page, and the width of the right-click menu is less than the right margin of the page, determining that the width comparison result is that the distance between the left side of the right-click menu frame of the mouse and the left side of the current page is the preset side margin;
[0026] When the right-click menu width is not less than the left margin of the page, and the right-click menu width is not less than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the mouse right-click menu frame and the right side of the current page is the preset side margin;
[0027] When the right-click menu width is smaller than the left margin of the page, and the right-click menu width is smaller than the right margin of the page, the width comparison result is determined as follows: the click position is the center point width of the mouse right-click menu frame;
[0028] When the right-click menu width is smaller than the left margin of the page and the right-click menu width is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the right-click menu frame and the right side of the current page is the preset side margin.
[0029] Furthermore, the method further includes: when the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is less than the lower margin of the page, determining that the width comparison result is that the distance between the lower side of the right-click menu frame of the mouse and the lower side of the current page is the preset side margin;
[0030] When the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is not less than the lower margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin;
[0031] When the height of the right-click menu is smaller than the upper margin of the page, and the height of the right-click menu is smaller than the lower margin of the page, the width comparison result is determined as follows: the click position is the upper edge of the mouse right-click menu frame;
[0032] When the height of the right-click menu is smaller than the upper margin of the page and the height of the right-click menu is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin.
[0033] Further, generating a right-click menu page on the target window according to the custom configuration file and the right-click menu framework includes:
[0034] Determine the menu item name and menu item attributes of the corresponding menu item according to the custom configuration file;
[0035] According to the target window, the right-button menu frame of the mouse is associated with the target window to obtain an associated menu window;
[0036] The menu item name and the menu item attribute are mapped to the associated menu window to generate a right-click menu page.
[0037] As an improvement of the above solution, another embodiment of the present invention provides a custom device for a right-button operation function of a mouse, including:
[0038] The right-click judgment module is used to judge whether the button type corresponding to the mouse click event is a right-click when a mouse click event is monitored;
[0039] The original function disabling module is used to disable the original mouse right button operation function when it is determined that the button type corresponding to the mouse click event is the right button;
[0040] A custom command generation module, used to obtain the click position corresponding to the mouse click event, and generate a custom right-click command according to the click position;
[0041] A configuration file acquisition module, used to acquire a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size;
[0042] A right-click menu frame generation module, used to generate a mouse right-click menu frame according to the click position and the right-click menu size;
[0043] The right-click menu generating module is used to generate a right-click menu page on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
[0044] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements a customized method for a right-button mouse operation function as described in the above embodiment.
[0045] Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a customized method of a right-button mouse operation function described in the above embodiment.
[0046] By implementing the present invention, at least the following beneficial effects are achieved:
[0047] The present invention provides a method, device, terminal device and storage medium for customizing a right-button operation function of a mouse. The method can judge whether the button type corresponding to the mouse click event is a right button when a mouse click event is monitored; when it is determined that the button type corresponding to the mouse click event is a right button, disable the original right-button operation function of the mouse; obtain the click position corresponding to the mouse click event, and generate a custom right-button command according to the click position; obtain a custom configuration file according to the custom right-button command; wherein the custom configuration file includes a target window and a right-button menu size; generate a right-button menu frame according to the click position and the right-button menu size; generate a right-button menu page on the target window according to the custom configuration file and the right-button menu frame, so that a user can perform corresponding operations according to the right-button menu page. Based on the general mouse click event and custom configuration file processing mechanism, it can be implemented in different operating systems, terminal devices and applications, so it has high cross-platform compatibility and meets the diverse needs of specific platforms or applications; by monitoring mouse click events and judging button types, it flexibly responds to the user's right-click behavior. Once a right-click is detected, the original mouse right-click operation function can be immediately disabled, and the custom configuration file can be automatically executed to generate a custom right-click menu, which meets the custom menu navigation needs. At the same time, the right-click menu page can be generated without cumbersome menu buttons, and the operation is simple and efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flowchart of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention;
[0049] Figure 2 It is a logical structure diagram of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention;
[0050] Figure 3 This is a first effect diagram of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention;
[0051] Figure 4 This is a second effect diagram of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention;
[0052] Figure 5 It is a third effect diagram of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention;
[0053] Figure 6 It is a structural schematic diagram of a device for customizing a right-button operation function of a mouse provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] See also Figure 1 , is a flowchart of a method for customizing a right-button operation function of a mouse provided by an embodiment of the present invention, including:
[0056] S1. When a mouse click event is monitored, determine whether the button type corresponding to the mouse click event is a right button;
[0057] Specifically, when the user clicks the mouse, a mouse click event is triggered, so it is necessary to determine whether the user clicks the right button of the mouse, such as Figure 2 As shown, after the mouse click event is triggered, it is determined whether the right button of the mouse is clicked. The button types corresponding to the mouse click event include left button, right button and middle button.
[0058] S2. When it is determined that the button type corresponding to the mouse click event is a right button, the original right button operation function of the mouse is disabled;
[0059] Specifically, when it is determined that the button type corresponding to the mouse click event is a right button, disabling the original right button operation function of the mouse includes:
[0060] When it is determined that the button type corresponding to the mouse click event is a right button, an instruction to prevent the default behavior of the right button is generated;
[0061] According to the instruction to prevent the default behavior of the right button, the original right button operation function of the mouse is disabled.
[0062] In a preferred embodiment of the present invention, the following code is used to prevent the generation of the right-button default action instruction and disable the original mouse right-button operation function:
[0063]
[0064] You can customize the right-button operation function of the mouse only after disabling the original right-button operation function of the mouse.
[0065] S3, obtaining the click position corresponding to the mouse click event, and generating a custom right-click command according to the click position;
[0066] In a preferred embodiment of the present invention, the contextmenu event is triggered when the user attempts to open the context menu (usually by right-clicking). The right-click position is captured by monitoring the mouse click event, and the default context menu is prevented from being displayed. The clientX and clientY properties of the event object are then used to obtain the click position of the mouse on the page. After the right-click event is captured and the click position is obtained, a custom right-click command is generated.
[0067] S4. Obtain a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size;
[0068] Preferably, obtaining a custom configuration file according to the custom right-click command includes:
[0069] According to the custom right-key command, determine the corresponding custom right-key type;
[0070] Determining a corresponding configuration file type from a preset configuration file database according to the custom right-click type;
[0071] According to the configuration file type, the corresponding custom configuration file is obtained.
[0072] In a preferred embodiment of the present invention, a custom right-click type represents a mouse right-click menu type, each custom right-click type corresponds to a configuration file type, and a preset configuration file database records the mapping relationship between custom right-click types and configuration file types. When a user triggers a custom right-click command, the corresponding custom right-click type is first searched according to the command, and then the corresponding configuration file type is searched according to the custom right-click type, and finally a specific custom configuration file is extracted from the preset configuration file database according to the configuration file type. The custom configuration file is a js file, which is written in native js. It has strong compatibility, is compatible with all browsers, has a wide range of applications, does not rely on a certain framework, is simple and easy to use, and has rich custom functions that can meet the needs of different scenarios. The introduction of configuration file types makes it possible to use different custom configuration files for different types of functions or operations, thereby improving the scalability and maintainability of the system.
[0073] S5, generating a mouse right-button menu frame according to the click position and the right-button menu size;
[0074] Specifically, generating a mouse right-click menu frame according to the click position and the right-click menu size includes:
[0075] Get the page coordinates of the current page;
[0076] Calculate the right-click menu width and the right-click menu height according to the click position and the right-click menu size;
[0077] Calculate the margins between the click position and the current page according to the click position and the page coordinates to obtain the top margin, bottom margin, left margin and right margin of the page;
[0078] Compare the right-click menu width with the left margin of the page and the right margin of the page to obtain a width comparison result;
[0079] Compare the right-click menu height with the upper margin of the page and the lower margin of the page to obtain a height comparison result;
[0080] A right-click menu frame is generated according to the width comparison result, the height comparison result and the right-click menu size.
[0081] In a preferred embodiment of the present invention, the page coordinates of the current page are first obtained, and then the right-click menu width and the right-click menu height are calculated according to the click position and the right-click menu size; then, according to the click position and the page coordinates, the margins between the click position and the current page are calculated to obtain the upper margin, the lower margin, the left margin and the right margin of the page. It is necessary to determine whether the right-click menu width and the right-click menu height meet the requirements of the current position and the current page margin, so the right-click menu width is compared with the left margin and the right margin of the page to obtain a width comparison result; the right-click menu height is compared with the upper margin and the lower margin of the page to obtain a height comparison result; finally, the position of the menu frame is determined according to the width comparison result, the height comparison result and the right-click menu size, thereby generating the mouse right-click menu frame.
[0082] Preferably, the method further comprises: when the width of the right-click menu is not less than the left margin of the page, and the width of the right-click menu is less than the right margin of the page, determining that the width comparison result is that the distance between the left side of the right-click menu frame of the mouse and the left side of the current page is the preset side margin;
[0083] When the right-click menu width is not less than the left margin of the page, and the right-click menu width is not less than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the mouse right-click menu frame and the right side of the current page is the preset side margin;
[0084] When the right-click menu width is smaller than the left margin of the page, and the right-click menu width is smaller than the right margin of the page, the width comparison result is determined as follows: the click position is the center point width of the mouse right-click menu frame;
[0085] When the right-click menu width is smaller than the left margin of the page and the right-click menu width is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the right-click menu frame and the right side of the current page is the preset side margin.
[0086] In a preferred embodiment of the present invention, when the right-click menu width is not less than the left margin of the page, and the right-click menu width is not less than the right margin of the page, the width comparison result is determined as follows: the distance between the right side of the mouse right-click menu frame and the right side of the current page is the preset side margin, that is, the side of the mouse right-click menu frame is as follows: Figure 3 The black dot indicates the current click position. The customized right-click function will calculate whether the mouse click position is wide enough to fit the menu on the left and right sides of the current page. If not, the menu will be moved appropriately so that the entire menu can be presented intact. The specific position of the move can be customized by the preset side margins.
[0087] Preferably, the method further comprises: when the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is less than the lower margin of the page, determining that the width comparison result is that the distance between the lower side of the right-click menu frame of the mouse and the lower side of the current page is the preset side margin;
[0088] When the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is not less than the lower margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin;
[0089] When the height of the right-click menu is smaller than the upper margin of the page, and the height of the right-click menu is smaller than the lower margin of the page, the width comparison result is determined as follows: the click position is the upper edge of the mouse right-click menu frame;
[0090] When the height of the right-click menu is smaller than the upper margin of the page and the height of the right-click menu is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin.
[0091] In a preferred embodiment of the present invention, when the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is not less than the lower margin of the page, the width comparison result is determined as follows: the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin, and the side of the right-click menu frame is as follows: Figure 4 The black dot is the mouse click position. The custom right-click function customizes the height of the click position from the bottom (preset side margin) and compares it with the height of this menu. When the remaining height is not enough to fit the entire menu, the menu will appear in the upper right corner, making the presentation more complete.
[0092] S6. Generate a right-click menu page on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
[0093] Schematically, generating a right-click menu page on the target window according to the custom configuration file and the right-click menu framework includes:
[0094] Determine the menu item name and menu item attributes of the corresponding menu item according to the custom configuration file;
[0095] According to the target window, the right-button menu frame of the mouse is associated with the target window to obtain an associated menu window;
[0096] The menu item name and the menu item attribute are mapped to the associated menu window to generate a right-click menu page.
[0097] Specifically, menu item names such as Figure 3 The "Details", "New / Associated Project", "Join / Exit Main Service Team" are shown. The target window indicates the display window page of the right-click menu page of the mouse. For example, when the mouse is right-clicked, a new page is opened or the operation is performed on the current page. The optional value _self indicates that the current page is opened, and _blank indicates that a new page is opened. The core code of the custom configuration file is as follows, and "showMouseMenu.js" indicates the custom configuration file:
[0098]
[0099]
[0100] Among them, title indicates the name of the menu item; target indicates the target window. When the mouse right-clicks, it opens a new page or operates on the current page. The optional values are _self to open the current page and _blank to open a new page; addEventListener indicates adding an event listener; type: moreMenus indicates the secondary menu configuration, that is, whether the current menu item has a submenu, such as Figure 5 Click "More" as shown to display a submenu.
[0101] In a preferred embodiment of the present invention, the menu item name and menu item attributes of the corresponding menu item are first determined according to the custom configuration file; then, according to the target window, the right-click menu frame is associated with the target window to obtain an associated menu window; finally, the menu item name and the menu item attributes are mapped to the associated menu window to generate a right-click menu page.
[0102] By implementing this embodiment, when a mouse click event is monitored, it is possible to determine whether the button type corresponding to the mouse click event is a right button; when it is determined that the button type corresponding to the mouse click event is a right button, disable the original mouse right button operation function; obtain the click position corresponding to the mouse click event, and generate a custom right button command according to the click position; obtain a custom configuration file according to the custom right button command; wherein the custom configuration file includes a target window and a right button menu size; generate a mouse right button menu frame according to the click position and the right button menu size; generate a mouse right button menu page on the target window according to the custom configuration file and the mouse right button menu frame, so that the user can perform corresponding operations according to the mouse right button menu page. Based on the general mouse click event and custom configuration file processing mechanism, it can be implemented in different operating systems, terminal devices and applications, so it has high cross-platform compatibility and meets the diverse needs of specific platforms or applications; by monitoring mouse click events and judging button types, it flexibly responds to the user's right-click behavior. Once a right-click is detected, the original mouse right-click operation function can be immediately disabled, and the custom configuration file can be automatically executed to generate a custom right-click menu, which meets the custom menu navigation needs. At the same time, the right-click menu page can be generated without cumbersome menu buttons, and the operation is simple and efficient.
[0103] See also Figure 6 , is a schematic diagram of a structure of a device for customizing a right-button operation function of a mouse provided by an embodiment of the present invention, comprising:
[0104] The right-click judgment module is used to judge whether the button type corresponding to the mouse click event is a right-click when a mouse click event is monitored;
[0105] The original function disabling module is used to disable the original mouse right button operation function when it is determined that the button type corresponding to the mouse click event is the right button;
[0106] A custom command generation module, used to obtain the click position corresponding to the mouse click event, and generate a custom right-click command according to the click position;
[0107] A configuration file acquisition module, used to acquire a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size;
[0108] A right-click menu frame generation module, used to generate a mouse right-click menu frame according to the click position and the right-click menu size;
[0109] The right-click menu generating module is used to generate a right-click menu page on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
[0110] The present invention provides a device for customizing a right-button operation function of a mouse. According to a right-button judgment module, when a mouse click event is monitored, it is judged whether the button type corresponding to the mouse click event is a right button; according to an original function disabling module, when it is determined that the button type corresponding to the mouse click event is a right button, the original right-button operation function of the mouse is disabled; through a custom command generation module, a click position corresponding to the mouse click event is obtained, and a custom right-button command is generated according to the click position; in a configuration file acquisition module, a custom configuration file is obtained according to the custom right-button command; wherein the custom configuration file includes a target window and a right-button menu size; then in a right-button menu frame generation module, a right-button menu frame is generated according to the click position and the right-button menu size; finally, in a right-button menu generation module, a right-button menu page is generated on the target window according to the custom configuration file and the right-button menu frame, so that a user can perform corresponding operations according to the right-button menu page. Based on the general mouse click event and custom configuration file processing mechanism, it can be implemented in different operating systems, terminal devices and applications, so it has high cross-platform compatibility and meets the diverse needs of specific platforms or applications; by monitoring mouse click events and judging button types, it flexibly responds to the user's right-click behavior. Once a right-click is detected, the original mouse right-click operation function can be immediately disabled, and the custom configuration file can be automatically executed to generate a custom right-click menu, which meets the custom menu navigation needs. At the same time, the right-click menu page can be generated without cumbersome menu buttons, and the operation is simple and efficient.
[0111] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0112] Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0113] Another embodiment of the present invention further provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements a method for customizing a right-button operation function of a mouse as described in the above embodiment when executing the computer program. The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory.
[0114] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0115] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device or other volatile solid-state storage device.
[0116] Another embodiment of the present invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a customized method of a right-button mouse operation function described in the above embodiment.
[0117] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium.
[0118] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for customizing the right-button operation function of a mouse, characterized in that: include: When a mouse click event is detected, determine whether the button type corresponding to the mouse click event is a right button; When it is determined that the button type corresponding to the mouse click event is the right button, the original right button operation function of the mouse is disabled; Obtaining the click position corresponding to the mouse click event, and generating a custom right-click command according to the click position; Obtaining a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size; Generate a mouse right-button menu frame according to the click position and the right-button menu size; A right-click menu page is generated on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
2. A method for customizing the right-button operation function of a mouse as claimed in claim 1, characterized in that: When it is determined that the button type corresponding to the mouse click event is the right button, the original right button operation function of the mouse is disabled, including: When it is determined that the button type corresponding to the mouse click event is a right button, an instruction to prevent the default behavior of the right button is generated; According to the instruction to prevent the default behavior of the right button, the original right button operation function of the mouse is disabled.
3. A method for customizing the right-button operation function of a mouse as claimed in claim 1, characterized in that: Obtain a custom configuration file according to the custom right-click command, including: According to the custom right-key command, determine the corresponding custom right-key type; Determining a corresponding configuration file type from a preset configuration file database according to the custom right-click type; According to the configuration file type, the corresponding custom configuration file is obtained.
4. A method for customizing the right-button operation function of a mouse as claimed in claim 1, characterized in that: Generating a mouse right-click menu frame according to the click position and the right-click menu size, including: Get the page coordinates of the current page; Calculate the right-click menu width and the right-click menu height according to the click position and the right-click menu size; Calculate the margins between the click position and the current page according to the click position and the page coordinates to obtain the top margin, bottom margin, left margin and right margin of the page; Compare the right-click menu width with the left margin of the page and the right margin of the page to obtain a width comparison result; Compare the right-click menu height with the upper margin of the page and the lower margin of the page to obtain a height comparison result; A right-click menu frame is generated according to the width comparison result, the height comparison result and the right-click menu size.
5. A method for customizing the right-button operation function of a mouse as claimed in claim 4, characterized in that: Also includes: When the right-click menu width is not less than the left margin of the page, and the right-click menu width is less than the right margin of the page, the width comparison result is determined as that the distance between the left side of the right-click menu frame and the left side of the current page is the preset side margin; When the right-click menu width is not less than the left margin of the page, and the right-click menu width is not less than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the mouse right-click menu frame and the right side of the current page is the preset side margin; When the right-click menu width is smaller than the left margin of the page, and the right-click menu width is smaller than the right margin of the page, the width comparison result is determined as follows: the click position is the center point width of the mouse right-click menu frame; When the right-click menu width is smaller than the left margin of the page and the right-click menu width is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the right side of the right-click menu frame and the right side of the current page is the preset side margin.
6. A method for customizing the right-button operation function of a mouse as claimed in claim 5, characterized in that: Also includes: When the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is less than the lower margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin; When the height of the right-click menu is not less than the upper margin of the page, and the height of the right-click menu is not less than the lower margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin; When the height of the right-click menu is smaller than the upper margin of the page, and the height of the right-click menu is smaller than the lower margin of the page, the width comparison result is determined as follows: the click position is the upper edge of the mouse right-click menu frame; When the height of the right-click menu is smaller than the upper margin of the page and the height of the right-click menu is not smaller than the right margin of the page, the width comparison result is determined to be that the distance between the lower side of the right-click menu frame and the lower side of the current page is the preset side margin.
7. A method for customizing the right-button operation function of a mouse as claimed in claim 1, characterized in that: Generating a right-click menu page on the target window according to the custom configuration file and the right-click menu framework includes: Determine the menu item name and menu item attributes of the corresponding menu item according to the custom configuration file; According to the target window, the right-button menu frame of the mouse is associated with the target window to obtain an associated menu window; The menu item name and the menu item attribute are mapped to the associated menu window to generate a right-click menu page.
8. A device for customizing the right-button operation function of a mouse, characterized in that: include: The right-click judgment module is used to judge whether the button type corresponding to the mouse click event is a right-click when a mouse click event is monitored; The original function disabling module is used to disable the original mouse right button operation function when it is determined that the button type corresponding to the mouse click event is the right button; A custom command generation module, used to obtain the click position corresponding to the mouse click event, and generate a custom right-click command according to the click position; A configuration file acquisition module, used to acquire a custom configuration file according to the custom right-click command; wherein the custom configuration file includes a target window and a right-click menu size; A right-click menu frame generation module, used to generate a mouse right-click menu frame according to the click position and the right-click menu size; The right-click menu generating module is used to generate a right-click menu page on the target window according to the custom configuration file and the right-click menu frame, so that the user can perform corresponding operations according to the right-click menu page.
9. A terminal device, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for customizing a right-button operation function of a mouse as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute a method for customizing a right-button operation function of a mouse as claimed in any one of claims 1 to 7.